How to remove a users manager in AzureAD using Microsoft.Azure.ActiveDirectory.GraphClient

I'm using the Microsoft.Azure.ActiveDirectory.GraphClient (Version 2.1.0) to write an app for Azure AD user management. I'm able to set the Manager of a user but have no idea how to clear the field.

Unfortunately the sample project provided on GitHub do not contain this function either.

Answers


I managed to clear the "manager" field using the code below. It is not using the Microsoft.Azure.ActiveDirectory.GraphClient library but gets the job done.

var token = <get your adal token here>
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = 
    new AuthenticationHeaderValue("Bearer", token);

var url = "https://graph.windows.net/<tenant domain>/users/<userid>/$links/manager?api-version=1.6"
var resp = httpClient.DeleteAsync(url).Result;
if (!resp.IsSuccessStatusCode)
{
    // log / throw exception etc.   
}

//Assign and remove user's manager
// User.Manager = newUser as DirectoryObject;
           User.Manager = null;

Need Your Help

Selenium WebDriver - No driver is working for me

c# selenium webdriver

I'm trying to get Selenium tests running. I'm using C#. I'm having a problem with every driver I tried.

I'm having problems with null pointer exception and JFrames

java swing nullpointerexception jframe

This is my code: there is also a JPanel if you need that but I'm nearly certain that that the JPanel works. The problem I'm having is that my JPanel is not showing up on the JFrame. Thank you very ...