Pregunta

I have a custom list. Is there a way to make it so when a user adds a new item they can, in the NewForm.aspx/EditForm.aspx page, specify who can view the item once it is created?

I know they can modify the permissions of the item after it has been created but is it possible to do it from the NewForm/EditForm?

Also, I can't create custom application code. I can only use, if needed, SharePoint Designer (including Workflows) and custom JS.

¿Fue útil?

Solución

This can be done using a Designer WF and REST. The hard part is going to be if you need to allow multiple users to have access. Basically, you will need to add a field to your forms that you can enter the users. A people picker or text field will do. The text field can make it more likely that mistakes will occur, but I think will be easier to parse out multiple users.

The next thing you will need to do is create a new 2013 WF that reads that information and calls the rest service to BreakRoleInheritance and AddRoleAssignment. You are going to need to get the user's ID and the role definition ID. Doing this as a JavaScript file on the form would be easier, but since the item hasn't been created yet in the NewForm, you can't run it there, so your only real option is the WF.

There is a great explanation of the REST information you will need here: http://spsite.pro/Blog/Post/3/SharePoint-2013-REST-API-%E2%80%93-How-to-set-Unique-Permissions-%28Item-Level-Permissions%29

You can also get some great information on running REST from a WF here: https://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/

Hope this helps

Licenciado bajo: CC-BY-SA con atribución
scroll top