onedrive-api-docs: API is creating invalid sharing links in some folders

Category

  • Question
  • Documentation issue
  • Bug

Expected or Desired Behavior

The API to create a sharing link should return a valid sharing link that can be accessed.

Observed Behavior

In some folders, when creating a Sharing Link, the generated link doesn’t work. The API seems to always return the same Sharing Link but when I go to the folder and check the created Sharing Links it doesn’t show any, and if I try to open the sharing link it says “Pedimos desculpa mas algo correu mal” which means something link “We are sorry but something went wrong”.

I’m following this documentation: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createlink?view=odsp-graph-online

I’m using a business account.

Steps to Reproduce

I create request with this information: Item Id: 01CFGODSUNRIQ5P2BMDFGJVMQTKTPUSUQJ

Url: https://graph.microsoft.com/v1.0/me/drive/items/01CFGODSUNRIQ5P2BMDFGJVMQTKTPUSUQJ/createLink

Body:
	Format: JSON (application/json)
	Content: {"type":"edit","scope":"organization"}
Headers:
	Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6Ik
	Content-Type: application/json

Postman images for more detail:

https://i.ibb.co/cvF1hT1/od-print-2-edited.png

https://i.ibb.co/6NZkDhL/od-print-3-edited.png

C# Code that I also used:

public Permission CreateSharedLinkOfItem(string itemId, string type)
{
	string graphUrl = $"https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/createLink";
	HttpWebRequest request = WebRequest.CreateHttp(graphUrl);
	request.Headers.Add("Authorization", "Bearer " + AccessToken);
	request.ContentType = "application/json";
	request.Method = "POST";

	FolderSharedLink folderSharedLink = new FolderSharedLink
	{
		Scope = "organization",
		Type = type
	};

	using (var streamWriter = new StreamWriter(request.GetRequestStream()))
	{
		string json = JsonConvert.SerializeObject(folderSharedLink);
		streamWriter.Write(json);
		streamWriter.Flush();
		streamWriter.Close();
	}

	var response = request.GetResponse();
	using (StreamReader reader = new StreamReader(response.GetResponseStream()))
	{
		return JsonConvert.DeserializeObject<Permission>(reader.ReadToEnd());
	}
}

Response:

I placed “*” in the response to hide some info about my company.

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#permission",
    "@odata.type": "#microsoft.graph.permission",
    "id": "f29249bb-616f-4522-a1c8-84c751e20fbb",
    "roles": [
        "write"
    ],
    "link": {
        "scope": "organization",
        "type": "edit",
        "webUrl": "https://spa*********-my.sharepoint.com/:f:/g/personal/fileserver_******_fr/Eo2KIdfoLBlMmrITVN9JUgkBrsp2N8CfXc2MPPLYzGoBIg"
    }
}

If I try to open the webUrl returned it shows this:

Original text

Pedimos desculpa, mas algo correu mal
Sorry, you cannot access this document. Please contact the person who shared it with you.
DETALHES TÉCNICOS



Resolver problemas com o Microsoft SharePoint Foundation.
ID de Correlação: 66e6d99e-100e-0000-6aa7-446c7920d509

Data e Hora: 5/6/2019 1:19:02 AM

Translated text

We're sorry, but something went wrong.
Sorry, you can not access this document. Please contact the person who shared it with you.
TECHNICAL DETAILS



Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: 66e6d99e-100e-0000-6aa7-446c7920d509

Date and Time: 5/6/2019 1:19:02 AM

https://i.ibb.co/R788456/od-print-4.png

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@k-tsoi thanks for taking an interest in this. Yes we still have this bug.

I made the following request:

Request

Request

POST https://graph.microsoft.com/v1.0/me/drive/items/01CFGODSUNRIQ5P2BMDFGJVMQTKTPUSUQJ/createLink

Authorization: Bearer eyJ0eXAiOiJKV1Qi....

Content-Type: application/json

And got this response:

Date: Mon, 22 Jul 2019 07:57:07 GMT request-id: 6d0d79d6-f7db-4f61-8b40-814e8df38bc8

Full Response Body & Headers

Response Body

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#permission",
    "@odata.type": "#microsoft.graph.permission",
    "id": "f29249bb-616f-4522-a1c8-84c751e20fbb",
    "roles": [
        "write"
    ],
    "link": {
        "scope": "organization",
        "type": "edit",
        "webUrl": "https://*********-my.sharepoint.com/:f:/g/personal/******_fr/Eo2KIdfoLBlMmrITVN9JUgkBrsp2N8CfXc2MPPLYzGoBIg"
    }
}

Response Headers:

Cache-Control →private
Content-Encoding →gzip
Content-Type →application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date →Mon, 22 Jul 2019 07:57:07 GMT
Duration →936.8338
Location →https://graph.microsoft.com
OData-Version →4.0
Strict-Transport-Security →max-age=31536000
Transfer-Encoding →chunked
Vary →Accept-Encoding
client-request-id →6d0d79d6-f7db-4f61-8b40-814e8df38bc8
request-id →6d0d79d6-f7db-4f61-8b40-814e8df38bc8
x-ms-ags-diagnostic →{"ServerInfo":{"DataCenter":"North Europe","Slice":"SliceC","Ring":"3","ScaleUnit":"002","RoleInstance":"AGSFE_IN_26","ADSiteName":"NEU"}}

And the ‘webUrl’ is always the same.

Is there any updates on this? When can we expect this issue to be resolved?

Thanks for all the details @carloswbarros, while I’m still not sure what’s going on it’s fairly safe to say it’s a bug. With the data you provided hopefully we can get to the bottom of it soon.