Saturday, 6 December 2014

How to get all the permission levels in SharePoint 2010



In this article we will be seeing how to get all the permission levels in SharePoint 2010 using C# and powershell script.

In this article

  • How to get all the permission levels using C#
  • How to get all the permission levels using powershell script
  • Properties of SPRoleDefinition
Steps involved:
  • Open Visual Studio 2010.
  • Create a console application.
  • Add the following reference.

    o Microsoft.SharePoint.dll
     
  • Add the following namespace.

    o Using Microsoft.SharePoint;
How to get all the permission levels using C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace CustomPermissionLevel
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://servername:2020/"))
            {
                using (SPWeb web = site.RootWeb)
                {
                    SPRoleDefinitionCollection roleColl = web.RoleDefinitions;
                    foreach (SPRoleDefinition role in roleColl)
                    {
                        Console.WriteLine(role.Name.ToString());
                    }
                    Console.ReadLine();
                }
            }
        }
    }
}
tagged1.gif

How to get all the permission levels using powershell script

$site=Get-SPSite "http://servername:2020/"
$web=$site.RootWeb
$roleColl=$web.RoleDefinitions
foreach($role in $roleColl)
{
write-host $role.Name
}
Properties of SPRoleDefinition:

$site=Get-SPSite "http://servername:2020/"
$web=$site.RootWeb
$roleColl=$web.RoleDefinitions
$role= $roleColl["Custom Permission Level Test"]
Write-host $role
tagged2.gif


Reference:

http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-get-all-the-permission-levels-in-sharepoint-2010/

How to Set Item Level Permission Using SharePoint Designer 2010 Work Flow



There are situations where we want to set item level permission dynamically whenever an item is added to a SharePoint list. Here we can see a demo of a SharePoint designer workflow to achieve the same.

Here I am taking the scenario, when an item is added to the list I want to set the permission only to the user who created it and to the owners of the list. In SharePoint 2007, we have to go for an event handler but in SharePoint Designer 2010, we can write a custom workflow to do it.

1. For the startup I have created a list as shown in the following, named Ticket:

WrkShr1.jpg

2. Open the SharePoint designer and click on the work flow and select the list (Ticket):

WrkShr2.jpg

3. Give a name to the work flow:

WrkShr3.jpg

4. Select Impersonation from the ribbon as shown below:

WrkShr4.jpg
5. You will get a screen like below:

WrkShr5.jpg

6. Select Action from Ribbon and choose Replace item level permission from the menu:

WrkShr6.jpg

7. You will get a screen like as shown below. Click on the order as I show in the figure:

WrkShr7.jpg


8. You can click on Add to add owners also to the list:

WrkShr8.jpg

9. We are done with the workflow. Now we can test our workflow. I am just adding an item to test the work flow:

WrkShr9.jpg


10. Click on the item we created now and select manager permissions:

WrkShr10.jpg


11. You can see the Owner group and the user who created the item is added to the permission of the item and all other users and groups are removed from that particular list item:

WrkShr11.jpg
 



Reference:

http://www.c-sharpcorner.com/UploadFile/Roji.Joy/how-to-set-item-level-permission-using-sharepoint-designer-2/

SharePoint Permissions


Before reading this article, please go through the following article:
  1. SharePoint Permissions - Important Aspects

In this article we can explore the Permissions tool bar items. Please note that this article is a part of an article series. The following is the Site Permissions screen accessible from the Site Actions menu.

SharePoint-Permissions1.jpg

Now let us explore each menu item.

How to Grant Permissions?

For assigning permissions to a user or group, you can use the first menu item Grant Permissions.

How-to-Grant-Permissions.jpg

You can enter the user name and check the required permission levels in the dialog.

How-to-Grant-Permissions1.jpg

How to create SharePoint Group?

For creating a SharePoint Group, use the second menu item named "Create Group".

How-to-create-SharePoint-Group.jpg

Microsoft recommends using SharePoint Groups, instead of directly assigning permissions to users. You can enter the group name, description & Group Owner in the dialog.

How-to-create-SharePoint-Group1.jpg

How to Edit Permission?

For editing a permission assigned, select the permission item & click the "Edit User Permissions" item.

How-to-Edit-Permission.jpgHow-to-Remove-Permission.jpg

You can check / uncheck the permission levels in the edit dialog.

How-to-Edit-Permission1.jpgHow-to-Check-Permission.jpg

How to Remove Permission?

For removing a permission assigned, select the permission item & click the "Remove User Permission" item.

How-to-Remove-Permission.jpg

How to Check Permission?

For checking the permissions assigned to a user or group, you can use the Check Permissions item.

How-to-Check-Permission.jpg

How to create Custom Permission Levels?

For creating custom permission levels, you can use the Permission Levels item.

Custom-Permission-Levels.jpg

How to Manage Access Requests?

For automating Access Requests, the Manage Access Requests item can be used.

Manage-Access-Requests.jpg

In the dialog you can enable the request for access feature. Requests will be forwarded to the email specified.

Manage-Access-Requests1.jpg

How to Set Site Collection Administrators?

Multiple site collection administrators can be set through the Site Collection Administrators item.

Set-Site-Collection-Administrators.jpg

We can add multiple site collection administrators without going to Central Administration.

Set-Site-Collection-Administrators1.jpg

References

http://bit.ly/10uiVpB 

Summary

In this article we have explored the toolbar items of Permissions.

Reference:

http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-permissions-part-2-of-3/

SharePoint Permissions - Important Aspects


Nice Article by Jean Paul on permissions in Sharepoint


In this article I am trying to reveal the important permissions aspects of SharePoint 2010. Please note that this will be a subset of Security.

SharePointPermissions1.jpg

Here you can learn the associated jargons of Permissions.

What is Permission?

Permission is the term used to describe a secured action. Some of the Permissions are:

  • View Item
  • Open Site
  • Read Item
  • Delete Item
Why are Permissions needed in SharePoint?

Since SharePoint is a sharing & collaborative platform, without permission the usage will lead to inappropriate data, file sharing issues, content manipulations etcetera.

What are the Permissions Types?

In SharePoint there are 2 types of Permissions:

  1. Unique
  2. Inherited
The Unique Permission (Custom Permission) is assigned for a particular securable object like site collection. Inherited Permission is the ones inherited from its parent. Inherited Permission is easier to manage, but Unique Permissions gives more granularities in control.

Often the terms Break Permissions & Break Inheritance are also used to define Unique Permissions. This is because we use the Break Permissions button on the particular item to provide unique permissions.

How to set Permissions?

For setting site permissions use the "Site Actions" > "Site Permissions" menu item:

SharePointPer2.jpg

For setting list permissions use the "List" tab > "List Permissions" button:

SharePointPer3.jpg

For setting item, document, folder permissions right-click and in the context menu select the "Manage Permissions" menu item:

SharePointPer4.jpg

What are Permissions Levels?

Permission Levels are a group of Permission Items. We can associate a Permission Level to a user. Three of the pre-existing & most commonly used Permission Levels are:

  1. Full Control
  2. Contribute
  3. Read
Permission Levels provide easier manageability through grouping of Permissions. We can also create custom permission levels.

What is SharePoint Group?

A SharePoint Group is a group of users. Grouping multiple users into a single group is the recommended way from Microsoft. By default, SharePoint groups are not nestable. (In contrast with Active Directory groups that are nestable.)
The following are the default recommended groups in SharePoint:

  1. Owners
  2. Contributors
  3. Visitors
We can assign Permission Levels to groups. The recommended permission level to groups is:
  1. Owners group can be assigned Full Control permission level
  2. Members group can be assigned Contribute permission level
  3. Visitors group can be assigned Read permission level
How to assign Permissions?

For assigning permissions, open the permission page.

SharePointPer5.jpg

For granting permission to a particular user, choose the Grant Permissions button. In the dialog that appears enter the user/group name, resolve it, select permission levels & click the "OK" button.

SharePointPer6.jpg

In the permissions page, you will see the new item is added.

SharePointPer7.jpg

What are the securable objects in SharePoint?

The following are the Securable Objects in SharePoint:

  1. Site
  2. List
  3. Library
  4. Item
  5. Document
  6. Folder
SharePointPer8.jpg

SPGroup & SPUser

Inside the Server Object Model, SharePoint Groups are represented through type SPGroup. SharePoint Users (Active Directory User/Group, Windows User) are represented through SPUser.

References

http://bit.ly/YoKoX8

Summary

In this article we have explored an overview of Permissions. In future chapters you will see the Permission Toolbar items, Best Practices & Free Tools to work with Permissions.

Reference:

http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-permissions-important-aspects/

SharePoint Logging: What's New in SharePoint 2010

The Importance of generating audit reports for SharePoint Lists or Libraries


In my previous blog we looked at SharePoint Document Number Generator and SharePoint Bulk Zip & Unzip, which are part of SharePoint Classifier. In this blog we will take a closer look at SharePoint Item Audit Log (which can be purchased separately or also found within our star product, SharePoint Classifier).
Item audit

Ever wonder who is accessing documents or items from your SharePoint? Do your users have correct permission levels? Are you security conscious and want to secure your documents more efficiently? Is your staff being assigned to much or too little work?
how interesting
If the answer is yes to all of these questions, then you definitely need to use SharePoint Item Audit Log. This easy to overlook solution will not solve all of the above problems; instead it will generate logs for analysis and give you documentable evidence and information so that you can take the next step in resolving your issues.

Here are some uses for SharePoint Item Audit Log:
  • As a gauge to ensure permissions have been granted correctly
  • As a security protocol to trace documents that were deleted or restored on your system
  • As a productivity tool to ensure workers are completing assignments on time and are not inundated with work
  • To keep track of which documents are being accessed and by whom
  • To filter and monitor priority documents and document access

Here are some cases where generating an audit log would be helpful
Often permissions may be overlooked or incorrectly given thus users who should not have access to certain libraries or lists may inadvertently be accessing these areas and viewing or changing documents or items. With SharePoint Item Audit Log you can target these users through a simple filtered search and check to see which areas they have been visiting and what documents or items they have been using.
Filter

In any organization there is a risk of users accessing libraries or list with sensitive data and using it for their own purposes. SharePoint Item Audit Log gives administrators evidence of user’s activities; libraries and lists they have visited; and documents and items they accessed, changed or removed. With an audit log, organizations can recover their information and instigate security measures to prevent further loss and damage.
Export

Often documents can be deleted by accident or on purpose. These documents can then later be recovered and restored from the recycle bin. With an audit log, administrators can assess if the correct documents have been disposed of or in the case that a document shouldn’t be deleted, to take measures to restore it. Also, if documents have been deleted and need to remain so, administrators can have a record of users who restore it.
Easy view

Sometimes there are time-critical or important documents that must be used by everyone or a document must be read by everyone in the company, especially changes in policies or procedures. With SharePoint Item Audit Log administrators can generate an audit log to keep track of critical or important documents; or ensure that a document or item has been accessed by users in an organization.

Reference:

http://www.boostsolutions.com/blog/the-importance-of-generating-audit-reports-for-sharepoint-lists-or-libraries/

How to Configure SharePoint 2010 Logs


Logging is one of the most important functions in SharePoint for diagnosing problems. Users can configure log settings in SharePoint 2010 Central Administration site.
To open the Diagnostic Logging page, go to CA->Monitoring->Configure diagnostic logging.

http://www.boostsolutions.com/blog/wp-content/uploads/2012/07/PIC-1-How-to-Configure-SharePoint-2010-Logs1.jpg


I. Event Throttling

Users can control the severity of events captured in the Windows event log and the trace logs with these settings.

http://www.boostsolutions.com/blog/wp-content/uploads/2012/07/PIC-2-How-to-Configure-SharePoint-2010-Logs.jpg

1. Expand any relevant submenus and then select one or more categories of events for which to configure throttling. Throttling controls what events are captured in the Windows events log according to the criticality of the events.
2. After you select the types of events to throttle, perform one of the following actions:
a. Expand the Least critical event to report to the event log menu and then select the type of event that you consider to be least critical for the event log.
Note: Events that are equally critical to or more critical than the selected event will be recorded in the Windows event log. The list entries are sorted in most-critical-to-least-critical order.

http://www.boostsolutions.com/blog/wp-content/uploads/2012/07/PIC-3-How-to-Configure-SharePoint-2010-Logs.jpg

b. Expand the Least critical event to report to the trace log menu and then select the event type that you consider to be the least critical for the trace log.
Note: Events that are equally critical to or more critical than the selected event will be recorded in the trace log. The list entries are sorted in most-critical-to-least-critical order.

II. Event Log Flood Protection

Select the “Enable Event Log Flood Protection” check box, if you want to detect and suppress repeating events.

III. Trace Logs

When tracing is enabled you may want the trace log to go to a certain location.
1. You can type the path to the folder in which trace logs will be saved.
Note: The location you specify must exist on all servers in the farm.


http://www.boostsolutions.com/blog/wp-content/uploads/2012/07/PIC-6-How-to-Configure-SharePoint-2010-Logs.jpg


 2. In the Number of days to store log files box, you can set the maximum number of days?that a trace log file is saved.



3. Select the Restrict Trace Log disk space usage check box to monitor and limit the amount of storage space used by trace logs.
Note: In the Maximum storage space for Trace Logs (GB) box, you can type the maximum number of gigabytes (GB) allowed for storage of trace logs.

 http://www.boostsolutions.com/blog/wp-content/uploads/2012/07/PIC-8-How-to-Configure-SharePoint-2010-Logs.jpg

Reference:

http://www.boostsolutions.com/blog/how-to-configure-sharepoint-2010-logs/