.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

UpdateListItems & "The formatter threw an exception while trying to deserialize the message"

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :SharePoint

I'm trying to update a column in a SharePoint List with the following code. The column is updated, but an error is thrown trying to deserialize the SOAP response message. I've not been able to trap the raw SOAP response message to see what's being passed back...so I don't know what else to do to debug this issue.

        static public void updateMigrationFlag(string targetList, string projectID)


            string sQuery = @"<Batch OnError='Continue' ListVersion='1' ViewName='>"

                            + @"<Method ID='1' Cmd='Update'>"

                            + @"<Field Name='ID'>" + projectID + "</Field>"

                            + @"<Field Name='hMigrationStatus'>True</Field>"

                            + @"</Method>"


View Complete Post

More Related Resource Links

UpdateListItems Webservice is not working on Photo directory in blogsite



   I have created a site using the standard blogsite template. By default it contains a picture library named "Photos". I want to create a new folder in this library using the UpdateListItems Webservice. But I am getting an exception saying "The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file." But there is not file/folder with the name I am specifying. I am using the following query to create the folder



  <Batch PreCalc="TRUE" OnError="Continue" RootFolder="/forexp/Photos">

  <Method ID="1" Cmd="New">

  <Field Name="ID">New</Field> 

  <Field Name="FSObjType">1</Field> 

  <Field Name="FileRef">/blogsite/Photos/TestFolder</Field> 




Please note that I can create the folder using the web interface. I also created a new picture library in the same site and used the same above query to create the folder and I am able to create the folder.


The formatter threw an exception while trying to deserialize the message

Hi I got this error when programming in C# 2008 The formatter threw an exception when trying to deserialize the message: Error while trying to deserialize parameter http://tempuri.org/:GetListSitesResponse. The InnerException message was' Error on line 1, position 314. The item 'http://tempuri.org/:anyType' contains data data contract 'http://tempuri.org/:Site'. The deserializer has no knowledge of any type that is assigned to this contract. Add the type corresponding to 'Site' to the list of known types (eg, using the attribute KnownTypeAttribute or adding it to the list of known types passed to DataContractSerializer). '. See InnerException for more information. This happen in my button_click event (this is a project on C# 2008 express windows form application) private void button1_Click(object sender, EventArgs e)         {             SiteDevelopmentReference.Service1SoapClient sd = new SiteDevelopmentReference.Service1SoapClient();             listBox1.Items.AddRange(sd.GetListSites().ToArray());                            } I have a service reference from another project

How to sync between UpdateListItems() and GetListItems() web services

I am using Javascript to call the UpdateListItems() webservice through SOAP to add an entry to a list then I am using the GetListItems() webservice to query the number of items in that list. I am successful in adding an new entry in the list, but when I query the GetListItems(), it does not return the number of entries (items) in the list unless it was entered via the SharePoint GUI, not the UpdateListItems() routine I have written. I will add the source code for your reference and help.: var response; function SOAPUtilForHitCount(data,action,listName,listPath) { this.data = data; this.listName = listName; this.listPath = listPath; this.SOAPHeader =  function() { var stack = []; stack.push("<?xml version='1.0' encoding='utf-8'?>"); stack.push("<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"); return (stack.join("")); } this.SOAPBody =  function() { var stack = []; if(action=="count") { stack.push("<soap:Body>"); stack.push("<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>"); stack.push("<listName>" + this.listName + "</listName><query><Query xmlns=''><Where><Eq><Fie

UpdateListItems Error

I am trying, without success, to update a sharepoint list via infopath by using the UpdateListItems method of the Lists web service. It is an extremely simple list I created as a test, with only the default columns (mandatory column 'Title', two other non-mandatory columns). Here is the CAML I am using: <Batch OnError="Continue">     <Method ID="1" Cmd="New">         <Field Name='Title'></Field>             </Method> </Batch> I am getting the following error: System.Net.WebException was unhandled by user code   Message="InfoPath cannot submit the form.\nAn error occurred while the form was being submitted.\n\nThe SOAP response indicates that an error occurred on the server:\n\nException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.\r<detail><errorstring xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">Element &lt;Batch&gt; of parameter updates is missing or invalid.</errorstring></detail>\n"   Source="Microsoft.Office.InfoPath.Client.Internal.Host"   StackTrace:        at Microsoft.Office.InfoPath.Internal.MomExceptionHelper.ExecuteDataConnectionActio

Cannot delete rows in a list via Lists web service's UpdateListItems-function, even though I am abl

Hi all, I'm trying to delete some rows in a SharePoint 2010 Foundation list via Lists.asmx -web service's UpdateListItems. The web service is called from BizTalk. I am able to create rows, but for some reason delete fails. I also use "GetListItems"-function without problems. The exception I get is Microsoft.SharePoint.SoapServer.SoapServerException. The message is "Cannot access a closed Stream." The updates-element of the UpdateListItems-function is as follows (well, a part of it, the real one has more Method-elements, but you get the gist..): <Batch OnError="Continue" ListVersion="1"> <Method ID="1" Cmd="Delete"> <Field name="ID">1900</Field> <Field name="IMEI">GFA-687</Field> </Method> <Method ID="2" Cmd="Delete"> <Field name="ID">1901</Field> <Field name="IMEI">OVG-567</Field> </Method> <Method ID="3" Cmd="Delete"> <Field name="ID">1902</Field> <Field name="IMEI">OXI-570</Field> </Method> </Batch> I've also tried that Batch without the IMEI-information, as well as with a valid ViewName. Why cannot I delete when I can clearly modify/create rows - what's up with th

Help!!! WCF:: The formatter threw an exception while trying to deserialize the message

I have[ServiceContract]    public interface IBusiness    {        [OperationContract]        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]        bool UpdateLanguage(int languageId, string name, string code);    }public class Business:IBusiness    {        public bool UpdateLanguage(int languageId, string name, string code)        {           //update to database        }    }Add client:$.ajax({ type: "POST", url: "/Services/Business.svc/UpdateLanguage", data: "{'languageId':'" + languageId + "', " + "'name':'" + name + "'," + "'code':'" + code + "'}", contentType: "application/json; charset=utf-8", dataType: "json", processdata: true, success: function (response) { //rebind data here!

UpdateListItems to populate multivalue in the lookup field of the list



I want to populate a column which is of type lookup.I used the web service provided by the sharepoint. This column should contain multiple values. For this I used the format ID;#lookupvalue.But the column is not getting populated.

The elbatch.InnerXML looks like IS

"<Method ID=\"2\" Cmd=\"New\"><Field Name=\"RFPRequirement\" Type=\"Lookup\">623</Field><Field Name=\"Product\" Type=\"Lookup\">232</Field><Field Name=\"Offering\" Type=\"Lookup\">49</Field><Field Name=\"Services\" Type=\"Lookup\">212;#B: Event Management Service;#215;#(B) Incident Management Service;#217;#(B) Proactive Problem Management Service</Field></Method>"

Also I tried separating only the IDs by ;#.The elbatch.innerxml is

"<Method ID=\"2\" Cmd=\&q

UpdateListItems to RichText via JavaScript


I am trying to use UpdateListItems to update a RichText via JavaScript.  So far everything but the BusCase field which is RichText will submit.  Here is what I got thus far, Do I need something special?  Could I do this better?

function CreateListItem(Title,MSLID,Method,BusCase)

if (Title == null)
	Title ='invalid'
if (MSLID == null)
	MSLID ='invalid'
if (Method == null)
	Method ='invalid'

	var url = "/MSL/_vti_bin/lists.asmx";
	var list = "{A5248571-FDC5-4BF1-8161-C0CF1E9CD3B7}";

	var batch = "<Batch onError='Continue' PreCalc='TRUE' ListVersion='0'>"
	 + " <Method ID='1' Cmd='New'>"

Attempt to update Modified field with UpdateListItems() return 0x81020030


I have written a custom migration tool using SharePoint web services to move SP content from 2003 to 2007. I'm using solution suggested by Steve Curran 



to set the tp_Modified field to Read_Only="False", update the Modified field with UpdateListItems(), then set back to Read_Only. This solution is working perfectly for SharePoint Versions and However moving to a new SharePoint instance, 12.0.06545, the call to UpdateListItems returns 0x81020030. ("Invalid file name"). This fails only for document libraries.





Delete file in a subfolder using Updatelistitems web method



I need to delete zip file under my folder and sub folders which are under the list name named "Documents", so i used



GetListItems web method and got the list zip files. When i try to delete the same i am not able to delete the ones that are in the folders (i.e) if the zip file is under [http://server/mysite/Documents/Folder/aaa.zip].

I am adding the line of code which am using for deleting the file from the list.

 XmlDocument xmlDoc = new System.Xml.XmlDocument (); 

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend