Unable to Remove Sharing using Graph API

Copper Contributor

Hi,

I am sharing a folder to the users using

string url = 'https://graph.microsoft.com/v1.0/drives/' + driveIdVal + '/items/' + folderName + '/invite'; 
Its successfully shared a folder with user and I can able to get a permission Id. After some time I want to un share a folder from specific user. To un share I am using below URl to delete a permission.

string url= 'https://graph.microsoft.com/v1.0/drives/' + driveIdVal + '/items/' + idval + '/permissions/'+ PermissionId;

I am using below code to delete a permission.

HttpClient clienthttp = new HttpClient();
clienthttp.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue('bearer', _Accesstoken);
using (var request = new HttpRequestMessage(HttpMethod.Delete, url)) {
var response = await clienthttp.SendAsync(request);
JObject json = JObject.Parse(await response.Content.ReadAsStringAsync());
}

But I am getting StatusCode: 404, ReasonPhrase: 'Not Found' request-id: 0839e2f0-48f6-4813-a71c-7e3b8be2f9f9 client-request-id: 0839e2f0-48f6-4813-a71c-7e3b8be2f9f9
Let me know why its returning 'Not Found' error.


Thanks,
Baskar G

0 Replies