Create new DocSet with UpdateListItems

May 20, 2015 at 11:18 PM
Using SPServices 2014.1 to create a new docset (my custom contenttype) in a library.
        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",

        listName: "RRtest",

updates: "<Batch OnError='Continue' >" + 
"<Method ID='1' Cmd='New'>" + 
    "<Field Name='ContentTypeId'>0x0120D52...9559ABA1</Field>" +
    "<Field Name='FSObjType'>1</Field>" +
    "<Field Name='ProgId'>Sharepoint.DocumentSet</Field>" +
    "<Field Name='BaseName'>" + name + "</Field>" +
    "<Field Name='Title'>" + name + "</Field>" + 
"</Method>" + 
"</Batch>" , ....

The code is working (I've shortened the ContentTypeId, but it is correct in my code.) The new docset is created in my library. The addition of the FSOBJType makes it actually look like a docset and show the docset home page when I view the contents.

But there are two things that don't seem right and lead me to think that it may look like a docset it isn't really.

First is that when I query the ProgId of the docsets it returns a blank. If I go to the library and create a new docset with the UI that value gets filled in, but for ones created with SPServices it doesn't get filled in. Even though I'm including it in the updates property....

The second thing I notice is that when I sort my library -- either in the UI or when retrieving the contents with GetListItems -- the ones created with the UI are sorted together, even though the ID numbers should have them mixed in.

I've googled a lot and that is how I found the ProgId and FSObjType fields. But I'm at a loss for how to proceed. Anybody?
May 21, 2015 at 10:51 AM
I would ask what the business process you are trying to accomplish is, and what version of SharePoint are you on? Are you trying to create actual documents (word, excel) or what? Just curious! I am working on creating a Word document from a template in SP2010 so I am trying to find all avenues of doing this if possible.

May 21, 2015 at 3:13 PM
Sorry I don't understand the first part of your question. We are just trying to create a new DocumentSet. We have created a custom content type that inherits from the built in document set -- it has some custom site columns and managed metadata.

We aren't trying to create actual documents inside the set, just the set itself.

We have an enterprise run SharePoint installation of 2013. We are Site Collection admins, but don't have access to central admin and we are trying to built our site(s) using out of the box functionality and client side (in-browser) development.

One of the things we want to do with our Docset is develop a custom entry form, but the NewDocSet.aspx lives in _layouts/15 and we don't have permissions to put a custom form in there and run the powershell described here

But we can do a custom edit and display form for a docset. So my trick was to create the docset with SPServices (thereby completely avoiding NewDocSet.aspx) and the opening the item for editing in our CustomEdit.aspx.

So far (except for the two things noted above) the docsets seem right. They show the docsethomepage. When I add documents to them the ItemChildCount increases. I haven't done any tests on if the managed metadata gets pushed down to the children yet.

I'm just concerned that there is something behind the scenes that isn't quite right and I don't know how to track it down.....
May 21, 2015 at 4:28 PM
I found this way of creating a DocSet using REST

It works and the DocSets created with REST services do have the correct ProgId and sort properly.