Hi,
I've recently begun developing for sharepoint. I've just written an event receiver for a task list in order to grant edit permissions for the item to the user who is entered in the assigned to field.
Unfortunately my code doesn't work, and I think, I've also found the reason.
The list grants by default contribute rights to all users, so that every body can add a task. Under advanced, the item level permissions are set, so that all users can read all items, but they can only edit their own items.
When I create an item and check it permissions now, every user is already listed with contribute rights. They can also go to the edit form, but on submitting the updated item, a permission error is displayed.
And that is the point I'm stuck. If the users are already listed as contributors, but still can't change the item, what can I do to allow it?
I know how to add rights and brake role inheritance programmatically, but as contributors aren't allowed to update foreign items, it is useless.
My currently idea is: Under advanced, set edit access to "all items" and in the event receiver, in the ItemAdded event, breaking the role inheritance, adding the creator and "assigned to" user with contribute rights and the rest with read permissions.
But as the role inheritance is broken, what happens with new users? The will not be able to see tasks which were created before they joined the task list, I think. Also I'm unsure what performance issues it will cause.
Andy advices?