SharePoint / ASP.Net Development
Experiences from the field...
Navigation
   RSS 2.0
Categories
Entries by Month

 Thursday, June 26, 2008

Occasionally, I see a question about determining if a given installation is MOSS or simply WSS. I am unaware of any Object Model method or property that indicates this, but I did find a different way. The User Profile service is a web service that is included in MOSS and not WSS. So, if the asmx file exists, then MOSS is installed.

Here is a code snippet:

string isapiFolder = SPUtility.GetGenericSetupPath("ISAPI");
string userProfileServicePath = Path.Combine(isapiFolder, "UserProfileService.asmx");
bool SharePointServerInstalled = File.Exists(userProfileServicePath);
Thursday, June 26, 2008 11:53:12 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Thursday, June 05, 2008

Daniel Larson has been sending smoke signals for the last week about using the RunWithElevatedPrivilege (RWEP) method. He finally goes into further detail today with his cautionary tale and a recommended SPUserToken work-around.

I have seen several programs that use RWEP to accomplish updates on behalf of a user. (In fact, I use the method in the Image Upload Web Part.) In this circumstance Daniel is advocating using impersonation via the SPUserToken for the "System Account." I believe this to be sound advice and will be updating my code accordingly.

Thursday, June 05, 2008 7:25:30 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Thursday, May 01, 2008

Introduction

The out-of-the-box Image Web Part can be used to display an image on a site. The web part has a property that specifies the web address of the image. For most site members, this is problematic – how do they get an image on the web site? And how do they determine the web address? For power users, these steps are understood, but are time consuming to complete.

The Image Upload Web Part will allow the site member to browse their local computer for the image. Once the image is selected, the web part will automatically upload the image to a location specified by an administrator and set the web address.

The result is a solution that works for both groups. Site members can display pictures from their computer and administrators can provide storage for those pictures with changing the permissions of their site and with minimal training.

More information available in the download or at the project's page on CodePlex.

ImageUploadv3.zip (.16 KB)
Thursday, May 01, 2008 1:19:20 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Wednesday, March 12, 2008

I am working on getting a community site up to host these articles as well as the code. My hope is that all interested developers will contribute their solution to the various Actions that can be selected in SharePoint designer.

This post is the first in a series. The series will discuss the porting steps as we presented in Seattle, but with the details filled in. (We had only 75 minutes to present, which is way too little.) Part 1 will discuss the virtual machine setup and the creation of the SharePoint Designer workflow that will be ported.

Virtual Machine Setup

When a workflow is created in SharePoint Designer, the site is updated with a few pieces that enable it to work. We want to ensure that we port all of these pieces, so we will be using two different web applications. The first at http://spdflow will be used for the SharePoint Designer workflow. The second at http://vsflow will host the Visual Studio workflow. Rather than use different port numbers for the web application, the hosts file (C:\WINDOWS\system32\drivers\etc\hosts) is updated with each of these host names.

The virtual machine will also have the necessary applications installed: SharePoint Designer 2007 and Visual Studio 2005 with the Office SharePoint Server 2007 SDK.

SharePoint Designer

We will use SharePoint Designer to create a workflow. The workflow will perform the most popular actions -- collecting data, creating a task and writing to the history list. This is accomplished via the following steps:

  • In SharePoint Designer, open the site http://spdflow.
  • Click File | New | Workflow. The Workflow Designer wizard is displayed.
  • Name the workflow SPDFlow and attach it to the Announcements list. Leave the start options at the default, which is manually. (We'll be starting it often.)

  • Click on the Initiation button on the bottom
  • Add a Workflow Initiation Parameter named InitiationField with a default value of Barracuda. Then click OK

  • Back in the Workflow Designer wizard, Click Next.
  • In Step 1, click on the Conditions button and choose Compare Announcements field.

  • Choose the Modified By field and the account name of the current user.

  • Click on the Actions button and choose Collect Data from User.

  • Click on the "data" link to invoke the Custom Task Wizard.

  • Enter "Collect Data Task" for the task name and click Next

  • Click Add to create a field.

  • Name the field "TaskField" and enter a default value of "DeliverPoint"

  • Click Finish on the Custom Task Wizard. You will receive a warning about running instances, which can be ignored.
  • Click on the "this user" link in Step 1 Actions. Select the account name for the current user.

  • Click on the "Variable: collect" link in Step 1 Actions. Rather than put the data in a generically named variable called "collect," choose "Create a new variable" and name it "ListItemID"

  • Click on the Variables button at the bottom of the Workflow Designer form. Even though we did not choose the variable named "collect," it was created for us. Remove it, and any other unused variables, from the list.
  • Click Finish.

SharePoint Designer will save the workflow and associate it with the Announcements list. Test the workflow by returning to the browser and navigating to the Announcements list.

  • On the context menu of a list item, select Workflows

  • On the Workflows page in the Start a New Workflow section, click on the name of the workflow (SPDFlow)

  • The initiation form is displayed. Click Start

  • The Announcements list is displayed, with a new column on the far right. The column name matches the name of the workflow and the value is "In Progress"

  • Click on "In Progress" to display the Workflow Status page

  • In the middle of the page is the name of the task: CollectDataTask. Click on this link to display the task.

  • Click on Edit Item in the tool bar. This will display the custom task edit form for this workflow

  • Click on Complete Task

    At this point we have a workflow that was created in SharePoint Designer. The next post is this series will move us further along our path. Stay tuned!

Wednesday, March 12, 2008 6:33:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Tuesday, December 04, 2007

I added a new operation to the Barracuda Application Extension Download:

stsadm -o enumsitegallerytemplates -site <site collection url>

   Displays the names and identifiers of Site Definitions in the Site Template Gallery.

 

Barracuda StsAdm Extensions.wsp (8.01 KB)

Tuesday, December 04, 2007 5:26:08 PM (Central Standard Time, UTC-06:00)  #    Comments [1]  | 
 Tuesday, May 01, 2007

I found a particularly interesting comment on the Technet Script Center page for Scheduled Tasks:

Note that this class can only return jobs that are created using either a script or AT.exe. It cannot return information about jobs that are either created by or modified by the Scheduled Task wizard.

A search of the .Net Framework turned up empty. As far as I can tell, schtasks.exe is the way to go if you want the end-users to be able to change the default entry…


UPDATED June 14, 2007:   I used the Task Scheduler library from Code Project. 

Tuesday, May 01, 2007 5:12:06 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Wednesday, December 21, 2005
Wednesday, December 21, 2005 11:30:08 AM (Central Standard Time, UTC-06:00)  #    Comments [0]  | 
 Tuesday, August 30, 2005

Sometimes, it seems that the .MDB file will live forever. I recently had to convert some DDL so it would work against the Jet data engine. (Jet does not use ANSI SQL.) In the depths of the MSDN archive was a very useful reference series: Fundamental Microsoft Jet SQL for Access 2000. This page links to two more -- titled Intermediate and Advanced.

Tuesday, August 30, 2005 3:36:08 PM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Saturday, August 27, 2005

If you are using active generation of templates, here is a build script that invokes CodeSmith:

<?xml version="1.0" encoding="unicode"?>
<project name="nant" default="compile" xmlns="http://nant.sf.net/schemas/nant.xsd">
 <property name="CodeSmith" value="cs.exe" />

 <target name="compile" depends="genruntime" description="Compile entire solution">
  <solution solutionfile="src\project.sln" configuration="release">
   <webmap>
    <map url="http://localhost/ProjectWeb" path="src\ProjectWeb" />
   </webmap>
  </solution>
 </target>
 <target name="genruntime" description="Generate O/R Classes for the runtime library">
  <exec program="${CodeSmith}" basedir="tools\codesmith" workingdir="src\ProjectWeb.Runtime">
   <arg value="/t: Templates\ClassGenerator.cst" />
   <arg value="/ps: ORClasses.xml" />
  </exec>
 </target>

This script was influenced by Mike Roberts' article How to setup a .NET Development Tree. (Thanks Mike!) I use a property to alias the CodeSmith command (cs.exe) because I kept thinking csc (which compiles C# code).

Saturday, August 27, 2005 11:15:59 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
 Monday, August 22, 2005

Do you have an ASP.Net application that will run in an Application Pool with a specific identity? Before you enter the user account in the Identity tab of the Application Pool properties dialog, you should add the account to the local group IIS_WPG. If you forget, you get permission issues. And permission issues are the hardest to fix, imho.

(I am sure you can guess why I am blogging this...)

Monday, August 22, 2005 11:58:52 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
Search

Further Reading...

Powered by: newtelligence dasBlog 1.9.7067.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008, Paul Schaeflein

Send mail to the author(s) E-mail