I need to get a item by a giver url. (SP2010)
I am using the Lists.asmx web services. (I can not run code on sharepoint machine).
I tried this:
SPWSList.Lists queryListService = new SPWSList.Lists();
queryListService.Credentials = System.Net.CredentialCache.DefaultCredentials;
queryListService.Url = "http://myServer/_vti_bin/Lists.asmx";
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
query.InnerXml = "<Where><Contains><FieldRef Name=\"FileRef\"/><Value Type=\"Url\">"
+ "sites/mysite/file.docx</Value></Contains></Where>";
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
viewFields.InnerXml = "<FieldRef Name=\"ID\" />";
System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
queryOptions.InnerText = "";
System.Xml.XmlNode nodeListItems = queryListService.GetListItems(string.Empty, string.Empty, query, viewFields, "10", queryOptions,null);
And I am getting the error:
System.Web.Services.Protocols.SoapException
I just have the url of the item (not the list id, view id and web id)
0 commentaires:
Enregistrer un commentaire