Category Archives: SharePoint

Indentity Crisis

For the longest time, I have been trying to get away from M$ products and my dependence upon them.  My blog, however, continues to generate a majority of its hits from just a few very specific articles on Microsoft SharePoint.  It seems that I will have to do a lot more blogging to steer myself away from this unwanted association!

[SP Gotchas] Error When Programmatically Starting Workflow

I’ve recently had a need to model a looping workflow with a SharePoint Designer workflow.  Designer doesn’t have a ‘Start Workflow’ action available by default, so I installed the Useful SharePoint Designer Workflow Activities on Codeplex.

My workflow would be designed like this

  1. Collect Data From Users with Task Form
  2. Set Workflow Variable to Step 1 Task ID
  3. Check for repeat condition on Above Task
    1. Start a new instance of this workflow
  4. (Workflow Done)

Looks great, but when running this workflow, I kept getting the following error:

Exception from HRESULT: 0x8102009B

at Microsoft.SharePoint.Library.SPRequest.AddWorkflowToListItem(String bstrUrl, String bstrListName, Int32 lItemID, Int32 lItemLevel, Int32 lItemVersion, Guid workflowPackageId, Guid& pWorkflowInstanceId, Guid workflowTaskListId, String bstrStatusFieldInternalName, Int32 lAuthorId)

I searched around and found out that you cannot start an instance of a workflow on an item when the same workflow is already running on that item.  Lucy’s blog had a code sample which checked the target item for the duplicate WF and removed the WF if it was found.  I wanted to keep the data from the first workflow, and this would remove it.  Not exactly what I wanted.

Here’s a simpler approach I took:

Modify the original workflow (Workflow A)…

  1. Collect Data From Users with Task Form
  2. Set Workflow Variable to Step 1 Task ID
    1. Check for repeat condition on Above Task
    2. Start a new instance of the LookBack workflow
    3. Stop this workflow and log the message ‘Completed – Looping’
  3. (Workflow Done)

Create a second workflow called ‘LoopBack’:

  1. Pause for 1 minute
  2. Start a new instance of Workflow A
  3. (Workflow Done)

I can start an instance of LoopBack at the same time as Workflow A.  Then, LoopBack waits while Workflow A completes.  After that, it starts Workflow A over again.  The pause is there since Workflow A takes some time to fully complete.

Note, if you’re not running SP1, the Pause for 1 minute step will take 30 minutes to complete.  Installing SP1 will fix this issue.

This is a really simple way to model a looping workflow without going into Visual Studio.

SharePoint Content Deployment Job Stuck at ‘Preparing’

Not only did DST rob me of an hour of sleep this weekend, it’s also slowing down my content deployment jobs!  Thanks a lot, Benjamin Franklin!

This KB article seems to explain the problem as beeing that the OWSTIMER has its own clock which is separate from the system clock.  I scheduled a job for 11:17am this morning and it showed a status of ‘preparing’ until 12:17pm, at which time it ran smoothly.

A couple of solutions: set your jobs to run as if you were still in non-DST.  Right now, that would mean that I would schedule a job for one hour from now if I wanted it to run immediately.  Second solution: change your server time zone to a non-DST time zone and disable automatic time updates.

Update 2008-03-11:
Install SP1 to alleviate this problem!  I assumed the server I was working on had SP1, but I was wrong.  Running the update fixed the problem immediately.

[SP Gotchas] Core.css Keeps Overriding My Styles!

If you use the CssRegistration and CssLink controls on a SharePoint page, core.css is always added to the HTML page last.  This means that any styles in core.css will override the styles you’ve defined in your custom stylesheets.  Does this make sense?! No.  But, like many other things in SharePoint, that’s the way it is.

A quick way to fix this is to just use a plain <link …> tag to include your stylesheets.  Since those aren’t processed server-side like links in the controls mentioned above, they will be loaded in the order you define in the HTML.

Heather Solomon has a blog post about this issue as well.

[SP Gotchas] SharePoint and the Name.dll

SharePoint has a nifty little feature which allows logged-in users to tell which other users are logged in (or away, or idle, etc.)  While this is a handy thing to have in an intranet setting, having your users prompted with the Name.dll download on a public web site isn’t desirable.  Here’s how to get rid of that pesky download prompt:

http://support.microsoft.com/kb/931509

[SP Gotchas] SPD Says a File is Checked Out When it Really Isn’t

Ever have SharePoint Designer tell you that something is checked out, but you know that it really isn’t? Here’s a link forwarded to me by a coworker:

 http://robgarrett.com/cs/blogs/software/archive/2007/12/14/sharepoint-designer-and-sharepoint-out-of-sync.aspx

Customizing SharePoint Content Reports

Here’s a useful article with instructions on how to add new reports to the Site Actions / View Reports menu:

http://blogs.msdn.com/ecm/archive/2006/11/15/report-rapport.aspx

SharePoint Content and Structure Reports not Showing

While working on a client’s MOSS 2007 public web site, I noticed that none of the reports in the Site Content and Structure page were not working. (There were duplicates as well, which I fixed by simply deleting the duplicate items from the Content and Structure Reports list at the root level.) I would click the item in the View drop down list, and the page would simply refresh. I checked the error log and found the following error:

SMObjectList.SmtReportsList: Reports List was not provisioned

Searching the web only revealed that other people were having the same problem. Microsoft wrote a KB article describing at least one symptom I was experiencing: duplicate report entries in the Site Actions menu. The article did not explain that the hot fix would also remedy the problem of no results showing up.

I emailed Microsoft customer support a few times, got the KB download, but didn’t feel very comfortable installing the hot fix on a production server just a few days before go-live. Also, the verbiage of the installation instructions seemed to imply that I had to export and re-import the site. Not something I wanted to do.

I then did some work to track down the error listed above by using .Net Reflector. The error was coming from a property called ‘SiteCollectionReportsListId‘ on the Microsoft.SharePoint.Publishing.Internal.WebControls.SMObjectList.SmtReportsList class. Of course, like all nifty properties in SharePoint, it was private. I was able to figure out where the property was getting its information, which was simply from the AllProperties hashtable in the SPWeb at the root of the site.

Writing a quick console app enabled me to find out that the problem site had this property set, but it was set to a GUID which didn’t point to a list on the current site. This GUID wasn’t changed when the site was imported using STSADM! I then wrote some more code in my handy little console app and tweaked the property to the valid GUID. Voila! Reports started working again!

Source Code  Executable

VSeWSS and WSPBuilder new releases

New versions of Visual Studio Extensions for Windows SharePoint Services and WSPBuilder were released within the last week.  I’ve used WSPBuilder on many client projects.  VSeWSS has been lacking in features and stability, but it seems like many of the kinks have been worked out in this final version.  The most interesting new feature of VSeWSS is the WSP View, which allows you to include or project file from being in the produced WSP.I’m not sure which tool is better at this point, as I haven’t tested out VSeWSS yet.

Update: 2/28/2008
While I was initially excited about the new VSeWSS, I’m still a little disappointed.  You can’t install it on a Vista or XP Machine.  I also like to build my WSP without deploying it or updating the current server (I can’t update or deploy if I’m on Vista); WSPBuilder lets me do that.

WSPBuilder also includes some neat things that VSeWW doesn’t have: a template for a solution with workflow, a template for a workflow feature, a menu item in VS to creates a SharePoint Solution Installer package, the ability to build WSPs via command line, not to mention the configurability offered through the config file (and the open source).

Create Lookup Site Columns & Target Lists Through a Feature

Here’s another provisioning gotcha. I had some problems provisioning a site column which pointed to a list I was also provisioning through a feature. Below are some code examples of how I implemented a quick solution.

read more »