Return A Document Library GUID In C#
Answering another development question that was posted in the newsgroups, someone wanted to know assuming that they were aware of the path of an SPFolder object (a subfolder that existed in a SharePoint document library), how to return the GUID of the SharePoint document library that was housing the relevant SPFolder object. This is accomplished through the use of the SPFolder.ContainingDocumentLibrary property out of the Microsoft.SharePoint namespace, which has a return type of GUID, so should work correctly. Here is a quick atomic method that you can adapt to you needs (it's pretty simple right now
) to achieve this:
-
private readonly SPWeb m_oWeb;
-
-
public Guid GetSPFolderDocLibGuid(string strPath)
-
{
-
return m_oWeb.GetFolder(strPath).ContainingDocumentLibrary;
-
}
1 Comment »
RSS feed for comments on this post. TrackBack URL





















Articles & Research
SharePoint Architecture
Personal/Off-Topic
Latest Free SharePoint Software
SecureCenter For SharePoint
SharePoint Security Assurance Program™
Free Online SharePoint Security Tools
Online SharePoint Security Health Assessment
Article Or Research Filed Under 
[...] Answering another development question that was posted in the newsgroups, someone wanted to know assuming that they were aware of the path of an SPFolder object (a subfolder that existed in a SharePoint document library), how to return the GUID of the Read More……(read more) [...]
Pingback by Blogger Loser » Blog Archive » Return A Document Library GUID — September 19, 2007 @ 6:42 am