Wednesday, 6 November 2013

Programmatically create a folder in a document library in SharePoint 2010

Share it Please
        SPSite oSpSite = new SPSite(SPContext.Current.Site.ID);
        SPWeb oSPWeb = oSpSite.OpenWeb();
        SPList list = oSPWeb.Lists.TryGetList("Shared Documents");//Document Library Name
        SPFolderCollection folderColl = list.RootFolder.SubFolders;
        SPFolder newFolder = folderColl.Add("Months");                 //FolderName

No comments:

Post a Comment

Followers

Follow The Author