How to return SharePoint List items using SharePoint web services?
Submitted by: AdministratorCreate 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.
e.g:
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();
Submitted by: Administrator
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.
e.g:
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();
Submitted by: Administrator
Read Online MOSS Job Interview Questions And Answers
Top MOSS Questions
☺ | What is the role of SPWebApplication object? |
☺ | How DPM for MOSS Work? |
☺ | Explain Two types of workflow supported, i.e. Sequential, State Machine? |
☺ | Explain page layouts of MOSS? |
☺ | What is the role of SPWeb.EnsureUser method? |
Top Dot Net Technologies Categories
☺ | MSF Interview Questions. |
☺ | .Net Architecture Interview Questions. |
☺ | ASP.Net MVC Interview Questions. |
☺ | Entity Framework Interview Questions. |
☺ | C# (Sharp) Programming Language Interview Questions. |