Author: amitvasu
Updating List Template after Saving List as Template
REST API How To: Get specific user permission for specific item in Sharepoint 2013
I have been spending some time with REST APIs when working with SharePoint 2013. Today I am going to share with you some RESP API code samples related to getting SharePoint Site/List/List Item permissions using the REST API.
To get permission for specific site for particular user you can use
http://intranet.contoso.com/_api/web/getusereffectivepermissions(@user)?@user=%27i%3A0%23%2Ew%7Ccontoso%5Cbrianc%27
Here the username is in this format i:0#.w|contoso\brianc for Windows Claims. This will change for SAML Claim
To get specific list permission for particular users you can use
http://intranet.contoso.com/_api/web/lists(guid’F27BDE7D-340F-43F4-B606-D24E02D0D01C’)/getusereffectivepermissions(@user)?@user=’i%3A0%23%2Ew%7Ccontoso%5Cbrianc’
And finally to get permission for a list item for particular user you can use
http://intranet.contoso.com/_api/web/lists(guid’F27BDE7D-340F-43F4-B606-D24E02D0D01C’)/getitembyid(16)/getusereffectivepermissions(@user)?@user=’i%3A0%23%2Ew%7Ccontoso%5Cbrianc’
Over next few months I will be sharing few more blog posts on REST API HOW TO Series.
Cheers.
SharePoint Saturday Boston – 2014
Last Saturday, on April 12th, I presented at the SharePoint Saturday Boston 2014. This was my first time speaking at SharePoint Saturday Boston.
The event was at Microsoft Boston office and I must say it was a great venue.
PowerShell How to: Get Audience membership for a User in a Web
If you want to get Audience membership for a particular user then you can use GetUserAudienceIDs method. In this method you can pass the UserName of the user.
I have wrote a sample PowerShell script to achieve this.
$site = Get–SPSite “http://SharePoint-2013”
$web = $site.Openweb()
$context = [Microsoft.Office.Server.ServerContext]::GetContext($site)
$audMgr= new–object Microsoft.Office.Server.Audience.AudienceManager($context)
[System.Collections.ArrayList]$audIDNames = audMgr.GetUserAudienceIDs(“Contoso\\Garthf”, $true, $web);
$audNameID = new–object Microsoft.Office.Server.Audience.AudienceNameID()
for ($i=0;$i –lt $audIDNames.Count; $i++)
{ Write–Host $audIDNames[$i].AudienceName }
SharePoint and Permissions for Style Resource Readers Group
This one is interesting as someone asked me this question as to what permission does the Style Resource Readers group need access to?
Here is what you need to know about style resource readers group.
When you create a new site collection SharePoint assigns the required permission to Style Resource Readers group. By default it will read Limited Access. You do not need to modify anything with Style Resource Reader group unless you are planning on adding users to that group. Personally I will advise against it.
Limited Access in SharePoint means that there are permission assigned to a user or group on one or more site artifacts i.e. list, folder, item but no permission is assigned to access site.
So Style Resource Readers group out of the box has the Read permission to master page gallery. If you read the description it reads.
“Members of this group are given read permission to the master page gallery and the Restricted read permission to the Style Library. By default, all authenticated users are a member of this group.”
So don’t worry about this group and leave it as is given SharePoint already assigned required permission at the master page gallery and style library level for this group.