Home

This document is a cache from http://www.spidertg.com/cmsv5/images/stories/eBook_Libarary/Developer/Putting%20SharePoint%20to%20Work%20for%20You.pdf


Putting Share Point toWorkfor You

Document source : www.spidertg.com


/// Determines if a given list exists by name by looping through all lists.
/// </summary>
/// <param name="listService">A Lists web service proxy.</param>
/// <param name="strListTitle">The name of a list.</param>
/// <returns>True if the list exists otherwise false.</returns>
public static bool ListExists(Lists listService, string strListTitle) {
XmlNode xmlNode = listService.GetListCollection();
foreach (XmlNode nodeChild in xmlNode.ChildNodes) {
if (nodeChild.Attributes["Title"].Value.Equals(strListTitle))
return true;
}
return false;
}
/// <summary>
/// Gets all list items in a given list. This method is useful because
/// the default implementation of GetListItems() won't return more items
/// than is specified in the default view.
/// </summary>
/// <param name="listService">A Lists web service proxy.</param>
/// <param name="strListName">The name of the list to retrieve items
from.</param>
/// <returns></returns>
public static XmlNode GetAllListItems(Lists listService, string strListName) {
return listService.GetListItems(
strListName, null, null, null, "1000000", null, null);
}
/// <summary>
/// Inserts a single field/value into a CAML insert or update statement.
/// Usage Example (an insert statement):
///
/// XmlDocument xmlDoc = new XmlDocument();
/// XmlElement elementBatch = ListHelper.CreateBatch(xmlDoc);
/// elementMethod = ListHelper.CreateMethod(xmlDoc, elementBatch, "New", "1");
/// ListHelper.AppendField(xmlDoc, elementMethod, "Title", "Hello World");
/// listService.UpdateListItems("[ListName]", elementBatch);
/// </summary>
/// <param name="xmlDoc">The XML document that holds the CAML statement.</param>
/// <param name="elementMethod">
/// The CAML statement's method (i.e. an insert or update statement).
/// </param>
/// <param name="strField">
/// The name of a field/column to insert strValue into.</param>
/// <param name="strValue">The value to insert into strField</param>
public static void AppendField(
XmlDocument xmlDoc,
XmlElement elementMethod,
string strField,
string strValue) {
XmlElement elementField = xmlDoc.CreateElement("Field");
elementField.SetAttribute("Name", strField);
30
Putting SharePoint to Work for You, an Internet.com Developer eBook. Copyright 2008, Jupitermedia Corp.
Putting SharePoint to Work for You
[
]







Summary :

/// Determines if a given list exists by name by looping through all lists. This method is useful because /// the default implementation of GetListItems() won't return more items /// than is specified in the default view. /// Usage Example (an insert statement): /// /// XmlDocument xmlDoc = new XmlDocument();


Tags : ltparam,ltsummarygt,list,insert,null,xmlnode,string,name,return,items,elementmethod,static,xmlelement





Terms    |    Link pdf-search-files.com    |    Site Map
   |    Content Removal Notice   
   |    Contact   

All books are the property of their respective owners.
Please respect the publisher and the author for their creations if their books copyrighted