Document Set created programmtically not working anymore since 12 Jan 2021

Lecus Soh 21 Reputation points
2021-01-14T10:03:09.057+00:00

Hi Expert,

Document Set that created programmatically not working since 2 days ago on Tuesday 12 Jan 2021. Below is the screenshot showing the document set created with folder icon instead of Document Set icon like the last 2 records.

I am using SharePoint online. Could you please let me know is there any upgrade happened 2 days ago? Any solution for this issues? Below you can also find the code that uses to create the document set folder.

56468-documentset.png

========================================================

Code Snippet

=========================================================

                    var listTitle = WebConfigurationManager.AppSettings.Get("CentralisedLibrary");  
                    var list = clientContext.Web.Lists.GetByTitle(listTitle);  

                    ListItemCreationInformation newItemInfo = new ListItemCreationInformation();  

                    newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;  

                    newItemInfo.LeafName = BLNo.Trim();  

                    ListItem newListItem = list.AddItem(newItemInfo);  

                    newListItem["ContentTypeId"] = WebConfigurationManager.AppSettings.Get("CentralisedDocumentSetID");  

                    newListItem["BLNo"] = BLNo;  
                    newListItem["_Category"] = BOLFolderProperties.Category;  
                    newListItem["Region"] = BOLFolderProperties.Region;  
                    if (Utilities.IsValidDateField(BOLFolderProperties.ShipAirDate))  
                        newListItem["ShipAirDate"] = Convert.ToDateTime(BOLFolderProperties.ShipAirDate);  
                    newListItem["ShipmentMode"] = BOLFolderProperties.ShipmentMode;  
                    newListItem["ContainerNo"] = Utilities.FormatSplitValues(BOLFolderProperties.ContainerNo);  
                    newListItem["PONo"] = Utilities.FormatSplitValues(BOLFolderProperties.PONo);  
                    newListItem["ShipperName"] = vendorListData.VendorListTitle;  
                    newListItem["ActualCreator"] = vendorListData.VendorListTitle;  

                    newListItem.Update();  

                    clientContext.Load(newListItem);  

                    clientContext.ExecuteQuery();  
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,889 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-01-15T02:45:47.217+00:00

    Hi @Lecus Soh ,

    Per my test, I could reproduce your issue on my tenant. This seems to be some changes in SharePoint Online after 12th January. And I find the same issue in this thread: https://sharepoint.stackexchange.com/questions/288764/sharepoint-online-javascript-creates-folder-instead-of-document-set/288820#288820

    I find something interesting: the icon of the document set displays normal in modern experience,however it displays folder icon in classic experience.

    I find a temporary solution to this issue: use the list.contentTypeID instead of web.ContentTypeID. To get the list contenttype id, go to library settings, click the document set content type. You could find it in the url.

    56874-image.png

    Use this list contentTypeID would fix this:

    56993-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful