Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This took me longer than it should have to get working as the things I tried first compiled but did nothing:
myList.Folders.Add("DoesNotWork", SPFileSystemObjectType.Folder);
The way I got it to work in the end was like this:
SPList myList = myWeb.Lists["My List"]; SPListItem newFolder = myList.Items.Add(myList.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, null); if (newFolder != null) { newFolder["Name"] = "Name of Folder"; newFolder.Update(); }
Hope this helps somebody :-)
Comments
- Anonymous
August 30, 2007
PingBack from http://msdnrss.thecoderblogs.com/2007/08/30/progammatically-adding-folders-to-a-sharepoint-list/