public void DeleteDocumentById(string userId, string itemId) { var urlRoot = $"https://graph.microsoft.com/v1.0/"; var url = $"{urlRoot}/users/{userId}/drive/items/{itemId}"; var response = _restClient.delResponse(url); var responseBody = response.Content.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult(); if (!response.IsSuccessStatusCode) { throw new Exception(responseBody); } }
public bool DeleteUser(string userPrincipalName) { //https://docs.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0 //https://graph.microsoft.com/v1.0/users/{user-id} DELETE //https://docs.microsoft.com/en-us/graph/permissions-reference#user-permissions //User.ReadWrite.All (delegated) var urlRoot = $"https://graph.microsoft.com/v1.0/"; var url = $"{urlRoot}/users/{userPrincipalName}"; var responseBody = _restClient.delResponse(url); Console.WriteLine(responseBody); return(true); }