In this article we will be seeing how to create folder in SharePoint list using SharePoint Object Model. Steps Involved:
namespace ConsoleApplication2 { class Program { static void Main(string[] args) { using (SPSite site = new SPSite("http://serverName:25374/sites/Team/")) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("Custom"); SPListItem folderColl = list.Items.Add(list.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder); folderColl["Title"] = "New Folder"; folderColl.Update(); list.Update(); } } } } } 8. Build the solution. 9. Hit F5. 10. Go to the SharePoint list and you could be able to see the new folder that we have created.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: