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


Listing 3. Create the SharePoint List
static void Main(string[] args) {
Lists listService = _ListHelper.GetListsService();
//////////////////////////////////////////////////////////
// Create The Suppliers List
//////////////////////////////////////////////////////////
string strSuppliersFieldsInnerXml =
"<Method ID='1' AddToView=''>" +
"<Field Type='Number' DisplayName='SupplierID' Required='TRUE' /></Method>" +
"<Method ID='2' AddToView=''><Field Type='Text'" +
"DisplayName='CompanyName' Required='TRUE' MaxLength='255' /></Method>";
string strSuppliersGuid;
XmlNode nodeInsertSuppliersResult;
// create list will delete the list if it exists,
//
and recreate it with the fields specified.
//
All list items will be deleted.
ListHelper.CreateList(
listService, "Suppliers", "Companies that supply products to Northwind",
strSuppliersFieldsInnerXml, out strSuppliersGuid,
out nodeInsertSuppliersResult);
Console.WriteLine(nodeInsertSuppliersResult.OuterXml);
//////////////////////////////////////////////////////////
// Create The Products List
//////////////////////////////////////////////////////////
string strProductsFieldsInnerXml =
"<Method ID='1' AddToView=''><Field Type='Number' DisplayName='ProductID'" +
"Required='TRUE' /></Method>" +
"<Method ID='2' AddToView=''><Field Type='Text'" +
"DisplayName='ProductName' Required='TRUE' MaxLength='255' /></Method>" +
"<Method ID='3' AddToView=''><Field Type='Lookup' List='" + strSuppliersGuid
+
"' DisplayName='Supplier' Required='TRUE' /></Method>" + "";
string strProductsGuid;
XmlNode nodeInsertProductsResult;
// create list will delete the list if it exists,
//
and recreate it with the fields specified.
//
All list items will be deleted.
ListHelper.CreateList(listService, "Products",
"Goods received from suppliers and sold to customers.",
strProductsFieldsInnerXml, out strProductsGuid,
out nodeInsertProductsResult);
39
Putting SharePoint to Work for You, an Internet.com Developer eBook. Copyright 2008, Jupitermedia Corp.
Putting SharePoint to Work for You
[
]







Summary :

// create list will delete the list if it exists, // and recreate it with the fields specified. // create list will delete the list if it exists, // and recreate it with the fields specified.


Tags : list,quotltmethod,create,gtltmethodgtquot,addtoiewgtltfield,out,requiredtrue,string,strsuppliersguid,sharepoint,suppliers,xmlnode,typenumber





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