locked
get list item url from list.asmx web service RRS feed

  • Question

  • how to get list item url from list.asmx web service?

     

     

    thanks.

    Thursday, March 10, 2011 1:47 PM

Answers

  • Hi,

    Please try this console application:

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml;
    using System.Net;
    
    namespace GetListItemUrl
    {
      class Program
      {
        static void Main(string[] args)
        {
          GetListItemUrl.ListWebReference.Lists listService = new GetListItemUrl.ListWebReference.Lists();
          listService.Credentials = new NetworkCredential("Administrator", "12345");
          string listName = "My Custom List";
          XmlNode ndListItems = listService.GetListItems(listName, null, null, null, null, null, null);
          XmlNode ndList = listService.GetList(listName);
          string url = string.Empty;      
    
          if (ndListItems != null)
          {
            foreach (XmlNode node in ndListItems.ChildNodes)
            {
              if (node.Name == "rs:data")
              {
                for (int i = 0; i < node.ChildNodes.Count; i++)
                {              
                  if (node.ChildNodes[i].Name == "z:row")
                  {                
                    url = ndList.Attributes["RootFolder"].Value + "/DispForm.aspx?ID=" + node.ChildNodes[i].Attributes["ows_ID"].Value;
    
                    Console.WriteLine(url);
                  }
                }
              }
            }        
          }
        }
      }
    }
    

     

    ListWebReference is a name of Web Reference to my http://myhost/site/_vti_bin/Lists.asmx

     

    Dmitry

     


    Lightning Tools Check out our SharePoint tools and web parts

     


    • Marked as answer by ayya Friday, March 11, 2011 4:40 AM
    Thursday, March 10, 2011 8:36 PM