Hot answers tagged

12

To get claim for All Authenticated Users in PS you need to use: $claim = New-SPClaimsPrincipal -EncodedClaim "c:0(.s|true" for windows users (NT AUTHORITY\authenticated users): $claim = New-SPClaimsPrincipal -EncodedClaim "c:0!.s|windows" and for all forms authenticated users (basic asp.net membership provider) $claim = New-SPClaimsPrincipal ...


4

Check this out: public static bool IsUserInRole(SPUser user, SPWeb web, string roleName) { SPPermissionInfo info = web.GetUserEffectivePermissionInfo(user.LoginName); SPRoleDefinition roleDefinition = web.RoleDefinitions[roleName]; foreach (SPRoleAssignment roleAssignment in info.RoleAssignments) { ...


3

Reseting role definitions could possibly lead to an inconsistency if new definitions have been added and used in assignments. That's why, I presume, you canno't revert définitions without also reverting assignments. I checked in the SharePoint OM assemblies, and even internally there's no method to revert defintions only...


3

It is tricky, and I think there is no straight forward way to retain the unique permissions when you roll back to inherit parent's permissions. If you read and compare the definitions of SPWeb.BreakRoleInheritance and SPWeb.ResetRoleInheritance You will notice that SPWeb.ResetRoleInheritance has no parameters to pass where we can instruct SharePoint to ...


3

Answer to both of your question is - no, from msdn breaking role inheritance means - "role assignments on the parent object no longer apply to the child object, for example, so that role assignments on a list no longer apply to a list item." So permission granted on the document library (parent object in your case) never overrides the item level permission ...


2

It is automatically configured by the prerequisites installer.


2

Simple answer of this question is: Farm Administrator is the father and Site Collection administrators the kids. Farm Administrator have full control on SharePoint farm; can create services applications, Web Application, manage quota, deploy solutions, configure the farm level settings, run PowerShell scripts etc. While site collection administrators, only ...


2

The URI for a claim that specifies the role of a Windows user Admin,Manager or A list of all groups that the user is a member of . A claim as a piece of identity information (for example, name, e-mail address, age, or user role). The more claims your application receives, the more you know about your user. To understand more about the claims you need to ...


2

Following example shows how to break role inheritance of a list item and give current user Contribute permissions to the item. var siteUrl = '/sites/MySiteCollection'; function breakSecurityInheritanceAddUser() { var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('MyList'); var itemId ...


2

Here is a sample code to get the groups in Silverlight app by calling the GetGroupCollectionFromUserAsync method of UserGroup.asmx web service. http://www.innovawiz.com/get-the-sharepoint-groups-a-user-is-part-of-using-sharepoint-object-model


2

Maybe you can try different approach. You can secure application in page code rather to alter/add web.config file(s). This link is bit old but for general info will be ok: http://msdn.microsoft.com/en-us/library/dd878359(v=office.12).aspx#SecuringAppPages_ValidatingUserPermissions I still have few scars left from my last fight with Sharepoint web.config.


2

Site owner can not view site from Viewer's angle. Your given permission must be appeared whenever you login in a site. When I test permission in sites, I used to create several users like Editor, Reader, Admin and so on.


2

You could consider the following solution to get permission levels/roles: get the effective permissions that the specified user using /_api/web/getusereffectivepermissions endpoint determine user roles using SP.BasePermissions.has(perm) Method JavaScript example function getUserEffectivePermissions(webUrl,accountName) { var endpointUrl = webUrl + ...


2

Microsoft.sharepoint.client.folder does not have property for "BreakRoleInheritance" You can use as below to break permission inheritance $RootFolder.ListItemAllFields.BreakRoleInheritance($true,$false) Hope it will help to you.


2

You should use microsoft.SharePoint.Client.RoleDefinitionBindingCollection instead of Microsoft.SharePoint.Client.RoleAssignment. Try below snippet (Not tested but will give you idea of what all steps are required): # Get the list by Title and load. $web = $ctx.Web $list = $web.Lists.GetByTitle("Quiz") $ctx.Load($list) # Load in list of groups on the ...


1

Using csom PowerShell you can try below function to give a group your desired permissions it uses Microsoft.SharePoint.Client.RoleDefinitionBindingCollection and Microsoft.SharePoint.Client.RoleType to get role types. function Set-PermissionsOnList() { param( [Parameter(Mandatory=$true)][string]$url, ...


1

After further investigating I found that Notes is a property of the SPUser class. Thus, following would work: var spRole = new SPRoleAssignment("domain\\name", "abc@xyz.com", "name", "notes for user"); var spUser = (SPUser)spRole.Member; var notes = spUser.Notes;


1

There is no way to edit the maxUrlLength for Sharepoint Online as this is a value in the web.config which you don't have access to. To answer your question: No, you can't change the maxUrlLength configuration. Possible steps to take: See if you can include data in the request body, like this. Use the GetFileById route, like this. As for the error code, ...


1

OOTB he can't, the best option is to have a test account(s) for this purpose where you can log into a PC or run browser sessions as that dedicated test account and get the same experience as the other users. He only has the option to go through lists and libraries looking for broken permissions and doing effective permission lookups.


1

This happens because web has not been loaded. Load the web i.e. context.Load(currentweb);. Finally Load the RoleAssignmentCollection and then execute query before looping through them. Example: RoleAssignmentCollection roleAssignment = currentweb.RoleAssignments; context.Load(roleAssignment); context.ExecuteQuery(); for (int i = roleAssignment.Count - 1; i ...


1

Yeah, It is possible in Sharepoint. Follow my answer here : Set Offline Client Availability of sharepoint document library You have to set Offline Client Availability to No


1

There can be some attributes missing for the groups/users. Cross check the properties of the group along with other groups. Is it custom permission level defined group which is throwing this exception?


1

Of course, I have changed ever web.config in the c:\InetPub\wwwroot folder (and subfolders) Actually, starting from SharePoint 2010, they have several additional web.config files in 14 hive. If error is happening under _layouts folder, you will need this web.config: C:\Program Files\Common Files\Microsoft Shared\Web Server ...


1

Why don't you explore possibilities of SharePoint Web services? I think you can reach your goal much easier by using web services then by using Client Object Model. Take a look at UserGroup Web Service and its method UserGroup.GetRoleCollectionFromUser Method. I believe this method to be exactly what are you looking for. Here you can find one example: ...


1

You are doing everything correctly, and I can confirm that with the proper setup you are able to add roles to SharePoint groups. If you are getting the red underline, then most likely it is an issue with your web.config files: Make sure that the RoleManager web.config entry is in your: Application web.config Central Admin Web.config Secure Token Service ...


1

I've read an article on MSDN, that suggests using SPRoleDefinitions, and verify at Page_PreLoad, for example, if a user has the required roles to access the page, and if not, redirect him to accessdenied.aspx. The same could be done for the actions within each page. However, this solution would require me to drop AD Groups, and store users and ...


1

I ended up with a solution loosely based on the concept of Role Definitions presented here. Here's a brief description of how this was implemented. For every AD Security Group, create an SPGroup, whose sole member is the corresponding directory group. Then, create an SPRoleDefinition for each required page access, e.g., Page_1.aspx - Read, and an ...


1

I create one method that works for me. This method must be called within SPSecurity.RunWithElevatedPrivileges method private void CopyRoles(SPListItem source, SPListItem taget) { if (!taget.HasUniqueRoleAssignments) taget.BreakRoleInheritance(false); for (int i = taget.RoleAssignments.Count - 1; i >= 0; i--) ...


1

I don't see anything evidently wrong with that code. Can you try "AllowingUnsafeUpdates" before doing the whole operation? Such as: web.AllowUnsafeUpdates = true; Also: were you able to debug into this piece of code? Does everything run as expected? Here are some things that you would want to check: . The group does exist . It finds the contributor ...



Only top voted, non community-wiki answers of a minimum length are eligible