Aidan Garnish
MOSS 2007 and other Microsoft technologies

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();
                        }

                    }

               }


Currently rated 3.7 by 3 people

  • Currently 3.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Related posts

Comments

April 16. 2008 22:53

Pingback from aidangarnish.net

Using SharePoint web services to get list items

aidangarnish.net

Add comment


 

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

November 22. 2008 06:47