Microsoft Graph Explorer is a browser-based REST API client for Office 365. By using Graph explorer, we can access all applications/services in Microsoft Cloud by sending the Microsoft Graph API request.

Microsoft Graph API is a single endpoint with single authentication to access all Microsoft cloud services like Office 365 (OneDrive, SharePoint, etc..), Windows and Enterprise + Mobility.

Here, we are going to see on how to create a list in SharePoint Online using Microsoft Graph Explorer.

Authenticate and Permission Setup

Note: Graph Explorer also works with sample data, if you are not authenticated. To access the actual information, you have to sign in to the Office 365.

Graph Explorer

Now, we are ready for creating List.

Output

After sending the request, our request will create a new list under the provided SharePoint site. Response Preview control shows the output in JSON format as provided below.

  1. {
  2. "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)/$entity",
  3. "@odata.etag": "\"f5fe8ccd-df1f-4aec-80d8-b375f650af9e,8\"",
  4. "createdDateTime": "2018-06-26T11:06:39Z",
  5. "description": "",
  6. "eTag": "\"f5fe8ccd-df1f-4aec-80d8-b375f650af9e,8\"",
  7. "id": "f5fe8ccd-df1f-4aec-80d8-b375f650af9e",
  8. "lastModifiedDateTime": "2018-06-26T11:06:39Z",
  9. "name": "GraphList",
  10. "webUrl": "https://ktskumar.sharepoint.com/sites/dev/Lists/GraphList",
  11. "displayName": "GraphList",
  12. "createdBy": {
  13. "user": {
  14. "email": "[email protected]",
  15. "id": "4dccf644-24fd-4500-bb7f-311a4216bb73",
  16. "displayName": "Shantha Kumar"
  17. }
  18. },
  19. "parentReference": {},
  20. "list": {
  21. "contentTypesEnabled": false,
  22. "hidden": false,
  23. "template": "genericList"
  24. 24.
  25. }
  26. 25.
  27. }

After navigation to the SharePoint site https://ktskumar.sharepoint.com/sites/dev in a browser; we can view the newly created list “GraphList” present under the site.

Create List with Custom Columns

To create a custom list with the custom columns, alter the Request body in the below format. Add any column types under columns array in JSON.

  1. {
  2. "displayName": "GraphList",
  3. "columns": [{
  4. "name": "Service",
  5. "text": {}
  6. }, {
  7. "name": "AppCount",
  8. "number": {}
  9. }],
  10. "list": {
  11. "template": "genericList"
  12. 15.
  13. }

Columns

Array variable to have column information (name, <type>, …).

The above request will create a SharePoint list called ‘GraphList’ with two additional custom columns (service as a Single line of Text and AppCount as Number)

Method - POST

Request Body

  1. {
  2. "displayName": "GraphList2",
  3. "list": {
  4. "template": "genericList"
  5. }
  6. }

Request Header

Response

  1. {
  2. "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)/$entity",
  3. "@odata.etag": "\"f5fe8ccd-df1f-4aec-80d8-b375f650af9e,8\"",
  4. "createdDateTime": "2018-06-26T11:06:39Z",
  5. "description": "",
  6. "eTag": "\"f5fe8ccd-df1f-4aec-80d8-b375f650af9e,8\"",
  7. "id": "f5fe8ccd-df1f-4aec-80d8-b375f650af9e",
  8. "lastModifiedDateTime": "2018-06-26T11:06:39Z",
  9. "name": "GraphList",
  10. "webUrl": "https://ktskumar.sharepoint.com/sites/dev/Lists/GraphList",
  11. "displayName": "GraphList",
  12. "createdBy": {
  13. "user": {
  14. "email": "[email protected]",
  15. "id": "4dccf644-24fd-4500-bb7f-311a4216bb73",
  16. "displayName": "Shantha Kumar"
  17. }
  18. },
  19. "parentReference": {},
  20. "list": {
  21. "contentTypesEnabled": false,
  22. "hidden": false,
  23. "template": "genericList"
  24. }
  25. }

SharePoint

After navigation to the SharePoint site at URL https://ktskumar.sharepoint.com/sites/dev, we can see the newly created list called GraphList.

If, we want to create a new list with columns, send the request body as,

  1. {
  2. "displayName": "GraphList",
  3. "columns": [
  4. {
  5. "name": "Service",
  6. "text": { }
  7. },
  8. {
  9. "name": "AppCount",
  10. "number": { }
  11. }
  12. ],
  13. "list": {
  14. "template": "genericList"
  15. }
  16. }