2017-05-17 10 views
1

"Microsoft.Azure.ActiveDirectory.GraphClient.dll"と "Microsoft.IdentityModel.Clients.ActiveDirectory"を参照ライブラリとして使用しています。は、C#を使用してAzure ADユーザーをプログラムで作成します

これには、 "string Mail {get; set;}"プロパティを含むIUserオブジェクトがあります。 IUserオブジェクトを作成して電子メールを割り当てると、電子メールは割り当てられず、ユーザーは作成されません。 AZURE Active Directoryのユーザープロファイルには、Emailフィールドがあります。 DisplayNameとUserPrincipalNameでユーザーを作成すると、 が表示されますが、DisplayName、UserPrincipalNameおよびMailユーザーは作成されません。

User Create... 

protected void btnAdd_Click(object sender, EventArgs e) 
{ 
    ActiveDirectoryClient client = AuthenticationHelper.GetActiveDirectoryClientAsApplication(); 

    IUser newUser = new User(); 
    newUser.DisplayName = "New User"; 
    newUser.UserPrincipalName = [email protected] 

    //newUser.Mail = "[email protected]"; 

    client.Users.AddUserAsync(newUser).Wait(10000); 
} 

User not Create and Email not assign... 

protected void btnAdd_Click(object sender, EventArgs e) 
{ 
    ActiveDirectoryClient client = AuthenticationHelper.GetActiveDirectoryClientAsApplication(); 

    IUser newUser = new User(); 
    newUser.DisplayName = "New User"; 
    newUser.UserPrincipalName = [email protected] 
    newUser.Mail = "[email protected]"; 

    client.Users.AddUserAsync(newUser).Wait(10000); 
} 

答えて

0

あなたはuser objectotherMails属性ではなくmail属性を使用する必要があります。

mail属性は、Exchange OnlineまたはOn-Premirect SyncがユーザーのSMTPアドレスに対して特に設定する単一の値フィールドです。

関連する問題