Friday, August 31, 2012

How to: Set a date with correct time in a SharePoint list item

When adding a SharePoint list item the one field type that has given me most problems is the SPDateTimeField:

First there is the question of entering the date in a format that SharePoint accepts. Then there is the problem of getting the time zone right.

Fortunately, neither of the two problems are actually hard to solve – Microsoft has tried to make life easy for us by supplying the tools we need to solve them quietly and efficiently.

Monday, August 13, 2012

How to get HTML5 content in SharePoint 2010

Suppose you want to use HTML5 elements on your SharePoint 2010 site? You create a web part that renders the content as HTML5, for example using <canvas> or <svg> to render dynamic graphical content. The graphics show up fine in FireFox, Chrome etc, but in Internet Explorer it doesn't appear at all, or it is rendered incorrectly. You double-check to ensure that you are using Internet Explorer 9 or later, which is HTML5 compatible. Still the problem persists. How do we solve this?

Sunday, April 22, 2012

SharePoint Client: How to get item attachments

SharePoint item attachments are an easy way to handle files associated with list items. In this post I will demonstrate how to get to the attachments through client-side code.

The SharePoint Client Object Model (SPCOM) allows us to work with ShaePoint from the client side. SPCOM is basically a web service wrapper, exposing much of the existing web services functionality through nice classes. A few features are unfortunately either missing or just inconvenient through the SPCOM, in which case we need to revert to the old web services way. List item attachments is such a case.

Saturday, March 17, 2012

SharePoint Sandbox: How to specify the solution ID

When creating solutions for the SharePoint sandbox, whether it is for SharePoint 2010 or Office365, the solution ID must be given whenever some kind of code-behind is used. This is because SharePoint needs to know which assembly to use. Without the solution ID SharePoint would just look in the GAC for the assembly, which would produce a 'File could not be found' exception.

I will show how to supply the solution ID for a number of SharePoint components, and also describe a work-around in a case where we cannot specify a solution ID.