HOME ABOUT
I AM HERE
Bookmark and Share

Retrieving items from a MOSS 2007 list using web services

April 15, 2008 13:32 by aidan

A quick code snippet to remind me how to access a list using the in built web services: 

                MOSSWebRef.Lists lists = new MOSSWebRef.Lists();
               
                lists.Credentials = new System.Net.NetworkCredential("username", "password");

                string exportList = "NameOfList";

                XmlNode node = lists.GetListItems(
                    exportList,                   
                    string.Empty,
                    null,
                    null,
                    ConfigurationManager.AppSettings["MaxRecords"].ToString(),
                    null);

                XmlTextReader xr = new XmlTextReader(node.OuterXml, XmlNodeType.Element, null);          
                string strValue = "";
                while (xr.Read())
                {
                    if (xr.ReadToFollowing("z:row"))
                    {
                         if (xr["ows_nodeName"] != null)
                        {
                           strValue = xr["ows_nodeName"].ToString();
                        }

                    }

               }


Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Comments

April 16. 2008 22:53

Pingback from aidangarnish.net

Using SharePoint web services to get list items

aidangarnish.net

March 25. 2009 21:10

Thanks!! I've been looking for this all day!

Suzanne Beauchamp

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading