I'm trying to create a sharing link for OneDrive item using Microsoft.Graph.CreateLink action:
POST https://graph.microsoft.com/v1.0/me/drive/items/01B642VZR4QM6MX36HGZELNLHCFGY26JJ6/Microsoft.Graph.createLink HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
{
"type":"edit"
}
and I got the following error:
HTTP/1.1 400 Bad Request
{
"error": {
"code": "BadRequest",
"message": "Version not specified.",
"innerError": {
"request-id": "3ca90464-3910-49e1-92f2-3a9daa822944",
"date": "2016-02-17T15:56:16"
}
}
}
Either method description or metadata does not contain any information about versions needed other than in the API endpoint.
From logs corresponding to request-id:3ca90464-3910-49e1-92f2-3a9daa822944, the request received by the service was "POST https://graph.microsoft.com/". The lack of path segment in the request URL is causing this expected error. Can you please check the request again?
Related
I am trying to access the sendgrid Rest API using GET https://api.sendgrid.com/v3/contactdb/lists/xxx-xxxx-xxxx-xxxx-xxxx/recipients to get contacts from contacts list
I have also provided headers to rest api call
Content-Type: application/json
Authorization: Bearer SG.xxxxx
Below is the error shown
{
"errors": [
{
"field": null,
"message": "access forbidden"
}
]
}
The documentation for above rest URL is https://docs.sendgrid.com/api-reference/contacts-api-lists/retrieve-all-recipients-on-a-list
Am I missing something?
The below graph endpoint is used to grant access to the recipients on a drive item.
POST /drives/{drive-id}/items/{item-id}/invite
We are getting 400 Bad Request with Error code noResolvedUser, when a valid email address is added as recipient.
Request Method: POST
https://graph.microsoft.com/v1.0/drives/b\u00219b-VFEZXFE2F6XaM23GxN8X-1eQtnPNKnMeB6Rp23ucBGLuKk3pmT5OkkLL5Q1l7/items/01Q2A2TZG5GSOV2XYB7FEKPGK4VD6S7OI3/invite
Status Code: 400 Bad Request
client-request-id: e1646495-3606-4e49-88ad-2d977d284164
Cache-Control: no-cache
Content-Type: application/json
"error": {
"code": "noResolvedUsers",
"message": "One or more users could not be resolved.",
"innerError": {
"date": "2021-06-15T08:41:35",
"request-id": "607b3ce3-e29b-45a9-9942-7528e43fe8b4",
"client-request-id": "e1646495-3606-4e49-88ad-2d977d284164"
}
}
We could not find documentation for the error code 'noResolvedError'.
Many tenants are experiencing this. Knowing what is causing this error and how to fix it will be a great help.
I am trying to delete Planner task using Microsoft graph according to instruction on https://learn.microsoft.com/en-us/graph/api/plannertask-delete?view=graph-rest-1.0&tabs=http
GET works, DELETE does not.
Request should look like:
DELETE https://graph.microsoft.com/v1.0/planner/tasks/{id}
If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
In my case, it is:
DELETE https://graph.microsoft.com/v1.0/planner/tasks/nWf2j63qnk69r69ZdK7135cAMVlSIf-Match:W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
What am I doing wrong?
GET
https://graph.microsoft.com/v1.0/planner/tasks/nWf2j63qnk69r69ZdK7135cAMVlS
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#planner/tasks/$entity",
"#odata.etag": "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
...
"id": "nWf2j63qnk69r69ZdK7135cAMVlS",
...
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment '\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"'.",
"innerError": {
"request-id": "58d3c417-6474-422c-912d-e6fdaae856c3",
"date": "2019-09-06T23:47:35"
}
}
}
It appears you are trying to pass If-Match via request url:
DELETE https://graph.microsoft.com/v1.0/planner/tasks/nWf2j63qnk69r69ZdK7135cAMVlSIf-Match:W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
while it is expected to be provided via request headers, like this:
DELETE https://graph.microsoft.com/v1.0/planner/tasks/{id}
Headers:
If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
Authorization: Bearer <access-token>
Graph Explorer example
I received "Forbidden" when accessing an image/sticker link in a chat message return from Microsoft Graph Api.
I received the following chat message from Graph Api (not all properties are not listed):
{
"body": {
"contentType": "html",
"content": "<div><div>Message 499\n<div><span><img src=\"https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:baf66ad0b75f4656bf20ff5667fae565#thread.skype/messages/1562258187781/hostedContents/aWQ9eF8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMS92aWV3cy9pbWdv/$value\" width=\"250\" height=\"250\" style=\"vertical-align:bottom; width:250px; height:250px\"></span>\n\n</div>\n\n\n</div>\n</div>"
}
}
Then I tried to access the image link
GET https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:baf66ad0b75f4656bf20ff5667fae565#thread.skype/messages/1562258187781/hostedContents/aWQ9eF8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMS92aWV3cy9pbWdv/$value
Headers:
Authorization: bearer [access_token]
The response was:
403 Forbidden
{
"error": {
"code": "Forbidden",
"message": "Forbidden",
"innerError": {
"request-id": "3143682e-4dd2-4057-ad83-e4d7fbf32b98",
"date": "2019-07-05T07:09:06"
}
}
}
Headers:
request-id: 3143682e-4dd2-4057-ad83-e4d7fbf32b98
client-request-id: 3143682e-4dd2-4057-ad83-e4d7fbf32b98
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Southeast Asia","Slice":"SliceC","Ring":"3","ScaleUnit":"001","RoleInstance":"AGSFE_IN_2","ADSiteName":"SEA"}}
Date: Fri, 05 Jul 2019 07:09:05 GMT
However, I was able to list the hosted contents of the same channel:
GET: https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:baf66ad0b75f4656bf20ff5667fae565#thread.skype/messages/1562258187781/hostedContents
Headers:
Authorization: bearer [access_token]
Response
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#teams('82d87df3-b8bd-4bdc-9090-5f8666b32134')/channels('19%3Abaf66ad0b75f4656bf20ff5667fae565%40thread.skype')/messages('1562258187781')/hostedContents",
"#odata.count": 1,
"value": [
{
"id": "aWQ9eF8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMS92aWV3cy9pbWdv"
}
]
}
Also, I was able to retrieve the image from another chat message in another channel (the general channel) in the same team.
GET https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:db70de74054944fe9dbce0a592eddb6d#thread.skype/messages/1562252008138/hostedContents/aWQ9eF8wLWN1cy1kNi1iYWY0OTc0ZGNjMjc0MTAwMjI5YmMyZjcyY2Y0ODk2NSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kNi1iYWY0OTc0ZGNjMjc0MTAwMjI5YmMyZjcyY2Y0ODk2NS92aWV3cy9pbWdv/$value
Headers:
Authorization: bearer [access_token]
The user associated with the access token is one of the owners of the team, but he is not the one posting the chat message containing the image.
What am I missing here?
Update: I did more testing and found the following pattern.
The issue did not happen for General channel.
For other channels, if a user had not posted any message to a channel, accessing the image link of the chat messages resulted in Forbidden error. After the user posted one message, it could access the link fine.
Looks like a permission synchronization issue. Any idea?
If I want to list files in the folder with query parameter $orderBy according to the documentation, I get a response with error 501.
Here is a raw example of request:
GET /v1.0/drives/{id}/items/{id}/children?$select=name,id,folder,lastModifiedDateTime,createdDateTime,size,createdBy,lastModifiedBy,webUrl&$orderby=createdDateTime HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer <token>
The response is:
{
"error": {
"code": "notSupported",
"message": "The request is not supported by the system.",
"innerError": {
"request-id": "c925ae56-8359-4e8f-98b9-92ff0c4dfc8a",
"date": "2018-06-04T10:50:00"
}
}
}
This problem I have only with a specific OneDrive account. If I use the same API call for a different drive and folder, then it works well without any problem.
When I investigated it then it seemed like the API doesn't support parameter $orderBy with date variable inside for this account at all.
Does anyone know why I get this error for a specific account?