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


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Get List ID from List URL using SharePoint WebServices

Posted By:Sunil Yadav       Posted Date: May 24, 2010    Points: 10    Category: SharePoint    URL: http://www.dotnetspark.com  

This article explains how to get List ID from Sharepoint WebService.
 


There are many situations in which you need to get ListID using Sharepoint web service. Following is the way to achieve it.
Firstly you need to add Web Reference in your project from http://mossserver/_vti_bin/Lists.asmx.


localhost.Lists ls = new WebApplication3.localhost.Lists(); 
ls.Credentials = new System.Net.NetworkCredential("sunil", "password"); 
ls.Url = "http://mossserver/_vti_bin/Lists.asmx"; 
var lsturl = ls.GetList("Tasks"); XmlNode node = ls.GetListAndView("Tasks", ""); 
string sListID = node.ChildNodes[0].Attributes["Name"].Value; 
string sViewID = node.ChildNodes[1].Attributes["Name"].Value; 


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

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