Doruk Han
Doruk Han

Reputation: 49

Microsoft Graph userprincipalname C#

I am trying to auto increase the number after _ on userprincipalname but it dosen't works.

My code: https://gist.github.com/Erraticoye/b52e4e92102d80cc0349dbb297a93e79

Sorry for bad English. I tried try and catch(you can see in the code)

Upvotes: 1

Views: 107

Answers (2)

Palas
Palas

Reputation: 46

Had a quick look at your code. Seems you initialize the "i" variable in line 49 after a foreach loop.

Have you tried initializing the "i" variable at the beginning of your code and then have the foreach increment the value?

Or just move the int i = 2; before line 42 at least?

My guess is that the number is always 2 after the underscore.

Upvotes: 2

Mehtab Siddique
Mehtab Siddique

Reputation: 655

If you are looking for the changing the password or updating it, the following code:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var currentPassword = "xWwvJ]6NMw+bWH-d";

var newPassword = "0eM85N54wFxWwvJ]";

await graphClient.Me
    .ChangePassword(currentPassword,newPassword)
    .Request()
    .PostAsync();

For more information: https://learn.microsoft.com/en-us/graph/api/user-changepassword?view=graph-rest-1.0&tabs=csharp#request

Hope this helps.

Upvotes: 0

Related Questions