Hi everybody,
I have an Office365/SharePoint online environment and I need to break role inheritance when document is uploaded to a Document Library. I'm using a Remote Event Receiver for ItemUpdated event because roles are assigned depending on the metadata of the document.
(ContentType).
It works fine, except because the item not only change role to the document, it changes document library roles too.
So, a few questions:
- The first, and most important, a Remote Event Receiver is the best approach to do what I need? People point me not to use RER and to use WebJobs or Remote Timer Jobs instead.
- I only break role inheritance using the SPListItem ID, so, how can be modified if I only use this block of code:
Utils.ExecuteWithTryCatch(() =>
{
modifiedItem.EnsureProperties(w => w.HasUniqueRoleAssignments);
if (!modifiedItem.HasUniqueRoleAssignments)
{
modifiedItem.BreakRoleInheritance(false, false);
}
});
Any help would be appreciated,
Thanks in advance!