Create SharePoint List from a different template using MS Graph

Joel Taylor 66 Reputation points
2022-09-27T22:08:03.407+00:00

I have created a SharePoint List in my site. Now, I want to be able to use MS Graph to create new lists from that template (see here for documentation).

I am able to create a new SharePoint list from the 'genericList' template, but I want to be able to do it with a template. Below are the screenshots of successful creation of generic list.

245322-image.png

245305-image.png

I have created my List template:

245294-image.png

However, when I try "Student-List-Template" as the template name, I get an error.

245250-image.png

I also tried with the built-in template, but had a similar issue.

245331-image.png

What do I need to do to create a new list with the created template?

If there is no answer to this question, what are all the codes for other columns? If I can't create a new list from a template, I will just have to manually add the columns that would be part of the list. The documentation only provided the code for two column types. Specifically, I need 'multiple lines of text', 'yes/no', 'choice', and 'date/time'.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,714 questions
{count} vote

Accepted answer
  1. Shivam Dhiman 5,946 Reputation points
    2022-10-12T23:37:22.297+00:00

    Hi @Joel Taylor

    As per my knowledge feature/functionality to create SharePoint list from a custom template is not yet available with Microsoft Graph API. 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.

    To add columns with respective types 'multiple lines of text', 'yes/no', 'choice', and 'date/time'' use this
    POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists Graph API along with the body.

    {  
        "displayName": "oinoamdsda",  
        "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"  
        }  
    }  
    

    As you can see using above Graph API and body I am able to create columns.
    249780-ss11.png

    If you want to create any other type of column please refer to this documentation.

    Hope this helps.

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


0 additional answers

Sort by: Most helpful