Custom SharePoint Designer action not displaying in a workflow when selected from the actions list

December 8, 2011

As part of my studying for SharePoint development exams 70-573 and 70-576 I have been looking at areas I haven’t had any previous experience and trying them out. As part of this I decided to look at creating a customer SharePoint Designer action.

The scenario I decided to look into was creating an action which accepted some parameters and then created a new site at a specific location. I won’t go into the code for this as its fairly straightforward. What I wanted to highlight was the problems I encountered when trying to add the action to a test SharePoint Designer workflow.

When starting out I have a look on the web and found a few articles to get me going, see links below. I followed the first article but found when I deployed this the new action appeared in SharePoint Designer but when I clicked on this nothing happened the action didn’t appear in the workflow.

Looking at the comments on the site it appeared a few other people had the same problem but there was no answer out supplied. I checked and re-checked my .actions file, the manual web.config entry and setting in in the advanced section of the package in Visual Studio. All the components like the assembly name, version number and public token key all looked the same. Eventually out of frustration I copied the whole string  in Assembly Name attribute set in the package, see figure 1, and copied and paste it into the two other locations and it worked. At first I couldn’t believe this would make a difference as long as the assembly name, version number and token were correct but it seems like the string has to match exactly, see below figures 1 2 and 3 in which the only difference is figure 2 doesn’t have a space between the assembly name and the version and this doesn’t work.

Hopefully this will save someone else from the frustrations I enjoyed Smile

Figure 1

SharePointDesignerAction

Figure 2

SharePointDesignerAction2

Figure 3

SharePointDesignerAction3

Links

http://msmvps.com/blogs/sundar_narasiman/archive/2010/12/26/develop-custom-workflow-activity-for-sharepoint-2010-workflow.aspx

http://toddbaginski.com/blog/how-to-create-a-custom-windows-workflow-activity-and/


Error on theme page post SharePoint 2010 upgrade

July 29, 2011

I recently upgraded a MOSS 2007 site to SharePoint Server 2010 which seemed to go relatively smoothly, however a short while after the upgrade a user reported they got an error when trying to set the theme on a new site.

When I checked this was indeed the case i got an object reference not set to an instance of an object error, see full error below. I spent some time looking into this and researching information online and I was able to establish the error was down to the fact that the theme gallery had not been created in the upgraded site.

I found some articles, see below, that seemed to deal with the same issue and while I found the information useful it didn’t supply instructions on how this could be achieved hence why I decided to document the steps I performed to correct this.

http://social.technet.microsoft.com/Forums/en-IN/sharepoint2010setup/thread/62ad2624-26f1-4193-8917-fa37ae18ca08

http://www.sharepointalex.co.uk/index.php/2010/09/themes-gallery-missing-in-sharepoint-2010-site-after-visual-upgrade/

From looking at the articles above the options were to re-create the theme gallery or redo the upgrade. Realistically redoing the upgrade was not an option so this left me with trying to either move the theme gallery from another site collection or recreating it.

My first though was this was something I could do through SharePoint Designer so I opened a test SharePoint 2010 site and tried to export the themes list but quickly found this was not possible.

My next attempt was to try and copy from one SharePoint Designer instance to another. To do this I created a test site collection on the production environment and opened this in SharePoint Designer. With two SharePoint Designer windows open side by side I tried to copy the theme gallery from the test site and paste it into the upgraded site. This partially worked but it re-created it as a folder not a list so while I could browse to the URL it didn’t recognise it as a list.

Next I tried copying the theme gallery as a list template and re-create it using this. I navigated to the theme gallery on my test site collection and went to the settings but found there is no save list as a template option on this list. I got around this by getting the list ID of the theme gallery and then going to save another list and clicking save as a template. In the new screen I then replaced the list ID in the query string with the theme gallery list ID. This then allowed me to save the gallery as a template and I could see it in the list gallery. When I then went to create a new list I found the template I saved was not available. Thinking about it this made perfect sense as the default theme gallery list definition is mark as hidden so any new templates created using this type of list would also be hidden.

The solution that finally work was to create a new list through the UI but change the URL to supply the out of the box theme gallery list template ID. From research online I was able to identify that the theme gallery template ID was 123 so I went to the root of my site and created a list as normal but I then changed the URL removing the feature ID and changed the ListTemplate querystring parameter to 123. I entered the list name as theme and clicked ok. This created my list as expected but it was still in the wrong location. In order for the theme functionality to work the list had to be under the catalogs folder. To move the list I opened SharePoint Designer and simply dragged the list to where it should be. At this point I could now use the set theme functionality but there were no items so once again I opened my test site collection in SharePoint Designer and copied all the themes across to my upgrade site. When I then refreshed the choose theme page it worked and all the themes were available to choose from.

Conclusion

Being a developer normally I don’t use SharePoint Designer, however in this case I found it extremely useful to be able to move and manipulate objects in the SharePoint site.

Hopefully other people will find this useful, however please ensure if there is anything you are not sure of try it on a development environment first and always ensure you have a back up you can revert to before stating any work.

Full Error Details

Exception information:
    Exception type: NullReferenceException
    Exception message: Object reference not set to an instance of an object.
Thread information:
    Thread ID: 9
    Thread account name: DomainOurAccount
    Is impersonating: False
    Stack trace:    at Microsoft.SharePoint.ApplicationPages.ThemeWebForm.<>c__DisplayClass2.<LoadV4Page>b__0()
   at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.ApplicationPages.ThemeWebForm.LoadV4Page()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


%d bloggers like this: