Onedrive-api-docs: Create a new list

Created on 4 Jul 2017  路  23Comments  路  Source: OneDrive/onedrive-api-docs

Hello,

Following the official documentation i tried to _create a list_ using the following request:

Endpoint url: https://graph.microsoft.com/beta/sites/root/lists
Headers:
Content-Type: application/json
Body:

{
  "name": "Books",
  "columns": [
    {
      "name": "Author",
      "text": { }
    },
    {
      "name": "PageCount",
      "number": { }
    }
  ],
  "list": {
    "template": "generic"
  }
}

but got the error:

Cannot define a 'name' for a list as it is assigned by the server. Instead, provide 'displayName'

After replacing namewith displayNameattribute, the following error started to occur:

One of the provided arguments is not acceptable.

Is there any errors with the provided example?

Author Feedback no-recent-activity resolved bug

Most helpful comment

Any idea when this might be resolved @ificator ?

All 23 comments

I have exactly same problem. All work fine with MS graph for sharepoint, except creating a list (folder in a root of a site)

I've run into this issue as well. Are you able confirm if this is a bug or an error on our part? Is there any workaround we can do? Thanks.

Thanks guys, I'm just back from vacation and getting back up to speed on everything that happened over the last few weeks, but I'll make sure to look at this today :).

This looks to be a configuration issue in Graph - we'll see if we can resolve it ASAP.

Any idea when this might be resolved @ificator ?

Do you have any idea when you might have this released? It's blocking a lot of our users being able to create root lists.

@ificator Do you have any expectation to when this will be resolved? This is majorly blocking our adoption for your API. Do you have any timelines or will it never be fixed?

It turns out there were a couple of issues at play - the original issue has been resolved (displayName was defined in the Graph schema), while the second is partially resolved (list CUD operations require site manage permissions). If you are assigning application permissions via the AAD Portal you should now be able to associated Sites.Manage.All with your application, however if you rely on dynamic consent I believe there's still an issue. I'll follow up when that aspect is resolved.

For me it still doesn't work.
I added Sites.Manage.All to "Application permission" in the application settings. But no any change

Hi @Gelembjuk can you provide the request id and timestamp from the response?

There is my request

POST /beta/sites/carljenkins.sharepoint.com,90f119df-4d34-4260-8036-38bebf451c37,c9b29de7-f937-469c-82a6-b6e355e72b05/lists HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 5.1) Chrome/23.0.1271.95 Safari/537.11
Host: graph.microsoft.com
Accept-Encoding: gzip
Accept: image/gif, image/x-bitmap, image/jpeg, image/jpeg, */*
Connection: Keep-Alive
Content-Type: application/json
Authorization: bearer eyJ0eXAiOi**********KwzcFqLI3H9vRrIfM8DCtw56fw
Content-Length: 131

{"displayName":"newinroot4","columns":[{"name":"Author","text":{}},{"name":"PageCount","number":{}}],"list":{"template":"generic"}}
HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json
request-id: 28420cfe-dea2-4237-91b3-855369c9476c
client-request-id: 28420cfe-dea2-4237-91b3-855369c9476c
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceB","ScaleUnit":"000","Host":"AGSFE_IN_23","ADSiteName":"WST"}}
Duration: 2170.9789
Date: Wed, 11 Oct 2017 09:47:33 GMT

{
  "error": {
    "code": "invalidRequest",
    "message": "One of the provided arguments is not acceptable.",
    "innerError": {
      "request-id": "28420cfe-dea2-4237-91b3-855369c9476c",
      "date": "2017-10-11T09:47:33"
    }
  }
}

Can you try specifying genericList for the template value (or just not provide list at all) and see if that works? The error message could obviously be improved is this is indeed the issue.

When i set
"template" => "genericList"
or when i remove the 'list' at all then i have the error
'The caller is not authenticated.'

Hi @Gelembjuk , can you provide the response when you see that error (or just provide the innerError with the guid and timestamp).

First request

POST /beta/sites/carljenkins.sharepoint.com,90f119df-4d34-4260-8036-38bebf451c37,c9b29de7-f937-469c-82a6-b6e355e72b05/lists HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 5.1) Chrome/23.0.1271.95 Safari/537.11
Host: graph.microsoft.com
Accept-Encoding: gzip
Accept: image/gif, image/x-bitmap, image/jpeg, image/jpeg, */*
Connection: Keep-Alive
Content-Type: application/json
Authorization: bearer eyJ0eXAiOiJKV1*******tQ
Content-Length: 135

{"displayName":"newinroot4","columns":[{"name":"Author","text":{}},{"name":"PageCount","number":{}}],"list":{"template":"genericList"}}
HTTP/1.1 401 Unauthorized
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json
request-id: cad4058c-4b0f-49ea-8d24-dcad88c703bc
client-request-id: cad4058c-4b0f-49ea-8d24-dcad88c703bc
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceB","ScaleUnit":"000","Host":"AGSFE_IN_14","ADSiteName":"WST"}}
Duration: 1388.6977
Date: Thu, 12 Oct 2017 07:53:36 GMT

{
  "error": {
    "code": "unauthenticated",
    "message": "The caller is not authenticated.",
    "innerError": {
      "request-id": "cad4058c-4b0f-49ea-8d24-dcad88c703bc",
      "date": "2017-10-12T07:53:37"
    }
  }
}



md5-9a3ed6c24176dc68ed77ed4d2470f9e8



POST /beta/sites/carljenkins.sharepoint.com,90f119df-4d34-4260-8036-38bebf451c37,c9b29de7-f937-469c-82a6-b6e355e72b05/lists HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 5.1) Chrome/23.0.1271.95 Safari/537.11
Host: graph.microsoft.com
Accept-Encoding: gzip
Accept: image/gif, image/x-bitmap, image/jpeg, image/jpeg, */*
Connection: Keep-Alive
Content-Type: application/json
Authorization: bearer eyJ0eXAiOiJKV********tXdfDs3yNw
Content-Length: 101

{"displayName":"newinroot4","columns":[{"name":"Author","text":{}},{"name":"PageCount","number":{}}]}



md5-c75631bf4f119611bf89991bd460aae7



HTTP/1.1 401 Unauthorized
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json
request-id: 0b1c7e4f-880c-45dd-9a9f-5c5f5d255296
client-request-id: 0b1c7e4f-880c-45dd-9a9f-5c5f5d255296
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceB","ScaleUnit":"000","Host":"AGSFE_IN_4","ADSiteName":"WST"}}
Duration: 1319.3126
Date: Thu, 12 Oct 2017 07:54:36 GMT

{
  "error": {
    "code": "unauthenticated",
    "message": "The caller is not authenticated.",
    "innerError": {
      "request-id": "0b1c7e4f-880c-45dd-9a9f-5c5f5d255296",
      "date": "2017-10-12T07:54:37"
    }
  }
}

Hi @Gelembjuk, it looks like the token you're using still doesn't have Sites.Manage.All:

"scp":"Files.ReadWrite Sites.ReadWrite.All"

You can see this by going to https://jwt.ms and pasting you our access token. You mentioned you had above, but could you confirm that Sites.Manage.All was added to your application via the Azure portal?

There is screenshot of my test app settings
onedrive

@ificator , can you explain more about the scopes and App permissions?
When i generate a token i set the scope = scope=files.readwrite offline_access sites.readwrite.all

I tried to set there also sites.manage.all , but it gives error . It seems it is not allowed scope value.
Also, in the list of delegated permissions in the app settings i don't see Sites.Manage.All . I see it only in App permissions and i have added it (see my screenshot)

What do i do wrong?

Ah, that looks like dynamic consent, which for some reason is causing problems. We're following up with AAD to figure out what's going on.

Still no any changes.
@ificator , do you know when we can expect an update?

Oh wow, for some reason I thought we'd resolved this issue. I just tried using AAD v2.0 and the incremental/dynamic consent appears to work. Hopefully you noticed things working not long after your ping.

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 10 days. It will be closed if no further activity occurs within 10 days of this comment. Thank you for your contributions to OneDrive API Docs!

This issue has been automatically marked as stale because it has marked as resolved but has not had any activity for 10 days. It will be closed if no further activity occurs within 10 days of this comment. Thank you for your contributions to OneDrive API Docs!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atkinchris picture atkinchris  路  6Comments

dluces picture dluces  路  3Comments

Tekki picture Tekki  路  5Comments

audiorecorder picture audiorecorder  路  5Comments

marcreicher picture marcreicher  路  3Comments