Wednesday, 31 October 2007

First steps to authoring Visual Studio Workflows for SharePoint

The following 4 posts from Sahil Malik I believe give you a few good sessions on authoring workflow with Visual Studio.

1. Setting up your environment for writing VS2005 workflows.
2. Writing an ultra basic workflow, deploying it, and slicing dicing how it worked.
3. Making that workflow more complex, adding if/else, and a bunch of activities that sort of make it more interesting.
4. Adding user interaction to that workflow using Infopath forms.

Pitfalls you might encounter:

Pitfall 1: Value does not fall within expected range.

This is a problem with the workflow.xml definition file. The TaskListContentTypeId is defined in the snippet as 0x000. This does not work and gives this error when you try to access the workflow from the list settings.

I found a solution to this problem in this post:

"Value does not fall within expected range" Most probably due to a wrong value for the TaskListContentTypeID in the workflow.xml, I don't know what are the possible values but this one works: "0x01080100C9C9515DE4E24001905074F980F93160"

More details on this are found here: Workflow Task Forms (Windows SharePoint Services)

Pitfall 2: Unexpected error

This is quite an informative error. You'll need to access the logs to determine what happened. Again this is a problem with the default workflow.xml snippet. I found an error that the MyAssocForm.aspx does not exist (and when I checked in the layouts directly it really doesn't exist). So in the workflow.xml you need to remove references to:

  • MyAssocForm.aspx
  • MyInitForm.aspx
  • MyModForm.aspx

The WrkStat.aspx exists, so we'll leave it there. The above pages need to be defined for more advanced workflows.

Pitfall 3: Workflow install.bat works flawlessly but you get Failed to Start in the workflow

Could not load file or assembly Load Workflow Assembly: System.IO.FileNotFoundException: Could not load file or assembly 'xxxxxx, Version=, Culture=neutral, PublicKeyToken=xxxxxxxxxxx' or one of its dependencies.

This was the problem which caused much frustration, whining, pulling hair and lots of waste of time.

This is usually a problem either with feature.xml or highly likely workflow.xml. My problem was that the workflow.xml file in the CodeBesideClass I had one single character which was lowercase instead of uppercase. Example I had TestofWorkflow instead of TestOfWorkflow. Obviously you can imagine, the reaction I had when I managed to solve this problem.

Hopefully some of you can find this blog and solve their problems much faster than myself.

Adding Workflow Activities to the Visual Studio ToolBox

So you've thought you've setup all the environment to develop SharePoint Workflows using Visual Studio. However, when you create a SharePoint Sequential Workflow Library, the toolbox for SharePoint is empty whilst you know there should be something there.

To add those activities to your workflow project. In the workflow designer page, right click on the Toolbox pane and Choose Add Tab and create your SharePoint Workflow Tab. Right click on the new tab and select Choose Items. Select the Activities tab and click Browse. Browse to %\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\ Select the Microsoft.SharePoint.WorkflowActions.dll and click OK. This adds all the Workflow Actions activities to your toolbox.

Covelle Corner: Add SharePoint workflow activities to your VS 2005 workflow project

Using a Workflow to copy list items from one website to another

We currently have a requirement to implement staged environment. On a particular web application we want to be able to submit certain documents /forms semi-anonymously (thus exposing thus being able to expose this site to the Internet, although it won't be completely anonymous), with items from this webapp then being copied into an "internal" web application, which is used to allow internal users to administer submitted documents.

The issue here is that the two applications will have to different authentication mechanisms, therefore we need a way to copy list items from the "front" to the "backend" web application.

To do this we think the best way is to implement a Visual Studio workflow to do this. As i first started my research, I couldn't find any good references. However as I started digging into the SDK I came across the CopyFrom method of the SPListItem object. As I investigated what the CopyForm method does exactly, I came across the following sites which give the basics of copying list items from one site to another.

which refers to the site:

I'm hoping that someone looking for this solution will find it easier to find this information to do this.

Wednesday, 24 October 2007

InfoPath and Forms Server Resources

While researching a particular project we are working on concerning deployment of a number of InfoPath developed forms on Forms Server I came across a Technet WebCast which uses the XmlFormView control in ASP.NET to host InfoPath forms.

This is something which is extremely cool, because you can have a simple aspx page which presents a minimal view just of your form (rendered via Forms Server), which can be exposed to the Internet. Forms are then submitted and then processing of these forms can be done on normal SharePoint sites, i.e. forms are then processed by administration.

E.g. you have a government department which has all kinds of application forms. These are exposed via Forms Server to the departments website, and once these are submitted, processing of these forms is done by the department using SharePoint internally.

Hosting the InfoPath 2007 Form Editing Environment in a Custom Web Form

I'll be posting more information on how to do this hopefully in the very near future...

Tuesday, 23 October 2007

Free SharePoint 2007 eBook

The following ebook is a very good resource for any new sharepoint developers, both as a good introduction and to explain new features in 2007 / WSS 3.0

Friday, 12 October 2007

More branding links

CSS Branding - the way to do it...

Thursday, 11 October 2007

Breadcrumb links not working?

Personally I find the breadcrumb a very useful navigation tool, and it usually makes it quite clear to an end point user where the user is currently in terms of navigation (especially when you just want to go one level up).

Seems like some of the default master pages which come with SharePoint have the bread crumb links off by default (e.g. BlueBand.master). There is a very simple solution for getting this working though:

Open the master page in SharePoint Designer. Find the bread crumb code (look for SiteMapPath which is the control which renders the breadcrumb) and find the RenderCurrentNodeAsLink attribute and change it from false to true.


Obviously if you don't find the SiteMapPath in your master page, then you first have to include the whole breadcrumb functionality in you master page ;)

<asp:SiteMapPath ID="siteMapPath" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode" RenderCurrentNodeAsLink="true" CurrentNodeStyle-CssClass="breadcrumbCurrent" NodeStyle-CssClass="ms-sitemapdirectional"/>

Alerts and other emails taking too long to arrive?

On a SharePoint development environment or for demo purposes you don't want to wait 5 minutes (or whatever the default is) to receive alerts and other SharePoint emails. To make sure that these arrive every minute, you need to update the property of the immediate jobs alert timer.

This is done by running the following command:

stsadm -o setproperty -propertyname job-immediate-alerts -url http://yoursite -propertyvalue "every 1 minutes"

This is not a good idea in live environments because you have your content database being queried every minute!

Wednesday, 10 October 2007

Customizing the My Site template / master page

Came across the following article from Steve Peschka about customizing my sites:

Not sure if this will allow you to apply master pages from the portal e.g. BlueBand.master or other master pages to the My Site.

If anyone knows how to do this, please do drop me a line.

In the meantime, I have also come across this article which looks like it is doing the same things as in the first article listed but this is all done manually.

Friday, 5 October 2007

Presence Information / Online Status won't show unless ...


you have MSN Messenger installed on the machine where you are accessing SharePoint.

Other settings which you might need to look at:
1. You have setup Person Name Smart Tag and Presence Settings in Web Application General Settings in Central Administration
2. Site being accessed is in Trusted Site list

Thursday, 4 October 2007

Changing Service Accounts in MOSS / WSS

The following articles is quick overview of service accounts available, what they are used for, and how to change each of them to have a best practices configuration.