Unable to add "Approved" column to documentLibrary using "enableModeration" when creating list

Filipe Fonseca 20 Reputation points
2023-11-08T12:44:59.3166667+00:00

The issue I'm having is using the Graph API, using the endpoint /sites/{sharepointSite}:/sites/{siteId}:/lists

Im creating "lists" on SharePoint under a Site, and set a template (JSON attached).

From the documentation by setting "enableModeration" we should get the "Approved" column. We're sending the parameter as "true", but the column doesn't show. I could swear it used to, so maybe the API has changed and the documentation hasn't been updated, or there is a bug, or maybe I'm missing something. The API doesn't throw any errors though, it still creates the list.

The JSON sent:

{   "displayName": "Name",   "columns": [     {       "name": "DocType",       "displayName": "Doc Type",       "choice": {         "choices": [           "PDF",           "Image"         ],         "displayAs": "dropDownMenu",         "allowTextEntry": true       },       "indexed": true,       "enforceUniqueValues": false     }   ],   "list": {     "template": "documentLibrary",     "enableModeration": true   } }

We also tried by creating a new template, but there is no documentation on how to send in a "custom" template through the API. It throws the error "One of the provided arguments is not acceptable."

Can you give us some guidance on how to get the Approval column to show when creating a new list?

Kind regards

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,461 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,924 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,104 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 36,501 Reputation points Microsoft Vendor
    2023-11-09T06:06:28.4533333+00:00

    Hi @Filipe Fonseca,

    As per my knowledge feature/functionality to create SharePoint list from a custom template is not yet available with Microsoft Graph API.

    Per my test, I can reproduce the issue with yours. By passing following body, I could only create the list with columns but without Require content approval setting changes.

    {  
        "displayName": "testlist",  
        "columns": [  
            {  
                "name": "DateTime",  
                "dateTime": {}  
            },  
            {  
                "name": "Multipleline",  
                "text": {  
                    "allowMultipleLines": true,  
                    "appendChangesToExistingText": false,  
                    "linesForEditing": 6,  
                    "maxLength": 300,  
                    "textType": "plain | richText"  
                }  
            },  
            {  
                "name": "Choice",  
                "choice": {  
                    "allowTextEntry": true,  
                    "choices": [  
                        "red",  
                        "blue",  
                        "green"  
                    ],  
                    "displayAs": "dropDownMenu"  
                }  
            },  
            {  
                "name": "Yes/No",  
                "boolean": {}  
            }  
        ],  
        "list": {  
            "template": "genericList",
    		"enableModeration": true 
        }  
    }
    

    Since this feature/functionality is presently not available, you can submit a feature request idea using this support link, which will be monitored by Microsoft team and make the enhancements to Microsoft Graph APIs. I will also upvote for you.

    As a workaround, you could change the setting in the list setting. Go Versioning Settings, and change Require content approval for submitted items to yes.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.