SharePoint List items

How do you return SharePoint List items using SharePoint web services?

Create a reference to the SharePoint Lists.asmx web service by appending “/_vti_bin/Lists.asmx” to the end of a site name. One can use this url to add a service reference in Visual studio there onwards. This will query the WSDL for the Lists.asmx service.

Next step is to configure the security to be able to call the service methods. You can do this by altering the bindingConfiguration to indicate the transport uses NTLM authentication, which is the default.

We can then iterate through all the lists.

Example:
ServiceReference1.ListsSoapClient proxy = new ServiceReference1.ListsSoapClient();
proxy.ClientCredentials.Windows.ClientCredential = new NetworkCredential();
XmlNode node = proxy.GetListCollection();
XPathNavigator nav = node.CreateNavigator();
XPathNodeIterator iter = nav.SelectDescendants("List", "http://schemas.microsoft.com/sharepoint/soap/", false);
while (iter.MoveNext())
{
     string title = iter.Current.GetAttribute("Title", string.Empty);
     string id = iter.Current.GetAttribute("ID", string.Empty);
     Messagebox.Show ("title:" + title + “ and id:” + id);
}
writer.Flush();
What is CAML?
What is CAML? - It is an XML based language and provides data constructs used to build up the SharePoint fields and is also used for table definition......
What is impersonation?
What is impersonation? - Impersonation is the concept of providing functionality in the context of a different identity, for example letting a user access the system with anonymous access.......
What are WebPart properties?
What are WebPart properties? - WebPart properties are just like ASP.NET control properties, they are used to specify the characteristics of a webpart.....
Post your comment