How to create sub folder in List/OneDrive for Business with CSOM

If you want to create a subfolder in already created folder on OneDrive for Business, this code can help you :

Load the web :

Web web = clientContext.Web;

Retrieve the parent folder :
The parent folder path can be like : “/Documents/MyParentFolder”

var folder = web.GetFolderByServerRelativeUrl(web.ServerRelativeUrl + parentFolderPath);

Add the folder to the parent :

folder = folder.Folders.Add(folderName);
This entry was posted in OneDrive, SharePoint. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s