Forum Discussion
SharePoint Online loop and create subfolders
Dear all,
I am using a SharePoint Online document library to store documents stored per client.
I have a document set for each client. In total I have more than 500 document sets, all containing the same folder structure.
The document library is built up as follows:
- Client A
- Invoices
- Correspondence
- Technical
- etc.
- Client B
- Client C
- Client D
- etc.
I would like to create another folder at the second level (where Invoices, Correspondence, etc. reside), named "Projects", and inside that new folder just a few subfolders.
I would like to do this automated, otherwise it would take me a lot of time.
I have seen a few articles on the web, but I haven't found the exact same scenario yet. I know somehow this could be done using PowerShell and a loop? PnP? But I don't have enough knowledge and experience to adjust the solutions from the articles I found so it would fit my scenario.
What would be the best approach to accomplish this?
I hope that someone could help me out with this.
Thanks in advance for helping out!
Kind regards,
Joost
- JoostvdLindenBrass Contributor
In the meanwhile I have found a usable PnP script for this. I will include it below for future reference and try it out. I have attached the example script.
- aniketpatelCopper ContributorThanks Joost Van der Linden.
This saves me a lot of time to create one.