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


/// <returns>A Batch XAML element.</returns>
public static XmlElement CreateBatch(XmlDocument xmlDoc) {
XmlElement elementBatch = xmlDoc.CreateElement("Batch");
elementBatch.SetAttribute("OnError", "Continue");
return elementBatch;
}
/// <summary>
/// Adds a CAML Delete command to a batch for each list item in a given list.
/// </summary>
/// <param name="listService">
/// Required to retrieve all list items in order to create
/// each delete command.</param>
/// <param name="strItemList">The list to delete all list items from.</param>
/// <param name="xmlDoc">The XML document to store the delete commands
in.</param>
/// <param name="elementBatch">
/// An XML element into which which this method will add delete 'Method' ele-
ments.
/// </param>
public static void AddDeleteAllItemsBatch(
Lists listService,
string strItemList,
XmlDocument xmlDoc,
XmlElement elementBatch
) {
// get all items
XmlNode nodeListItems = GetAllListItems(listService, strItemList);
// for each item
XmlNode nodeRsData = nodeListItems.ChildNodes[1];
foreach (XmlNode nodeRow in nodeRsData.ChildNodes) {
if (nodeRow.NodeType == XmlNodeType.Element) {
string strId = nodeRow.Attributes["ows_ID"].Value;
// create a "delete" method
XmlElement elementMethod = CreateMethod(
xmlDoc, elementBatch, "Delete", strId);
// tell the delete method to delete the current report term evaluation
AppendField(xmlDoc, elementMethod, "ID", strId);
}
}
}
/// <summary>
/// Breaks a larg CAML query into smaller batches to avoid the error "Some part
/// of your SQL statement is nested too deeply. Rewrite the query or break it
/// up into smaller queries."
/// </summary>
/// <param name="listService">The SharePoint list service to
32
Putting SharePoint to Work for You, an Internet.com Developer eBook. Copyright 2008, Jupitermedia Corp.
Putting SharePoint to Work for You
[
]







Summary :

/// <returns>A Batch XAML element.</returns> /// Required to retrieve all list items in order to create /// each delete command.</param> /// Breaks a larg CAML query into smaller batches to avoid the error "Some part /// of your SQL statement is nested too deeply.


Tags : delete,list,ltparam,elementbatch,ltsummarygt,xmlelement,method,all,items,xmlnode,xmldoc,sharepoint,each





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