About Me

My photo
a Dynamic and Energetic guy.....

Tuesday, September 23, 2008

Create a folder inside your SHAREPOINT list or document library

public static void CreateFolder(SPWeb rootWeb, SPList eLibrary, string strFolderName)
{
try
{
using (rootWeb)
{
rootWeb.AllowUnsafeUpdates = true;
SPFolderCollection folders = rootWeb.GetFolder(eLibrary.RootFolder.ServerRelativeUrl).SubFolders;
SPFolder newFolder = folders.Add(strFolderName);
newFolder.Update();
eLibrary.Update();
}
}
catch(Exception ex)
{
Logger.LogWarning("Error configuring ELibrary Folder: " + ex.Message);
}
}

No comments:

My Masters