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 http://blogs.msdn.com/luke/archive/2006/02/03/524534.aspx ) 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 http://blogs.msdn.com/ahamza/archive/2006/03/15/WssAdapterBrowseUI.aspx 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 ( http://blogs.msdn.com/kevin_lam/archive/2005/07/11/437590.aspx ). 


 

Comments (5)

  1. Anonymous says:

    Great artcicle, here

    ……

    Unfortunately, the support for lists is not that rich in this release of…

  2. Anonymous says:

    I have a situation where i need to add more than 16 columns in a sharepoint list.

    I saw your all web casts, they were really helpfull to me in understanding WSS adaptor.

  3. Garry Trinder says:

    Tough luck … I don’t think it’s possible to update more than 16 columns. You can have more than 16 columns in a SharePoint list, however you cannot update more than 16 of them by using the WSS adapter. You can do that from a BizTalk orchestration using C# code and the SharePoint web services (documented here http://msdn2.microsoft.com/en-us/library/ms479390.aspx )

    The XSD schemas are not documented very well so it might be a good idea to take a look at existing code. I used these webservices in this post http://blogs.msdn.com/ahamza/archive/2006/03/15/WssAdapterBrowseUI.aspx

  4. Anonymous says:

    "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."

    You mention this, but whenever I send the message to the list it responds with a bunch of HTML not XML that boiled down reads "The file you are attempting to save or retrieve has been blocked from this Web site by the server administrators."

    XML files are enabled on the server though, so what am I missing?  Any ideas?

  5. Garry Trinder says:

    Can you send a message to a document library?

    I suspect you cannot do that either. It’s probably a problem with the Adapter Web Service (BizTalk feature under Additional Software). Did you install and configure that BizTalk feature on the WSS machine? It’s a very light feature, it does not drag any other BizTalk components with it.