Skip to main content
 
Go Search
Home
Categories
Bloggers
Item-level permissions on document libraries and issue lists in WSS 3.0
By: Matt Morse | Posted: April 30, 2007 at 2:31 PM
One of the cool new features of WSS 3.0 is item-level permissions, and a variation of that capability is carried forward in the "only their own" security setting.
 
In most WSS lists, it's possible to set the list security so that users have access to "only their own" items: each individual may add items to lists and will only be able to view and edit the content that he or she has created.
 
This feature can be found by visiting the List Settings for a list, then clicking on the Advanced Settings link.
 
Only Their Own settings
 
I used this feature recently on a project where the intent for data within a WSS site was not for collaboration, but for a standardized approach to a business problem and easy portability between users (sometimes the data needs to transfer owners).
 
I was amazed, then, when I went to a document library looking for this same setting, and couldn't find it anywhere. I googled and dug around, but felt sure that I was just missing the setting somewhere.
 
Alas, I was not just missing something. Burt came to my rescue with this explanation:
...if you look at the OM for WSS you’ll note that there is an SPDocumentLibrary class, an SPIssuesList class and an SPList class for all other list types.  Also all three classes have getters and setters for the two properties ReadSecurity and WriteSecurity, the properties you set in the UI using the radio buttons.  (So programmatically, you can set these if you need to do so.)
 
OK, so how is it behaving?  Here is the relevant code from the page advsetng.aspx, the page called when the Advanced Settings link is clicked:
 
<!-- Security Settings -->
<asp:PlaceHolder runat="server" id="ItemLevelSecurityPanel">
<wssuc:InputFormSection runat="server">
 
Note the id of the placeholder.
 
And here is the code in the Microsoft.SharePoint.ApplicationPages.dll  for the AdvancedSettingsPage class’s OnLoad event:
 
this.ItemLevelSecurityPanel.Visible = (type != 1) && (type != 5);
 
Where type is the base type of the list. (1=doclib, 5=issues).
So Microsoft went to some effort to explicitly exclude this from the UI (but not the object model) for document libraries and issue lists within WSS. I trust the WSS team's approach from a UI perspective, but I'm glad there's also a way around it. :-)
 
Here was my solution:
 
First, I took a look at MSDN's documentation for the ReadSecurity and WriteSecurity properties; unlike some of the WSS SDK, these items actually show the possible values and the meaning of each.
 
After that, I created a simple command-line utility that runs on the WSS server and allows properties to be set on lists that may or may not be available through the user interface.
 
The syntax of the utility is:
SPSetListProperty <Site URL> <Web URL> <List Name> <Property to Set> <Value for Property>
So to achieve the "only their own" functionality, the usage is something like this:
SPSetListProperty "http://mywssbox" "/TeamSite" "My Documents" "ReadSecurity" "2"
 
SPSetListProperty "http://mywssbox" "/TeamSite" "My Documents" "WriteSecurity" "2"
The commands need only be executed once to configure the list.
 
You can download the utility here, and view the code, if you want. (Disclaimer: this was quick and dirty code and not intended to be exemplary; feel free to improve it in your version...)
 
UPDATE 5/4/2007:
 
Krishnan makes a good point in the comments below. The "only their own" settings control the user interface, but are not truly item level permissions. (Burt reminded me of this misnomer as well.)
 
When opening the list using WebDAV (and via the API I assume, though I did not test this), the documents from other users ARE visible and available to copy, edit, etc. 
 
Another way of saying it is that this is not a replacement for the true item-level permissions that WSS supports. When true item-level permissions are specified, WebDAV and the API do enforce the specified security.
 
Thanks for the heads-up, Krishnan.
dual sim
By: dual sim | Posted: August 20, 2010 at 2:33 AM
http://www.efox-shop.com I read a lot of posts today and yours is the best one i have read ever.I appreciate your attitute more info please visit the web for b2c iphone etc. Ein seltenes Angebot: Im Handy-Shop des Mobilfunkbetreibers E-Plus steht zurzeit das Dual-SIM-Handy Samsung B5722. Das Mobiltelefon für den parallelen <a href="http://www.efox-shop.com"><b>Ciphone</b></a>
dual sim
By: dual sim | Posted: August 20, 2010 at 2:33 AM
http://www.efox-shop.com I read a lot of posts today and yours is the best one i have read ever.I appreciate your attitute more info please visit the web for b2c iphone etc. Ein seltenes Angebot: Im Handy-Shop des Mobilfunkbetreibers E-Plus steht zurzeit das Dual-SIM-Handy Samsung B5722. Das Mobiltelefon für den parallelen <a href="http://www.efox-shop.com"><b>Ciphone</b></a>
CodePlex project provides solution for this
By: Tim Larson | Posted: July 2, 2010 at 11:50 PM
I just put a new codeplex project up that provides a nice drop-down on the list settings that provides the same UI as seen in the screenshot above, but for document libraries. Check it out at http://moresharepoint.codeplex.com.
like this post
By: Been | Posted: May 25, 2010 at 2:54 PM
Useful for me http://www.rsseye.com/ http://www.zadosoft.com/
Item-level permissions on document libraries and issue lists in WSS 3.0
By: Pool | Posted: May 21, 2010 at 5:04 PM
Important article http://www.wortheye.com/
didnt see this permition section on the advance setting
By: ishay | Posted: June 29, 2009 at 11:30 PM
Hi, I have a list on moss site and i didnt see this permition section on the advance setting, i have got full control permition on the list , what is wrong ?
still able to delete documents from other people
By: Tom Depoorter | Posted: June 17, 2009 at 9:32 AM
Hi I've tested the utility. It's doesn't show errors in the dos-prompt, but a normal user is still able to delete documents from other people how is that possible? I've seen that someone else mentioned the same problem on 10 january 2008. But over here the currect value is the value that I indicated. So WriteSecurity is 2. I'm using WSS 3.0
Explorer view
By: vipin | Posted: March 21, 2009 at 6:57 AM
Its not working in explorer view. can neone help ?
New Utility to manage "Only their own" limitation of document libraries/issue lists
By: Mehul Bhuva | Posted: February 13, 2009 at 1:05 AM
Hi, I am a regular follower of this blog and i think it has a lot of interesting take aways each time i visit it. I have developed a utility for handling the above mentioned issue, where you will be able to set security for a Document Library or any kind of Sharepoint list just from this simple Windows Forms utility, download it from here: http://www.codeplex.com/ListSecurityManager
By: shady | Posted: January 23, 2009 at 10:30 AM
thanks matt , ill look into it as im still ZERO in programming with SPS hehe , but im reading some books now and then ill give a try thanks alot for ur fast response :)
Permissions in workflow
By: Matt Morse | Posted: January 22, 2009 at 10:01 AM
Hi Shady, I think your best bet is to set item-level permissions on each SPListItem, rather than setting a property on the list (which is what I blogged about here). Try this link for getting started: http://ajaymatharu.wordpress.com/2008/11/07/set-item-level-permission-in-sharepoint-through-coding/. Hope this helps. --Matt
how to do that in MOSS
By: Shady Hajjar | Posted: January 22, 2009 at 2:23 AM
hi there can you show me how to do that in moss ? what im trying to do is im creating a doc that is attached with a workflow , once the item is created i just want me and the approvers to see that document ! , how can that be done ? any help please :(
Great Fix
By: Chris | Posted: October 23, 2008 at 2:54 AM
Great tool it worked a treat, pingback http://homercles.wordpress.com/2008/10/21/item-level-permissions-on-document-libraries/
How to edit method in Microsoft.SharePoint.ApplicationPages.dll
By: Stella | Posted: March 19, 2008 at 7:15 AM
In your explanation you describe: And here is the code in the Microsoft.SharePoint.ApplicationPages.dll for the AdvancedSettingsPage class’s OnLoad event: this.ItemLevelSecurityPanel.Visible = (type != 1) && (type != 5); How can I edit this command line, so I can use Permission Level for documents library.
Unable to get values to change when I run the command
Posted: January 10, 2008 at 3:13 PM
Hello, I ran you tool and it looks like it works, I get the output saying the value has changed from 1 to 2. I tried to see if the fix was working, and I was still able to delete items that were not mine. I then thought I had to do an IIS reset, same result. I then tried to set the vaule back to default since it was not working, and I got current value 1 new value 1 which led me to believe that the tool was not resetting the value. Let me know if you need more information or if I have done something wrong. Here is the cmds I used. SPSetListProperty "http://SiteURL" "/" "HD Request" "ReadSecurity" "2" SPSetListProperty "http://SiteURL" "/" "HD Request" "WriteSecurity" "2" I am running MOSS2007 SP1. Thanks,
Microsoft.SharePoint.SPException: "http://bhaskar-4o6b0zz:406/sites/Cricket/default.aspx" contains illegal character ':'.
Posted: December 16, 2007 at 10:59 PM
Hi , i'm trying to get SPweb properties in that process i got Exception like this: Can anybody help me on this issue...plz Exception Details: Microsoft.SharePoint.SPException: "http://bhaskar-4o6b0zz:406/sites/Cricket/default.aspx" contains illegal character ':'. Source Error: Line 23: { Line 24: SPSite mysitecollection = new SPSite("http://bhaskar-4o6b0zz:406"); Line 25: SPWeb site = mysitecollection.AllWebs["http://bhaskar-4o6b0zz:406/sites/Cricket/default.aspx"]; Line 26: Label1.Text=site.AllowAnonymousAccess.ToString();
How to use this Command line property
Posted: November 25, 2007 at 7:31 PM
Hi, Iam new to sharepoint and i want to set the document library permissions so that user who uploaded can only view the documents. I tried to run the utility command under 12/bin folder but i am getting the error "SPSetListProperty is not recognized as internal or extenal command,operable program or batch file". Can you help me to run this utility. Thanks in advance.
How to use this Command line property
Posted: November 25, 2007 at 5:53 PM
Hi, Iam new to sharepoint and i want to set the document library permissions so that user who uploaded can only view the documents. I tried to run the utility command under 12/bin folder but i am getting the error "SPSetListProperty is not recognized as internal or extenal command,operable program or batch file". Can you help me to run this utility. Thanks in advance.
How to use this Command line property
Posted: November 25, 2007 at 5:50 PM
Hi, Iam new to sharepoint and i want to set the document library permissions so that user who uploaded can only view the documents. I tried to run the utility command under 12/bin folder but i am getting the error "SPSetListProperty is not recognized as internal or extenal command,operable program or batch file". Can you help me to run this utility. Thanks in advance.
Not Happening for WriteSecurity property
Posted: August 14, 2007 at 7:44 AM
I have to restrict users from editing others Documnets. I have tried your exe It is working for ReadSecurity property. I have used SPSetListProperty "http://ServerName:1500/" "/" "Test Abhi123" "WriteSecurity" "2" command but it is allowing other users to edit the properties. I have Given Add,Edit permision on the document Library to Everyone. Please suggest If I am missing anything. Do I need to change anyPermission on Library? Suggest. If possible send mail to abishek.agrawal@hcl.in
Not Happening for WriteSecurity property
Posted: August 14, 2007 at 7:24 AM
I have to restrict users from editing others Documnets. I have tried your exe It is working for ReadSecurity property. I have used SPSetListProperty "http://ServerName:1500/" "/" "Test Abhi123" "WriteSecurity" "2" command but it is allowing other users to edit the properties. I have Given Add,Edit permision on the document Library to Everyone. Please suggest If I am missing anything. Do I need to change anyPermission on Library? Suggest. If possible send mail to abishek.agrawal@hcl.in
That worked great!!
Posted: May 4, 2007 at 5:14 PM
Thanks Matt. That worked great!! It would be great if there is any way to reflect the permissions to the 'Explorer View' as well. Thanks again for this handy tool.
Illegal character in web URL
By: Matt Morse | Posted: May 4, 2007 at 3:03 PM
Hi Krishnan, The exception you're getting is because the utility expects the first argument to be the full URL to the site collection and the second argument to be relative to the site collection URL. Use an empty string to use the web that's at the root of a site collection. In your example, try this syntax: SPSetListProperty "http://mywssbox/sites/test" "" "test" "ReadSecurity" "2" Hope this helps. Thanks, Matt
Files exposed in Explorer View
Posted: May 4, 2007 at 2:55 PM
Though the SharePoint UI hides the files, the Explorer View (WebDav) exposes the files.
Web URL has illegal character ':'
Posted: May 4, 2007 at 12:01 AM
Thanks for the tool. I tried the following command, SPSetListProperty "http://mywssbox" "http://mywssbox/sites/test" "test" "ReadSecurity" "2" but got an error saying, "Unhandled Exception: Microsoft.SharePoint.SPException: "http://mywssbox/sites/test" contains illegal character ':'." Please help me to reolve this error. Thanks.
 

 About Matt Morse

Practice Manager - SharePointMatt Morse is a practice manager for PointBridge. He has over 10 years of experience in application architecture and development, working in a variety of industries, including banking, manufacturing, ... [more]

 Tag Cloud

 My Articles

 ‭(Hidden)‬ Admin Links