Archive for November 30, 2010

Deploying InfoPath Form to SharePoint 2010 Site

Deploying an InfoPath form to SharePoint 2010 is relatively straight forward, as long as you remember a few simple steps.

For an easier deployment experience, avoid code behind (managed forms) in your InfoPath form unless you really have to. That’s for another day, so this post will concentrate on how to deploying an InfoPath form with no associated code behind files.

Open InfoPath and either open or create a form. I’m not going to go into how to hook up the form with a data connection, just how to configure and publish it.
Read more

Updating Term Store Field Value

There appears to be various different recommendations of ways for updating a term store field value and I’d like to chip in with mine.

Some recommend updating by setting the list item’s hidden taxonomy field, which looks something like the following.

First, get the Guid for the term we need to update:
Read more

Correlation value on declaration “x” is already initialized

If you’re writing a workflow and are using the CreateTask or CreateTaskWithContentType activities you may come across the following error:

System.InvalidOperationException: Correlation value on declaration “Name of your token” is already initialized

When adding a token to the create task activity you will more than likely have set the OwnerActivityName property of CorrelationToken to the workflow itself.

The create task activity (and subsequent OnTaskCreated, OnTaskChanged and CompleteTask activities) should be contained within a Sequence activity (or a child type) and it is this that should be used for the OwnerActivityName property.

Ensure that all task activities contained in your sequence block use the same correlation token definition.

Debugging SharePoint Timer Service Assemblies

If you’re creating your own workflows and want to be able to debug into your code using the timer service (OWSTIMER.EXE) deploying your assembly to the GAC won’t normally be enough for the correct symbols to be loaded. This is due to the SharePoint timer service keeping a cached version of the assemblies it uses.

To force the service to refresh the assemblies it uses you need to restart the SharePoint 2010 Timer service from the services snap-in before attaching the debugger.

Alternatively, you could add the following to the post-build event of the project you want to be able to debug:

net stop SPTimerV4
“C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil” /i “$(TargetPath)” /f
net start SPTimerV4

This will stop the SharePoint timer service, copy the updated assembly to the GAC before restarting the service again.

Where’s the location of the gacutil program? Gacutil comes with version 1 and 1.1 of the .Net framework (not 2 or above) and Visual Studio. So it should be in at least one of these locations:

%programfiles%\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\
%programfiles%\Microsoft SDKs\Windows\v6.0\Bin\
%programfiles%\Microsoft SDKs\Windows\v6.0A\Bin\
%programfiles%\Microsoft SDKs\Windows\v7.0\Bin\
%programfiles%\Microsoft SDKs\Windows\v7.0A\Bin\

For reference, here is the Gacutil MSDN page:

Updating URL field for ExtendedProperties in workflow

I was trying to update a URL field of a task within a custom workflow I was writing and spent a bit more time than I’d have liked trying to get the URL and description to save correctly in the task item being created as part of the CreateTaskWithContentType activity.

Obviously you can’t save a SPFieldUrlValue as an object directly against the ExtendedProperties as it is not a simple type, such as a string or an integer. Nearly every other field provided with SharePoint that contains multiple values is separated by the #; characters. The URL field is different in that it uses the comma as the separator. I knew this and set the extended property to something like:

TaskProperties.ExtendedProperties[guidIdOfField] = "http://somewebaddress,Description";

Read more


Get every new post delivered to your Inbox

Join other followers: