Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Adding User via C# ChangeTrackingCollection Error

$
0
0

Using the following code:

 Microsoft.Azure.ActiveDirectory.GraphClient.User user = new Microsoft.Azure.ActiveDirectory.GraphClient.User();


                    userPrincipalName = "John.DoeUK@ABCDE.onmicrosoft.com";
                    user.GivenName = "John";
                    user.Surname = "Doe";
                    user.DisplayName = "John DoeUK";
                    user.UserPrincipalName = userPrincipalName;
                    user.AccountEnabled = true;
                    user.MailNickname = userPrincipalName.Split("@".ToCharArray())[0];
                    user.PasswordProfile = new PasswordProfile();
                    user.PasswordProfile.Password = "P@ssw0rd!";
                    user.PasswordProfile.ForceChangePasswordNextLogin = false;
                    user.UsageLocation = "GB";

                    graphConnection.Add<User>(user);


I get the following error after adding a new user by the code above:

JsonConverter AadJsonConverter on Microsoft.Azure.ActiveDirectory.GraphClient.ChangeTrackingCollection`1[Microsoft.Azure.ActiveDirectory.GraphClient.GraphObject] CreatedObjects is not compatible with member type ChangeTrackingCollection`1.

I corrected it once by using graphConnection.Add<User>(user) instead of graphConnection.Add(user) both now seem to be not working. The weird thing is. The user gets added to the AAD.


Mark Perry


Viewing all articles
Browse latest Browse all 16000

Trending Articles