What if permissions should be set by SPD Workflow in SharePoint?

If you store data in your sharepoint lists which should only be accessible by specified users you can use the item permissions. But if you have to do it manually for each item, your endusers won’t be amused. So i’d like to share a possiblity how you can do it automatically. Your enduser only has to fill a field which person should have (in my example Read) permissions on this item. It is an easy small example which you can use as basic for further enhancements.

Here is the example:

permissions16

Your enduser inserts the data and set the person sales and me to read access. In the normal way the security for the item looks like this:

permissions17

But after my workflow finished it will look like this:

permissions18

As you can see me and Mr. Sales were added with Read permissions and the item has unique permissions. That’s looks really easy for your enduser and in the next steps i’ll show you that it is also easy for you.

Step 1: Create a workflow for your list – in my example it’s Sales Data

permissions1

Then we add a name and a description (or not)

permissions2

Step 2: Add an Impersonation Step and delete the default one

First add a new step called Impersonation step, then delete the old one. That’s because the enduser may not have permissions to change the permissions. In that case the step is running with credentials from the author of the workflow.

permissions3

Step 3: Add Action “Add List Item Permissions”

permissions5

Step 4: Configure the permissions:

Set the item as current item and the add permissions.

permissions6

Click on add.

permissions7

Use Workflow Lookup for a User… there you can choose from which field it should look up the username.

permissions10a

The usernames come from this item of the field Read Access. Important here is to return the field as “As String”!

permissions9

Step 5: Publish and Test

permissions11

After publishing you can start the workflow on your item and see the results.

permissions13

After your workflow finished you should get the same result as the screens at the top of this post. It makes sense to let the workflow start automatically.

Extra Tip

If it also starts if item is changed, maybe you have to insert the step “Inherit parent permissions”. This trick helps if someone changed the user in the field. With inherit parent permissions it will be set like it was at creation time, after that it will set the new permissions.

Hope you like it.

..:: I LIKE SHAREPOINT ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.