Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Posts Tagged ‘sharepoint2010’

SharePoint 2013 Tutorials

Posted by Paul on March 27, 2013

I am writing SharePoint 2013 articles for SharePointCTO web site, link below:


You can find the articles there..


SharePoint 2013




Site Collection & Site

List & Library

Web Part



Central Administration

SharePoint Designer


Custom Development



Server Object Model

Client Object Model


Resources, Tools

Job Track

You are Welcome to visit the site by.. Happy SharePoint 2013!


Posted in C#, SharePoint | Tagged: , , , | 4 Comments »

Squadron – Permissions Add-in

Posted by Paul on March 26, 2013

In this article we can explore the new Permissions Add-in inside Squadron.


Squadron is a Free Administrative Tool for SharePoint. You can download it from:

What is inside Permissions Add-in?

Permission Add-in helps with the following tasks:

1. Find permissions of site level, list level, item level

2. Distinguish between Unique & Inherited permissions

3. Save Reports

4. Provides wizards for Find, Copy, Delete, Backup, Restore permissions


Types of Permissions

In a quick overview of Permissions, there are basically 2 types:

Unique Permissions where we assign unique users/groups & permission levels.

Inherited Permissions where the securable object (site, list, item) inherits permissions from its parent.

How to Generate the Report?

Let us examine the steps to generate a report for a site collection.

Step 1: Enter URL

Run Squadron & in the appearing screen, enter the URL of the site. Please note that you should run this in SharePoint Farm Account context.


Step 2: Open Permissions

From the left hand side click the Permissions link.


Step 3: Set Options

You can set the options in the appearing screen.


Site: To include site objects check this item.

List & Library: To include list & library objects check this item.

Item: To include items & documents check this item.

Expand Groups: A permission entry can be a SharePoint Group or User. If it is a SharePoint Group, you might need to include the users contained inside it. Check this item for including users.

Show User Name: The user item will be having a Login Name (eg: DOMAINuser) & a Display Name (eg: Full Name). You can choose this option to include the Display Name of the user as well.

Include Hidden: There could be hidden lists which are not visible in Quick Launch or in the All Site content page. Check this option to include those.

Unique Permissions Only: Check this option if you need only Unique Permission items.

Expand Inherited Groups: Usually the Inherited Permissions will be expanded in the parent object, as it is unique there. This checkbox enables you to expand the inherited groups too.

Filter By: Checking this option will enable a URL textbox where you can enter the URL to filter the result.

Highlight: Highlight Unique Permissions as Yellow & inherited ones as Green.

For the time being I have checked the following options:


Step 4: Generate

For generating the report, click the View Permissions from the left. You can see the result as shown below depending on your Site.


Step 5: Save Report

For saving the report, you need to right click on the grid & choose the option.


1. Save to Excel

2. Save to CSV

You may uncheck the option “Open after save..” if you do not wanted to launch your report file after save.

I have selected the option to save as Excel.


Enter the file name and click the Save button.

You will be viewing the file in Excel after saving.


This concludes our usage of Squadron Permissions add-in.


I wanted to iterate the Microsoft Recommendation of using SharePoint Groups instead of directly adding users to the site/list/item permissions. Groups are more easily manageable & easier understanding.

About the Wizards

The additional wizards are separately documented. Here is the screen shot of thee wizard screens.




In this article we have explored about Squadron Permissions Add-in. I believe in real life scenario the add-in is useful in quickly analyzing a SharePoint site.

Posted in C#, SharePoint | Tagged: , , , | Leave a Comment »

Set Permissions for Views

Posted by Paul on March 23, 2013

I had a requirement from customer to set permissions for Views. You very well know that we cannot set permissions for Views. SharePoint 2010 out-of-the-box does not have support for view permissions.


The Research department is having an Ideas Library. Following are the constraints:

1. Each employee can add / edit / delete documents to the library

2. Employee cannot view other employee’s documents

3. Research Head can view all the documents

4. Employee should not be able to change View

How to achieve this?


The common way of view creation with filter does not work here as the user may change the view. Plus the item filtering options for Lists & Survey Lists are not available for document libraries.


Following are the users involved in this scenario:

1. Research Head

2. Engineer 1

3. Engineer 2


There are 2 solutions for this problem:

· Create multiple views with filtering & use SharePoint Designer to set View Permission

· Modify default view to show only current user items & create a restricted page to show all items

We can try the second approach.


Step 1: Create Users

As the first step create the following users in Active Directory or in User Accounts.

1. Research Head (researchhead)

2. Engineer 1 (engineer1)

3. Engineer 2 (engineer2)

Step 2: Create Library

Create a new document library named Ideas Library and set contribute permissions for all users.


Step 3: Modify View

Open the Library and click on Library tab > Modify View button.


Modify the default view of the library by setting filter to [ME]


Click OK to save changes.

Step 4: Upload Documents

Open another browser & login as Engineer 1. Upload a document. Repeat the process for Engineer 2.

Now there are 2 documents, but each engineer can view only their documents.


Step 5: Create Page

Now create a new page.


Set the name of page as All Ideas Page


Choose the Insert tab > Existing list option.


Choose the Ideas Library and click OK button.


Save the changes to page.


Step 6: Set Page Permissions

Now choose Page Permissions.


Choose Stop Inheriting Permissions option


Delete existing users & add only the Research Head user.


Click Ok button to save changes.



If the buttons are not enabled, you might need to refresh the page.

Step 7: Test the Page

You can open the page from Site Actions > View All Site Content > Site Pages library.


Now you can try logging in as Research Head & the page should display all document items.


So this concludes our article. Now the engineers can post their ideas, without seeing each other’s. The Research Head can view all the submitted ideas. All are happy J



In this article we have explored a real world scenario of setting permissions for views, although not direcly.

Posted in C#, SharePoint | Tagged: , , | Leave a Comment »

KNOWLEDGE SHEET – Stale Objects & HTTP 500 Error

Posted by Paul on March 20, 2013



Stale Objects & HTTP 500 Error



Scenario – I was working for Squadron > Permissions management module. The SPWeb objects in collection were invoking Update() method multiple times.  Additionally the same SPWeb object were used in child SPList objects.  As these SPWeb objects were obsolete, invoking the Parentweb.Update() from child objects made the entire web application fault by HTTP 500 error.



Solution: Create new SPWeb objects in the child list again


public void InvokeUpdate(SPList list)








    using (SPSite site = new SPSite(list.ParentWeb.Site.Id))




      using (SPWeb web = site.OpenWeb(list.ParentWeb.Id))




        site.AllowUnsafeUpdates = true;




        site.AllowUnsafeUpdate = false;










Posted in C#, SharePoint | Tagged: , , | Leave a Comment »

Knowledge Sheet – Configuration Database Permission Solution

Posted by Paul on March 15, 2013

Error – This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
Scenario: In C# invoked the SPWebApplication.Lookup() method.
Solution 1: Add the current user to the SQL Server > Security folder.

Solution 2: Run the application in the context of Privileged user who has above access.

Use Command Prompt to execute the command:

runas /user:DOMAINUSERNAME “YourApplicationPath”



Posted in C#, SharePoint | Tagged: , | Leave a Comment »

Privacy on List Items – Out-of-the-box support

Posted by Paul on March 8, 2013

In this article I would like to use a SharePoint Out of the Box Solution for a common problem. The problem is associated with a survey list where:

1. Items can be created by any user

2. But editing / deleting should be possible by the item created user

Example: A survey list for employee feedback

What is Out of the Box?

This is a term used to denote in-built features of SharePoint. Out-of-the-box solutions are preferred & encouraged as it is easier to perform in the short run & easier to manage in the long.

Possible Solutions

We can quickly jump into solutions like creating an Event Handler and on the Item Updated event we can ensure the user & cancel the event. But the drawback is that it requires code development, installation & maintenance.

Instead we can go for the Out-of-the-box solution – Modifying List Advanced Settings.

Create the List

To execute this please perform the following activities:

1. Create a List named My List from template Contacts.

2. Create a user named user1 and add to List Permissions, assign Contribute level

3. Create a user named user2 and add to List Permissions, assign Contribute level

4. Login as user1 and create a contact named User 1 Contact

5. Login as user12 and create a contact named User 2 Contact


Now the list looks like below:



Please use separate browsers with different session instance for users: Administrator, User1 & User2

Modify Advanced Settings

Now we can modify the List Advanced Settings. Open the list in Administrator mode & choose List Settings > Advanced Settings.


From the appearing page select the following options.


Click the OK button to save changes. Now you can see that:

User 1 can only view his own item:


User 2 can only view his own item:


Administrator can view both items:



Please note that the Permission Levels determine the visibility.

1. Administrator is given Full Control permission level

2. User 1, User 2 are given Contribute permission level



In this article we have seen a possible scenario of List Item Permissions. SharePoint consists of various options & out-of-the-box solutions we need to be aware with.

This solution is apt for Survey Scenarios, where multiple users are required to provide their feedback, but they should not see other’s feedbacks.

Please note that SharePoint 2010 also have a Survey list template.

Posted in C#, SharePoint | Tagged: , | Leave a Comment »

Content Editor Web Part & CSS Tricks

Posted by Paul on March 8, 2013

In this article I would like to inform you on the usage of Content Editor Web Part for CSS style manipulations.

What is Content Editor Web Part?

Content Editor Web Part is used to provide Formatted HTML Content to your web page. You can add a content editor web part following the steps below:

· Open the Page

· Choose Site Actions > Edit Page

· Click on Add Web Part

· Choose Content > Content Editor Web Part

· Save changes


You need to have Designer permission level to edit pages. Please make sure you consult your Governance Committee before making changes.

Why we need CSS style changes?

Your customer might require changes in the layout of SharePoint pages. Editing the master page would be a choice but it is much more costly in terms of effort & performance.

The customization requirements will be as:

1. Hiding the Quick Launch from the left side

2. Highlighting the Page Elements

3. Modifying the Calendar items display format

4. Modifying other common style elements

Little about CSS

Cascading Style Sheets allows us to modify the Look & Feel of HTML elements as a whole. For modifying a single element we can use the id property of the element.

For modifying items as a whole, we can use the class property of the element.

Hiding Quick Launch

In this example we can try hiding the Quick Launch from a page. Following are the steps involved:

1. Find the Quick Launch bar Division Id

2. Add code to hide the Division in Content Web Part

3. Hide the Content Web Part too

To start with open your site which is Okay to be played with:


Now you can see the Quick Launch in the above page. We need to find the Division Element Id of the Quick Launch Bar. For this click on F12 button or open Developer Tools from Internet Explorer. Move the cursor over the Quick Launch bar & click on it. You will get the class name highlighted as shown below:


We are taking the CSS class name highlighted in Green Color. Now edit the Content Editor Web Part and choose the HTML source from toolbar. clip_image007

Add the following code in the HTML Source:


. s4-notdlg


display: none;


</ style >

Please note that the above code hides the Quick Launch Bar by hiding the Division Class. Now save the changes to page & you can see the Quick Launch is hidden.

But Wait! The solution is not complete. You can see that there is space filled in the old quick launch position. We can remove that by using the margin-left property of division.


As the last step we needed to hide the Content Editor Web Part as well. Choose edit web part and choose the Hidden option from Layout category.


Click the OK button & now you can see that the Quick Launch is hidden.

Ghosting & Unghosting

Ghosting is the state on which pages are rendered from File System. Unghosting is the stage where the edited pages are residing in database and rendered from there.

Unghosted pages should reduce performance, but in negligible based on network traffic.




In this article we have explored Content Editor Web Part and CSS style manipulations. To summarize with following are the points worth keeping in mind.

1. Content Editor Web Part allows us to include HTML, CSS, Java Script

2. We can add CSS code to modify page elements

3. Content editor web part can be made hidden

4. Customizing Pages involve slight performance overheads

5. Unghosting occurs while editing pages

6. Get approval from SharePoint Governance committee before applying page modifications

Posted in C#, SharePoint | Tagged: , | Leave a Comment »

Squadron – Explorer Add-in

Posted by Paul on February 26, 2013

In this article I would like to introduce you to the Explorer (Old Site-Structure) Add-in of Squadron.

What are the advantages of Explorer?

Using Explorer we can quickly generate the Site Collection, Sub sites, Lists & Libraries, Items in hierarchical manner. The information is useful in analyzing a site collection.


We can also view in Grid Style where the above objects are displayed in Rows with facility to export too.


Squadron is a Free SharePoint 2010 Productivity tool deployed using ClickOnce technology. You can install it from following location.

How to generate the Structure?

Install the Squadron application & execute it using the Desktop short cut. You will get the following screen.


Now click on the left pane named Explorer. You will get the following Site Structure screen.


Enter the Web Application URL in the URL textbox of the header. Click the Execute button to generate the site structure as shown below:


Please note that you can include Lists & Libraries by checking the Show Lists, Libraries checkbox. Additionally you can include Items & Versions using the Show Items, Show Version Count Checkboxes.


Following is the result after generating Items & Versions.


Please note that the versions are displayed within Parenthesis.

Grid Style

We can also generate Grid Style using the Grid Style checkbox.


Now click the Execute button again.


Export to Excel

For saving the rows, right click & choose:

1. Export to Excel

2. Export to CSV


After saving, the file gets opened inside Microsoft Excel. You may uncheck the Open after save option if you do not prefer automatic launching of file after saving.

CSV option is also good but if you have COMMA (,) character in the names of Site, List, Items the generated file will be confusing.

Hidden Lists

The hidden lists checkbox allows you to include Hidden Lists in the result. Hidden Lists are those not displayed in the Quick Launch bar as well as the System Lists.


Property Grid

We can examine each item properties further using the Property Grid. For example you wanted to view:

· Allow Designer property of site collection

· Allow Unsafe Updates property of site

· Allow Deletion property of List & Library

You can view these properties by clicking the result item; the Properties will get displayed in the right side.



Code Behind

Following is the code to generate the Hierarchy information.

Following is the main method:

private void GenerateHierarchy(string url)



SPWebApplication webApp = SPWebApplication.Lookup(new Uri(url));

_rootNode = tv.Nodes.Add(webApp.Id.ToString(), GetDisplay(webApplication), 0, 0);

_rootNode.Tag = webApplication;

foreach (SPSite site in webApp.Sites)


if (FilterCheck.Checked)

if (!site.Url.StartsWith(FilterText.Text))


TreeNode node = _rootNode.Nodes.Add(site.ID.ToString(), GetDisplay(site), 1, 1);

node.Tag = site;

node.ToolTipText = “Site Collection”;

IterateWebs(site, node);




if (_rootNode != null)



For iterating webs, the following method is used:

private void IterateWebs(SPSite site, TreeNode parentNode)


foreach (SPWeb web in site.AllWebs)


if (FilterCheck.Checked)

if (!web.Url.StartsWith(FilterText.Text))


if (!web.IsRootWeb) parentNode = GetParent(web.ParentWebId.ToString());

if (parentNode == null) parentNode = _rootNode;

TreeNode node = parentNode.Nodes.Add(web.ID.ToString(), GetDisplay(web), 2, 2);

node.Tag = web;

node.ToolTipText = “Site”;

if (ShowListsChecked.Checked)

IterateLists(web, node);



For iterating Lists, following is the method:

private void IterateLists(SPWeb web, TreeNode parentNode)


foreach (SPList list in web.Lists)


if (list.Hidden || !list.OnQuickLaunch)

if (!ShowHiddenChecked.Checked)


int imageIndex = 3;

if (list is SPDocumentLibrary)

imageIndex = 4;

TreeNode node = parentNode.Nodes.Add(list.ID.ToString(), GetDisplay(list),

imageIndex, imageIndex);

node.Tag = list;

if (list is SPDocumentLibrary)

node.ToolTipText = “Library”;


node.ToolTipText = “List”;

if (ShowItemsCheck.Checked)

IterateItems(list, node);



For iterating Items, use the following code:

private void IterateItems(SPList list, TreeNode parentNode)


foreach (SPListItem item in list.Items)


TreeNode node = parentNode.Nodes.Add(item.ID.ToString(), GetDisplay(item), 5, 5);

node.Tag = item;



For finding Root Web of a site, following method is used:

private SPWeb GetRootWeb(SPWeb web)


SPWeb result = web;

while (result.ParentWeb != null)

result = result.ParentWeb;

return result;




In this article we have explored the Site Structure Add-in in Squadron. I believe this would be a helpful tool in your bag while visiting a new SharePoint customer.

You can download & use Squadron for Free, if you face any installation problems, please let me know.

Posted in C#, SharePoint | Tagged: , | 7 Comments »

SharePoint 2010 Topology Determination

Posted by Paul on February 23, 2013

In this post we can explore an Architect Track topic.  

SharePoint Topology

SharePoint Topology determines the number of servers in a SharePoint farm.

For example: SharePoint Farm consists of the following type of servers:

  1. Web Front Ends (WFE)
  2. Application Server
  3. Database Server

Other subdivisions of servers would be:

  1. Search Database Server
  2. Sandbox Code Execution Server
  3. Crawl & Administration Server

In the matter of Topology determination we can use the following PDF from Microsoft.



Posted in C#, SharePoint | Tagged: , | Leave a Comment »

InfoPath forms not printing Background colors within SharePoint

Posted by Paul on February 15, 2013

Today i encountered a problem said by my customer.  He was not able to print the InfoPath form with background color.


While printing the background colors are turned off by the following settings:

  1. InfoPath
  2. Internet Explorer



There are multiple areas for us to make it enabled.  I am listing all the potential areas you might need.

You can enable it through InfoPath Designer in File > Options menu:


In the browser side choose the Tools > Internet Options > Advanced (tab) > Printing (section)


There is one more are you need to enable it.  It is the Print Preview Settings.

Choose the Browser > Print > Print Preview > Settings


In the appearing dialog click on settings button.


There you are, now you can see the Print Preview dialog itself having Color Background.

Posted in C#, SharePoint | Tagged: , | Leave a Comment »