If you want to know the Guid of your Document Library or List, you can try by this one.
// get current web(site)
SPWeb web = SPContext.Current.Web;
// get current list or library
SPList List = web.Lists[DocumentName];
// get all item in list or library
SPListItemCollection items = List.Items;
// NATT will store Guid.
Guid NATT;
NATT = new Guid();
NATT = List.ID.ToString();
NOTE: the definition of DocumentName is....
private string _documentName = "DocLib_or_List_Name";
[
Personalizable(PersonalizationScope.User),
WebBrowsable(),
WebDisplayName("Documents Library Name"),
WebDescription("Documents Library Name")
]
public string DocumentName
{
set { _documentName = value; }
get { return _documentName; }
}
No comments:
Post a Comment