SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have given SPUser user1 permission to only SPFolder I dont want to give read access to specific site or document library.

suppose there is one web and i want to give permission to only Folder Test which exist on Shared Documentscode worked fine as expected but when user logged to sales site.Add Document link is disappear on Test folder of doc lib.

Here is code:

                SPUser AssignedUser1 = oweb.SiteUsers["i:0#.f|aspnetmembershipprovider|user1"];
                if (AssignedUser != null)
                    SPRoleDefinitionCollection WebRoles = salesweb.RoleDefinitions;

                    SPRoleAssignment roleAssignment = new SPRoleAssignment(AssignedUser);
                    roleAssignment.RoleDefinitionBindings.Add(WebRoles["Full Control"]);
                    #region Assign Role To Requirement List.

                    SPList olist = salesweb.Lists["Shared Documents"];

                    // get a reference to the folder (this assumes path points to a valid folder)
                    SPFolder folder = salesweb.GetFolder(olist.RootFolder.Url + "/Test");
                    if (folder.Exists)
                        SPListItem item = folder.Item;
                        if (!folder.Item.HasUniqueRoleAssignments)
                            folder.Item.BreakRoleInheritance(true); // Ensure we don't inherit permissions from parent


see below screenshot after logged user1 to sales site.

enter image description here

i can able to add documents using ribbon toolbar to the folder. but can't see Add document link to the user1.

Hows to solved it?

share|improve this question

If you need to get the add document link. Click on the top Right of the web part and choose Edit Web Part. In the List Views types on Toolbar Type Choose Full Toolbar or Summary Toolbar. Hope this helps.


share|improve this answer
Hi. but actully full access users can able to see the Add Document link. – Jigs Apr 2 '13 at 6:33
Hi. Yes full users can be able to see the add document. In cases like if it is not available you could follow the above method. – Prasath Sivagnanam Apr 2 '13 at 6:41
I have tried. No luck :( – Jigs Apr 2 '13 at 6:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.