I am trying to create Document Set in Document Library. I found this code which is for SharePoint 2013

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;

namespace CSOMSamples
    class Program
        static void Main(string[] args)
            //// String Variable to store the siteURL
            string siteURL = "Site URL";

            //// String Variable to store the document set name
            string dsName = "DS Name";

            //// Get the context for the SharePoint Site to access the data
            ClientContext clientContext = new ClientContext(siteURL);

            //// Get the document library in which the document set has to be created
            List list = clientContext.Web.Lists.GetByTitle("Documents");

            //// Get the parent folder where the document set has to be created
            Folder parentFolder = list.RootFolder;

            //// Get the "Document Set" content type by id (Document Set content type Id : 0x0120D520) for the document library
            ContentType ct = clientContext.Web.ContentTypes.GetById("0x0120D520");

            //// Create a new document set
            //// A new document set will be created in "Documents" library as "Vijai Documents" under which you can add the documents
            DocumentSet.Create(clientContext, parentFolder, dsName, ct.Id);

While running this code I got following error

Cannot find proxy for type with id "{e32a87f7-b866-407d-971d-027ed940d50f}"

So my question is Does any one else gone through the same requirement for creating Document Set in Document Library using CSOM in SP 2010 then please provide some of useful guideline.

I already gone through this and this and this but found no useful.

  • 1
    I have not done that before, but are you100% sure you are using the right .dll for DocumentSet. Seen that kinda error before, and then I have used 2013 version against 2010 server. Aug 1, 2016 at 13:14

1 Answer 1


Finally with the help of code given in this post I was able to achieve the task. The code which I used is:

NetworkCredential creds = new NetworkCredential(userName, password, siteURL);
ClientContext clientContext = new ClientContext(siteURL);
clientContext.Credentials = creds;
List list = clientContext.Web.Lists.GetByTitle("TestLibrary1");
ContentTypeCollection listContentTypes = list.ContentTypes;
clientContext.Load(listContentTypes, types => types.Include(type => type.Id, type => type.Name, type => type.Parent));
var result = clientContext.LoadQuery(listContentTypes.Where(c => c.Name == "Document Set"));
ContentType targetDocumentSetContentType = result.FirstOrDefault();
ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
newItemInfo.LeafName = "Document Set1";
//newItemInfo.FolderUrl = list.RootFolder.ServerRelativeUrl.ToString();
ListItem newListItem = list.AddItem(newItemInfo);
newListItem["ContentTypeId"] = targetDocumentSetContentType.Id.ToString();

This code worked successfully. This is not the only solution. If any one have any other approach then they are welcome to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.