Retrieving all properties for a Sharepoint list

Tags: .NET, C#, CodeSnippets, SharePoint

When we call the GetListItems or GetListItemChanges methods in Sharepoint's Lists Web Service, we pass an XmlNode parameter specifying which fields we want to return, in this format:

<ViewFields>
   <FieldRef Name="ows_ID"/>
</ViewFields>

Now, if we leave this field as null, we get a certain set of properties back - Name, Last Modified and so forth. Basic, commonly used properties. However, if we want to return ALL properties, and we don't want to explicitly state them, we need to pass an XmlNode with an empty-but-valid ViewFields XML:

XmlDocument doc = new XmlDocument();
XmlNode viewFields = doc.CreateElement("ViewFields");
XmlNode results = wsLists.GetListItemChanges(myListGuid, viewFields, since, null);

Now I get a whole handful of properties to read to my heart's delight.

All info via Karthikeyan's blog.

4 Comments

Comments have been disabled for this content.