Bennet Möller
Bennet Möller

Reputation: 17

Create Document Sets based on excel data Sharepoint 2013

I have an Excel Sheet containing Names and Numbers in two different columns and I need to create Document Sets named with Number and Name like "4521 Example Name". How do I do this?

We use Sharepoint 2013 and I have a document library where I add these Docsets. I tried to use pnp to do it, but failed.

Upvotes: 0

Views: 301

Answers (1)

Lee
Lee

Reputation: 5493

Read excel file by EPPlus.

Enable Document set for the library and create by CSOM api.

enter image description here

using (var clientContext = new ClientContext("http://sp"))
            {                
                List list = clientContext.Web.Lists.GetByTitle("MyDoc");                
                Folder parentFolder = list.RootFolder;                
                ContentType ct = clientContext.Web.ContentTypes.GetById("0x0120D520");
                clientContext.Load(ct);
                clientContext.ExecuteQuery();                
                DocumentSet.Create(clientContext, parentFolder, "MyDocumentSet", ct.Id);
                clientContext.ExecuteQuery();

            }

Upvotes: 0

Related Questions