Adding a row into a SharePoint List and adding an attachment to it

I recently got this email from a WSS Adapter user

... I saw your 4 last web casts, it helped me a lot to get a good idea about thee WSS adapter.I have a question, Can you help me please and tell me how to add a row into SharePoint list and add an attachment to it? Where can I get more help about WSS adapter other then interrupt you? ...

Unfortunately, the support for lists is not that rich in this release of the adapter. You can send messages to lists (create list row) but you cannot receive messages from lists or add attachments to a list item.

It's very easy to add a row to a SharePoint list using the WSS adapter. The problem is that the adapter does not support adding an attachment to the row that was inserted.

In order to add a row to a list, you just have to send a message to that list the same way you would send the message to a document library. For instance, you can send a message to the Shared Documents document library or you can send a message to the Lists/Tasks list. All lists URLs begin with Lists/ so make sure you use the correct URL for the list. When sending a message to a list, the message will not be saved in the list (as it is saved in the document library) but the property promotion still happens. This means that you can use the Column 01 ... Column 16, Column 01 Value ... Column 16 Value send port properties in order to extract the values from the XML message and save them in the List columns. You can also hard code the SharePoint column values instead of taking them from the message. The Filename field is not used when sending messages to list, instead you will have to update the Title column.

See topic, 'Supported Windows SharePoint Services Column Types ' in the BizTalk 2006 documentation (beta available for download here ) for info on how to update particular SharePoint column types. You can also take a look at 'Walkthrough: Module 3 - Accessing SharePoint Properties from an Orchestration '. Unfortunately that's a little bit of an overkill because you need to do tutorial 1 and 2 before you can do 3, and also the main goal of the tutorial is to show how to use dynamic send ports. Sending a message to a list is a very small part of that tutorial and it's done using a dynamic send port instead of the easier way which is using a physical send port.

In order to add an attachment to the list item you just created, you will have to write a .Net Component that invokes the Windows SharePoint Services web services and call that component from a BizTalk orchestration. Most likely you will have to use the http://localhost/_vti_bin/Listswsdl.aspx web service. You can take a look at this project (source code is included) to see how I have used the WSS web services. That projects uses the Lists web service so you can probably even reuse some of the code.

More information on WSS adapter is available in the BizTalk 2006 documentation (pointer listed above), just search for SharePoint. You can also ask me questions anytime or just forward your questions to BizTalk discussion aliases ( ).