Tuesday, February 25, 2014

How to get Guid of all form libraries

Try something like this:



SPSite site = SPContext.Current.Site;
SPWeb spWeb = site.OpenWeb();

foreach (SPList list in spWeb.lists)
{
if ((!list.Hidden) && (list.BaseType == SPBaseType.DocumentLibrary) && ((int) list.BaseTemplate == 115))
SPList spList = spWeb.Lists[list.Title];
SPDocumentLibrary doclib = (SPDocumentLibrary)spList;
string solutionUrl = SPHttpUtility.UrlPathEncode(spWeb.Url + "/" + doclib.DocumentTemplateUrl, true);
foreach (SPListItem spItem in doclib.Items) //loop through the list items

{//rest of the code}

}//end of SPList foreach loop

Refer this for more info:


http://ift.tt/1c6XKjQ




Hemendra:Yesterday is just a memory,Tomorrow we may never see

Please remember to mark the replies as answers if they help and unmark them if they provide no help


No comments:

Post a Comment