Wednesday, February 6, 2008

Uploading Documents to a SharePoint Document Library containing different Content Types

A document library in SharePoint contains several Content Types. BizTalk will upload documents to the document library in SharePoint.
When uploading via BizTalk the document to SharePoint, I need to say which Content Type the document is linked too.

When uploading the document and adding the Metadata needed for the content type of the document, I saw that SharePoint always uses the default content type.
So metadata not used in the default content type is discharged.
How can I tell the WSS adapter which content type to use?

The solution is very simple; the name of the content type is also metadata.

In the orchestration, add a Message Assign Shape
Add the following code to the Message Assign Shape:

SharePointOutMsg(WSS.ConfigPropertiesXml) = "<ConfigPropertiesXml><PropertyName1>Content Type</PropertyName1><PropertySource1>My Custom ContentType</PropertySource1> [Add more custom metadata] </ConfigPropertiesXml>";

1 comment:

Marc ( said...

Hi Frederik,

thanks for this idea! :-) Unfortunately it did not work for me... I set the Content Type property to an existing value but the DocLib always uses the Default Content Type. For other properties it works fine (they are written to the columns), so mechanism itself works but not for the Content Type. When I inspect the context-properties when BTS is running I can see, that the Content Type is in the context correctly. Do you have an idea?
Thanks a lot in advance!