Friday, April 24, 2015

Permission, Permission Level and Permission Policy in SharePoint

Permission, Permission Level and Permission Policy are three very different functionalities yet closely related in SharePoint. This article presents my understanding of what they are and how they work in SharePoint. It has been written with SharePoint 2010 in reference.

Permission


Permission means an action allowing someone to do a particular thing. In SharePoint it means the same. So you have permissions like Add Items, Edit Items, Delete Items and 30 more permissions. Yes, there are in all 33 permissions in SharePoint.

Permissions are divided into three categories.

  • Site Permissions (18) – apply generally across a SharePoint site
  • List Permissions (12) – apply to content in lists and libraries
  • Personal Permissions (3) – apply to content that belongs to a single user

Permissions also depend on other permissions. For e.g. you must be able to open an item to view it. In this way, View Items permission depends on Open permission. Below is the complete list of all the permissions and dependent permissions.

Thursday, April 9, 2015

Disable uppercase menu in Visual Studio

When I started learning SharePoint I came across Visual Studio and its hideous upper case menu.


I don't know what was the reasoning behind this, but in Visual Studio Community 2013 version you turn this off to show more conventional title case menu.

For this go to "Tools > Options". Under "Environment > General" enable the option of "Turn off upper case in menu bar".


And you will get the menu in title case.


Monday, April 6, 2015

Split string in JavaScript using regular expression

JavaScript has split() method which returns array of the substrings based on the separator character used. But you can also split a string using regular expression.

Say you have a credit card number which you want to split in array of four substrings with each substring consisting of 4 digits. For that you would use the match method of string.

var strValue = "1111222233334444";
var splitValues = strValue.match(/(\d{4})(\d{4})(\d{4})(\d{4})/);

// Start looping array from 1st index position as 0
// index position contains the entire parent string
for (var i=1 ; i<splitValues.length ; i++) {
 // Loop through the elements
}

Here, you use the match method and pass it the regular expression of (\d{4})(\d{4})(\d{4})(\d{4}) to split it into four equal substrings of four digits each. One thing to remember here is that the string returned here contains the parent string at the 0 index position and then the split substrings start at 1st position.

There is limitation here though — you need to know the number of characters in the string before hand, which might not be the case always.