I am trying to remove all permission when an item is created. I am using the code
fd.spSaved(function (result)
{
var id = result.Id;
var myfilter = "ID eq " + id;
var lines = pnp.sp.web.lists.getByTitle("Bid Type Lines");
lines.items.filter(myfilter).get().then(function(items)
{
alert(items.length);
for (var i = 0; i < items.length; i++)
{
lines.items.getById(items[i].Id).unshare();
}
});
});
This is removing the permission if I am submitting the form with full permission user(owner) but if I submit the form with a different user that has read-write access its not removing the permissions. The code is working I am getting the alert message as well.
My assumption is it needs full permission so can anyone confirm is it like that or not?
This works fine and removes the permission but the list from which I am trying to remove the permissions is a list or library control in plumsail. So If I am inserting record directly in the list its works all the time but If I insert a record using list or library control the flow doesnt trigger and sometimes it does. All I can think is because of list or library control this is happening.