Document set created with SP Services isn't quite right

Nov 13, 2015 at 3:38 PM
I'm using SPervices to create new document sets and it is mostly working. They look like document sets in the UI, they contain documents and links, they waterfall properties, etc.

But for some reason they don't sort -- neither by ID nor by Name/Title -- into the same order with docsets in the same library that were created using the New > docset ui. They do seem to sort together so all the SP services created ones are in id order and then all the UI created ones.

Other properties like created date or custom columns work like you would expect with UI and SPServices in their appropriate place.

Here is the code I'm using.
var updateCAML ="<Batch OnError='Continue'>"+
                "<Method ID='1' Cmd='New'>" +
                    "<Field Name='FSObjType'>1</Field>" +
                    "<Field Name='BaseName'>" + theItem['Title'] + "</Field>"+
                    "<Field Name='ContentTypeId'>" + CTID+ "</Field>"

for(var key in KPLS.crm.mappedColumns){
    if(typeof theItem[key] != 'undefined'){
        updateCAML += "<Field Name='"+KPLS.crm.mappedColumns[key]+"'>"+
                        "<![CDATA["+ theItem[key] + "]]>"+
                      "</Field>"
    }
}                   
updateCAML += "</Method></Batch>"                   

var promise = $().SPServices({ 
    webURL:KPLS.crm.destSiteUrl,
    listName:KPLS.crm.destListName,
    operation: "UpdateListItems", 
    batchCmd: "New", 
    updates: updateCAML,
});
Any idea what is missing?
Coordinator
Dec 13, 2015 at 6:12 PM
Have you tried creating the new Document Set without FSObjType? I'm not sure if it will work, but that could be what's making them different than other Document Sets; they could be picking up some folder-ness that they shouldn't have.

M.
Dec 17, 2015 at 4:02 PM
I had tried that long ago and forgotten what happens. I just tried it again without the FSObjType. The problem gets worse.

The newly created item still doesn't sort with the other items and it also doesn't look like or behave like a document set either. In the list view instead of having the DocSet icon it shows a regular folder icon and when clicked it doesn't have the welcome page or any of the other document set options.

I'm not sure where I picked up the FSObjType trick, but I think I examined the managed properties of UI created document sets and noticed they all had that set to 1 and that a document set is really just a "magic" folder.

I've also tried setting ProgId to "SharePoing.DocumentSet." I've seen that in the C# code and figured I'd give it a try, but that hasn't helped either.

Maybe it is time to move onto REST for this operation! Although it looks like it is only available in the 2010 REST api....wonder if it will come into 2013...

Thanks for the help.
Coordinator
Dec 17, 2015 at 4:44 PM
I think the issue is probably that Document Sets came along in 2010 and the SOAP services weren't updated much at that point (that I can discern). It may effectively be a "bug".

M.