Monday, June 9, 2008

A duplicate name "Item" was found

While creating a new site collection I encountered this error

"A duplicate name "Item" was found".

When I looked at the SharePoint Logs, they looked like

Creating top level site at http://xxxxx/sites/pub
Creating site: URL "/sites/pub"
Recalc needs to happen. Real = 0, Cached =-1, WFE = -1
Activating site-scoped features for template "global" at URL "http://xxxxx/sites/pub"
.
.
.
.
.
Failed to find the parent content type ID="ct-1033-0x010801c88a06ea0bfc4da991e96ef7d1d44f" for content type ID="ct-1033-0x010801c88a06ea0bfc4da991e96ef7d1d44f24"

The last line is the culprit! Few days back I was having problem creating a new content type where it says Failed to find the parent content type ID. Though I could resolve that problem at that time I forgot to uninstall the feature with invalid content type id. Now that feature is causing problem when I try to create a new site collection.

To resolve this just uninstall the feature that was causing the problem. You can look the logs to find the feature (or feature id) that's causing the problem.

Wednesday, June 4, 2008

How to Bind SendEmail Activity Properties Dynamically from code

You can do this by binding properties at design time to To, Subject, CC, BCC, Body. If you don't know how to bind properties, look at the following screenshots

This is how your properties windows of SendEmail activity looks like

Click on the button against To property (or the property that you want to bind) and the following Bind window will come up, go to the second tab, either choose Create Field or Create Property option.


Now assign the value to the newly created property in your code.

Tuesday, May 27, 2008

System.InvalidOperationException: Correlation value specified does not match the already initialized correlation value

Though you supply the same correlation token for TaskChanged/CompleteTask/DeleteTask as that of CreateTask, if you are getting the following error:

System.InvalidOperationException: Correlation value specified does not match the already initialized correlation value on declaration Task1Token for activity completeTask2. at System.Workflow.Activities.CorrelationService.ValidateCorrelation(ICollection`1 initializerProperties, ICollection`1 followerProperties, String memberName, Activity activity) at System.Workflow.Activities.CorrelationService.InvalidateCorrelationToken(Activity activity, Type interfaceType, String methodName, Object[] messageArgs) at System.Workflow.Activities.CallExternalMethodActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecuto...

then here is the Solution:

SharePoint is giving you the wrong direction. The problem is not with the Correlation Token but with the Task ID! Just like the correlation token, Task ID should be the same as that of Create Task. So, point to the correct Task ID and it will solve the problem!

Friday, May 23, 2008

Failed to find the parent content type ID

If you have created a content type id by appending GUID to the parent type id as follows:

0x010801FBE5603FF6FD4ae3878BFC1D597E826C

and facing the error

Failed to find the parent content type ID="ct-1033-0x010801.......",

then here is the Solution:

append two zeros to the parent type id before adding the new GUID as follows

0x01080100FBE5603FF6FD4ae3878BFC1D597E826C

This should solve it!