• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

How to SharePoint form library permissions based on form information

Hi Experts, I've built an InfoPath form that I published to a SharePoint forms library.  As part of my form I have a 'Status' drop box with the entries: Planned, In Progress, Complete, Canceled.  Based on the 'Status' value of the form I need to be able to set permissions as follows:
   Planned = Editable by everyone
   In Progress =  Editable by the assigned person (another field in the form) and by the admin - Read Only to everyone else
   Complete & Canceled = Editable by the admin - Read Only to everyone else

I know this is sort of like a work flow, but I don't have the option to develop a custom WF and promote it to the production server - I was hoping it might be possible to accomplish this through code on my form.
1 Solution
Justin ImesFull Time SharePoint JediCommented:
my first thought was sharepoint designer, the workflow wouldn't be too complicated, but you will need this add on to accomplish it.

This is not a "true" permissions solution since someone may still be able download the xml, edit it manually and upload it with overwrite. In that case it is certainly not an accident and if versioning is turned on you should be able to address.

Since you are not afraid of code, if you store the currently assigned user in the form you can try this:

Attach a on changing event to the root node of the form.
Compare your criteria inside this method using if statements. If the change needs to be denied, you can cancel the change and display a message box.

Check out the code snip for canceling the change.

You may also do this with Submit rules if you use a submit button rather than letting people save the form direct.
public void rootNode_Changing(object sender, XmlChangingEventArgs e){

e.CancelableArgs.Cancel = true;
e.CancelableArgs.Message = "You may not edit";

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now