Create a nested folder structure inside SharePoint with CSOM

Today I searched for a quick code sample to create a nested folder structure inside a SharePoint library with CSOM.
Unfortunately I could not find one so created one myself. I’m sure the code can be optimised but it does the trick …

2 thoughts on “Create a nested folder structure inside SharePoint with CSOM

  1. Thanks for the code . it helped me a lot. It was very helpfull and running code without any issues.

  2. Valuable code. Especially line
    itemCreationInfo.FolderUrl = currentFolder.ServerRelativeUrl;
    helped me a lot. Many reputable sites suggest using absolute URL here, which is wrong and leads to errors. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.