Posts

Showing posts from April, 2011

Specifying Content Types from the SharePoint 2010 Silverlight Client Object Model

A few weeks ago, I wrote about how you can use the Silverlight client object model to upload files to a SharePoint document library . One of the limitations of this process is that it doesn't allow you to specify a content type or provide any metadata for the document you're uploading. In this post, I look at how you can programmatically provide this missing information. As with most client-side operations for SharePoint 2010, the process is a little more complex from a Silverlight client than from a managed .NET client, as many useful methods and properties are unavailable. From a Silverlight client, you need to use the following high-level steps: Upload the file Retrieve the list item corresponding to the file Update the field values of the list item to set the content type and any other required metadata Let's take a look at how this works in code. Because we're working with a document library, you must upload the file as the first step –SharePoint won't allow