Skip to content

Can we add users, sharepoint groups, Office 365 groups & Security groups using ListItemAllFields.AddRoleDefinitionAsync() #1103

Answered by jansenbe
mvcsharepointdev asked this question in Q&A
Discussion options

You must be logged in to vote

@mvcsharepointdev : you can add all, you just need to ensure the "user" first. See https://pnp.github.io/pnpcore/using-the-sdk/security-users.html for more details. So for example before you can use an Azure AD group you do

var myGroupToUse = await context.Web.EnsureUserAsync($"c:0t.c|tenant|{groupid}");

Then you use myGroupToUse.Id to actually add the group

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mvcsharepointdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants