Domanda

Ok so i've got access to MS Graph app that retrieves users. I already tested it and i can get back a lot of user info from which i have email, ID and others.

Does anyone know of a way to populate a People Picker field in a list using information from MS Graph? I know its doable, but i have no idea how.

AFAIK you can set that field by using lookupid for users that are in a specific site collection, but what i want is a bit general (to be able to set any user in the active directory, which i am retrieving with msgraph).

Can anyone share a code snippet regarding this ? Thanks!

È stato utile?

Soluzione

I'm literally getting into the bad habbit of answering my own questions ffs....

Anyway, the fix is simple, you need to use the username ex :

                    var managerField = FieldUserValue.FromUser(newItem.Manager);

Where newItem.Manager is actually the username (john@something.com) ->

                    var managerField = FieldUserValue.FromUser("john");

Tested it with security groups aswell and it works.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top