Do i need to Issue ListItem.Update(), when i am executing these commands ( ListItem.ResetRoleInheritance() + ListItem.RoleAssignments.Add() )

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/286116

문제

I am working on a remote event receiver inside SharePoint online custom list. now inside the RER i am getting the item been updated, then reset its role inheritance + add users to the item permission, as follow:-

projectItem.ResetRoleInheritance();
projectItem.BreakRoleInheritance(false, false);
projectItem.RoleAssignments.Add(oUser, new RoleDefinitionBindingCollection(context) { readerDef });
FieldUserValue[] approvers = projectItem["Approvers"] as FieldUserValue[];
                    foreach (FieldUserValue user in approvers)
                            {
                              User oUser2 = context.Web.EnsureUser(user.LookupValue);
                              context.Load(oUser2);
                              context.ExecuteQuery();
                              projectItem.RoleAssignments.Add(oUser2, new RoleDefinitionBindingCollection(context) { contributeDef });

                             }

now i thought to get the ListItem.ResetRoleInheritance() + ListItem.RoleAssignments.Add() working i need to execute ListItem.Update() at the end.. but based on my test the ListItem.ResetRoleInheritance() + ListItem.RoleAssignments.Add() will be applied without having to execute ListItem.Update().. so is my assumption correct? Thanks

도움이 되었습니까?

해결책

There is no need to add ListItem.Update() when use reset listItem permission.

Official document about ListItem.Update() for your reference:

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ee536748(v=office.15)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top