Testing

webTiger Logo Wide

SharePoint Development – Hints and Tips

SharePoint Logo

A collection of hints and tips to make life working on development projects with SharePoint integrations a little easier.

SharePoint Designer and Other Administrative Tweaks

  • Enable document IDs – enabling this feature on your site collection assigns a unique ID to each document you upload. You can provide links to the document via the unique document ID and if somebody moves the file, the link will still work because the document ID will have been retained! You can enable the Document ID Service via your Site Collection Administration console. (The easiest way to access this is to view the Site Settings for a SharePoint site within your site collection, then choose the ‘Go to top level site settings’ option under the Site Collection Administration heading, then choose the ‘Site collection features’ option (once again under the Site Collection Administration heading), and the list of services should then be displayed.)
  • Displaying User-Friendly Data on Forms – on custom list item forms, especially the display form, some complex fields (such as Person fields) may display a horrible HTML fragment instead of a user-friendly output. This can easily be fixed by editing a custom form and adding a disable-output-escaping=”yes” attribute to the XSL tag (e.g. <xsl:value-of select=”@AssignedTo” disable-output-escaping=”yes” />).

Custom Code-Based Solutions

  • Build Targets – SharePoint connected applications must target the x64 platform (so build to Any CPU or x64.)
  • Elevated Permissions – If you are connecting to SharePoint using the API then you need to use the admin account (sp_admin) or a user who is a member of WSS_ADMIN_WPG to achieve the required permissions.
  • Do Not Impersonate – SharePoint interaction doesn’t handle .NET impersonation (via WindowsIdentity and WindowsImpersonationContext) well, since any impersonation is likely to be reverted within the SharePoint API calls.
  • Stripping Data From Fields – if you’ve got a set of key-value pairs in a string value held in a metadata field (column) and you need to strip data from it then adding calculated fields is a good way of doing this. You can use our familiar (VB/C++) string manipulation terms of LEFT, MID, RIGHT, etc. along with FIND (and possibly ISERROR if you want to get fancy!)
  • SharePoint Custom Activity Library, Missing Assembly Error – this might indeed be a missing assembly, or it might be a corrupted .actions file. I discovered I got this error when I had an incorrectly formatted <Action> region in my .actions file and I’d omitted the attributes relating to the assembly name, class name, etc.