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

Adding User via C#; How Do You Add Data To Role Fields

$
0
0

I am using the standard code to add a user to AAD via #C. I noticed I can fill in most fields.

How do I select for Organizational Role and add text for Alternative Email Address?

            try
            {

                AuthenticationResult authenticationResult = authenticationContext.AcquireToken(resource, clientCred);
                accessToken = authenticationResult.AccessToken;

                graphConnection = new GraphConnection(accessToken, ClientRequestId, graphSettings);


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

                    userPrincipalName = "John.Doe@aaa.onmicrosoft.com";
                    user.GivenName = "John";
                    user.Surname = "Doe";
                    user.DisplayName = "John Doe";
                    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 = "US";
                    User NUser = graphConnection.Add<User>(user);


Mark Perry


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>