Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 http://contoso.com/sales 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
                        }
                        folder.Item.RoleAssignments.Add(roleAssignment);
                        folder.Item.Update();
                    }
                    #endregion

                }

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

1 Answer 1

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.

Thanks.

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 S Apr 2 '13 at 6:41
    
I have tried. No luck :( –  jigs Apr 2 '13 at 6:49

Your Answer

 
discard

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.