Wednesday, October 27, 2010

How to solve Microsoft.SharePoint.SPException: A file with the name xxx already exists. It was last modified by SHAREPOINT\system on xxx

In the workflow, if the workflow needs to update the column/field of the current workflow list item, i.e., workflowproperites.listitem, workflowproperties.listitem.update() will cause above exception. To solve this problem, the workflow needs to retrieve the listitem independently, as suggested by this blog by


My resolution is to add a simple property to my WF class. What it will do is ensure that I always load up the SPListItem every time I need it.

private SPListItem WorkflowItem
{
    get
    {
        SPDocumentLibrary library = (SPDocumentLibrary)WorkflowProperties.Web.Lists[WorkflowProperties.ListId];

        return library.GetItemById(WorkflowProperties.ItemId);
    }
}


There are many suggestions about how to fix this problem, but this one did it for me.

Monday, October 25, 2010

Service Account Suggestions for SharePoint 2010 from Todd Klindt

Service Account Suggestions for SharePoint 2010

Friday, October 15, 2010

Start SharePoint Workflow from Web Services

Just some quick points:
  • I place the web application with the web services under the same application pool of SharePoint, also in the web services I use SPSecurity.RunWithElevatedPrivileges. Otherwise, you may run into the error message like the following: System.IO.FileNotFoundException thrown by the SPSite constructor.
  • Also I enabled web.AllowUnsafeUpdates so that to not run into security validation error.

Creating a Custom Web Service for SharePoint

Creating a Custom Web Service for SharePoint

Wednesday, October 6, 2010

Task failed because "sgen.exe" was not found: solution

When building an InfoPath solution with code behind, with web services references, you may run into above error message. The following link provides 2 solutions, but the first solution did not work for me, the second one did.

http://www.itjungles.com/dotnet/task-failed-because-sgen-exe-was-not-found-solution