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

Posts Tagged ‘sharepoint2010’

Squadron Diagnostics Add-in

Posted by Jean Paul on April 25, 2013

In this article we can explore a new Add-in integrated into Squadron.


Squadron is a Free SharePoint Administration tool available at


What is Diagnostics?

Diagnostics allows you to perform validations periodically. For example: Site Administrators run the following reports on monthly basis:

· Site Collection Size Information

· Permissions are set for Groups

· No obsolete workflows exists

· No obsolete alerts exists

· No dead accounts are in use


How to view Diagnostics Screen?

After installing Squadron, you can execute it from Start Menu & click the Diagnostics item on the left side. Please ensure you entered the site url correctly.


I am explaining each of the visible Diagnostics items.

Dead Accounts

Dead Accounts are those with Active Directory Disabled Status. Periodically we might need to remove the dead accounts from SharePoint Permission Associations.

You can click the Execute button against Dead Accounts row to start the check.


If no problems found, the bar will be green. You can click the Details link for viewing further information. Using the Details screen we can manually locate the items & fix the problems.

Dead Alerts

Dead Alerts are those Alerts created by users & the users do not exists or being disabled. We can find the alerts through the Dead Alerts diagnostics item.

You can click the Execute button against Dead Alerts row to start the check.


If no problems found, the bar will be green. You can click the Details link for viewing further information. Using the Details screen we can manually locate the items & fix the problems.

Direct Permissions

Microsoft recommends Permissions to be assigned to SharePoint Groups instead of directly assigning to users. Groups enable more manageability, reusability & ease of clarity. We can find Direct Permission items through this diagnostic item.

You can click the Execute button against Direct Permissions row to start the check.


If no problems found, the bar will be green. You can click the Details link for viewing further information. Using the Details screen we can manually locate the items & fix the problems.

In the above case it is red and clicking the Details link, you can see the problem locations.


This concludes our overview of Squadron > Diagnostics.



In this article we have explored the Diagnostics Add-in of Squadron. Diagnostics are essentials to be executed on periodic basis like every one month. For SharePoint Governance enabled organizations, the need for more Diagnostics tools exists.

In future I hope to see more functionality integrated into Diagnostics add-in. You can also give inputs on your Diagnostics requirement.

Posted in SharePoint, Uncategorized | Tagged: , , , | Leave a Comment »

SharePoint 2013 Apps Explored

Posted by Jean Paul on April 21, 2013

An overview of SharePoint 2013 Office Store Apps is posted @ SharePointCTO!

You can visit using the link below.


Posted in SharePoint, Uncategorized | Tagged: , , , | Leave a Comment »

SharePoint 2013 New Features

Posted by Jean Paul on April 20, 2013

I have created a PowerPoint Slide (PPT) describing features of SharePoint 2013.

It could be useful in refreshing for interviews, demonstrating to clients, deciding on upgrade etc.

Please click the link below to read..


Please let me know your comments here..

Note: Existing subscribers can register in site SharePointCTO for SharePoint 2013 articles.

Posted in SharePoint, Uncategorized | Tagged: , , , | Leave a Comment »

How to get SharePoint Solutions through Code?

Posted by Jean Paul on April 18, 2013

In this article we can explore how to get SharePoint Solutions through code. We are using Server Object Model to retrieve the solutions.

As you know there are 2 types of Solutions in SharePoint:

1. Sandboxed Solutions

2. Farm Solutions

Are Sandboxed & Farm Solutions retrieved differently?

Yes! They both are deployed through different methods & they are retrieved through different object models.


Sandboxed Solution is represented by SPUserSolution class & Farm Solution is represented by SPFarmSolution class.

How to get Sandboxed Solutions?

Sandboxed Solutions are deployed in the Site Collection level. (Feature Activation is different where we activate both for Site Collection & Site levels)

Following is the property to get User Solutions.


Following is the code to retrieve all User Solutions in a Site Collection:

using (SPSite site = new SPSite("http://localhost"))


foreach (SPUserSolution solution in site.Solutions)







How to get Farm Solutions?

Farm Solutions exists in the Farm level. Following is the property to get Farm Solutions.


Following is the code to retrieve all Farm Solutions.

foreach (SPSolution solution in SPFarm.Local.Solutions)






Now let us see installing solutions through the Server Object Model.

Install Sandboxed Solution

Installation of a Solution is a 2 step process consisting of:

1. Adding Solution to Gallery

2. Activating Solution

Following is the code to add solution to gallery:

using (SPSite site = new SPSite("http://localhost"))


SPDocumentLibrary gallery


SPFile file = gallery.RootFolder.Files.Add("SandboxedSolution.wsp",


SPUserSolution solution = site.Solutions.Add(file.Item.ID);


Remove Sandboxed Solution

For removing a solution & deactivating its features, following code can be used:

using (SPSite site = new SPSite("http://localhost"))


SPUserSolution solution = site.Solutions.Cast<SPUserSolution>().

Where(s => s.Name == "Your Solution").First();



Install Farm Solution

For installing Farm Solution, following code can be used:

private static void InstallFarmSolution()


SPSolution solution = SPFarm.Local.Solutions.Add("File Path here");

solution.Deploy(DateTime.Now, true, GetAllWebApplications(), true);


We need to specify the solution path for the above method. The solution will be installed to all web applications as per the above code. The body of GetAllWebApplications() method is given below.

public static Collection<SPWebApplication> GetAllWebApplications()


Collection<SPWebApplication> result = new Collection<SPWebApplication>();

SPServiceCollection services = SPFarm.Local.Services;

foreach (SPService s in services)


if (s is SPWebService)


SPWebService webService = (SPWebService)s;

foreach (SPWebApplication webApp in webService.WebApplications)






return result;


Remove Farm Solution

Removing Farm Solution is termed as Retract Solution. You can find the appropriate method in:

private void RetractFarmSolution(SPSolution solution)




A timer job will be created to Retract the solution. You can specify the time to start retraction.

For removing solution only from a specified web applications, there is an overloaded method.

private void RetractFarmSolution(SPSolution solution, Collection<SPWebApplication> webApplications)


solution.Retract(DateTime.Now, webApplications);




In this article we have explored how to use the Server Object Model to retrieve Sandboxed & Farm Solutions through code.

For reference please note that:

1. Sandboxed Solution is represented as SPUserSolution

2. Farm Solution is represented as SPFarmSolution

Posted in SharePoint, Uncategorized | Tagged: , , | Leave a Comment »

SharePoint 2010 – How Alerts works?

Posted by Jean Paul on April 16, 2013

In this article we can explore the underlying infrastructure of SharePoint Alerts. Let us analyze step by step what is happening in the background when we create an alert, alert is triggered, email is sent etc.

What are Alerts?

SharePoint provides an excellent feature which notifies the users on changes of item/library.

Uses can set alerts on:

· Library / List

· Document / Item

You can set alerts through the SharePoint user interface as shown below:


In order to see the above button, you need to set your Email Server in Central Administration > System Settings > Configure outgoing e-mail settings.



For receiving the emails triggered you can use an SharePoint Email Notification Tool like smtp4dev.

Create Alert

Now you are ready to create an alert & we can examine what happens in the database.


Open the database & you can see the following recode in ImmedSubscriptions table.


You can see that the ListId column is assigned with List GUID.

The table structure follows:



You can see database server & name through Central Administration > Manage content databases link.

If you have created a Summary Alert (daily or weekly) you can see the record was created inside SchedSubscriptions table.

The structure of SchedSubscriptions table.


Timer Job

Timer Jobs are responsible for building the Alert using template & sending the Emails. We can see the timer job status through Central Administration > Monitoring > Check job status link.


Scrolling down, you can see the Timer Job for Immediate Alert.


You can see the Status of last execution there. In my case it is succeeded. Click on the link to see the settings as shown below:


In the above case the Timer Job is scheduled to run every 5 minutes. You can try clicking the Run Now button to trigger execution.

Alert Templates

Timer Job creates the email content of through Alert Template file. We can modify the file, but copying & modifying is recommended. We can define template in the list & library level.

The Alert template can be found in 14 hive > TEMPLATE > XML folder.


By default there are 2 templates – one for email & other for sms. The alerttemplates.xml file contains around 10 thousand lines.

We can change the alert template through PowerShell & STSADM commands.



In this article we have explored the activities & tables involved while working with SharePoint Alerts.

Posted in SharePoint, Uncategorized | Tagged: , , | 1 Comment »

What is Ensure User?

Posted by Jean Paul on April 8, 2013

In this article we can explore a new command associated with Squadron > Explorer add-in.

What is Ensure User?

Ensure User is the command that invokes EnsureUser() method for the SPWeb objects specified.

Why we need to call it?

For each new user in a web site, a user record is added to the User Info table. For new SharePoint installations, when the users login to the site first time, there will be simultaneous addition of records to the above table & might result in SQL Server Throttling error.

A wise advice for the problem is to add the user explicitly to each web site before the opening SharePoint to public.


Squadron is a Free SharePoint Administration tool available at


How to perform Ensure User?

Please download & Install the latest version of Squadron. After executing it in Farm Account mode you will receive the following screen.


Enter the URL in the top pane & click the Explorer item from left pane. In the appearing SharePoint Web Application view, select you web item.


Click on the Ensure User button visible in the screen. In the appearing dialog enter the user names in the format DOMAIN\User:


After entering the user names, click the Execute button in the bottom to continue. You will get the following message box after operation is completed.


This makes sure that the user is available in the UserInfo table for the particular web site. This will prevent the possible SQL Server Errors happening in SharePoint Installations with hundreds of users.


You can also invoke the Ensure User within the Web Application & Site Collection level. The same button will be enabled for those commands.

For Web Application item selection:


For Site Collection item selection:


On invoking the Ensure User command, all the Web items will be enumerated in the selection dialog. You can select the web items to be processed for.


Following is the code that performs the EnsureUser() method invoking.

foreach (string user in UsersText.Lines)
                if (string.IsNullOrEmpty(user))

                foreach (int i in WebList.CheckedIndices)
                    SPWeb web = WebList.Items[i] as SPWeb;

                        SquadronContext.WriteMessage("Success: " + web.ToString() + " " + user);
                    catch (Exception ex)
                        SquadronContext.WriteMessage("Failure: " + web.ToString() + " " + user + " " + ex.ToString());



In this article we have explore the Ensure User command. There are more commands associated with the Explorer Add-in of Squadron – plus, they are context sensitive based on Site / Web / List / Item types.

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

Squadron – Invalid URL Exception & Solutions

Posted by Jean Paul on April 1, 2013

While working with the Explorer Add-in, you might receive the following error:

Invalid URL!



The Web Application object cannot be created using the URL specified.


You can try the following solutions:

1. Open Central Administration & Ensure the URL is correct

Open Central Administration > Manage web applications link


2. Execute the application from a Machine within Farm Environment & using the Farm Account.

In the Farm Machine, you an use CMD.EXE > RUNAS command to start Squadron in Farm Account context.


You can also try the http://localhost url within the farm environment.



Squadron is a Free SharePoint Administration tool available at


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

Squadron – Backup & Restore Permissions

Posted by Jean Paul on March 31, 2013

In this article we can explore a new feature in Squadron for SharePoint 2010.


Squadron is a Free SharePoint Administration tool available at


What is Backup & Restore Permissions Add-in?

This is a new add-in in SharePoint that allows backing up existing permissions in SharePoint securable object & restoring it elsewhere.

Following are the levels of backup possible:

· Web Application

· Site Collection

· Site

· List

· Item

Squadron also provides URL based filtering for backing up permissions. This will enable speed, context & reduce size of backup data.

What is contained in Permissions?

Following are the content of Permission:

1. Title

2. URL

3. User/Group Name

4. Members in Group

5. Owner if Group

6. Role Assigned

How to perform Backup?

Please follow the steps to perform backup:

Step 1: Execute Squadron

Execute Squadron from Start Menu > SharePointCTO folder. In the appearing scree se the URL.


Step 2: Click Permissions

From the left pane, click the Permissions item.


Step 3: Click Backup

Click on the Backup button in the appearing screen. You will get the following wizard.


Step 4: Check the Items

Expand the Web Application root item & Check the items to be backed up. You can right click & choose Check All command to check the sub items.


You can also use the Filter By Url on the bottom to filter by url.

Click the Next button to continue.

Step 5: View Permissions

In the next page you will see the Iterated Permissions as shown below:


The first column shows the Title of the Site / List / Item. The Type is displayed in the second column. The Url column is the key-column which will be used to identify the item uniquely.

The PermissionType column displays whether the permission is Unique or Inherited. The remaining rows contains the SharePoint Group / Domain User along with the role assignment.

Role Assignment can be Full Control, Contribute, Read or Custom Level.

Click the Next button to Save the file.

Step 6: Choose File

In the next page, choose the file name for saving the backup.


Step 7: Final Page

On clicking Next button you will see the last page which displays summary of the export.


It displays the number of web items, list items, library items along with unique/inherit permission types.

Click the Finish button to close the wizard.

Now we have successfully performed the Backup operation.

The file generated is in excel format & you may edit it for further optimizations. Please ensure the format of columns are retained.

Note: Please note that Folders (SPFolder) inside list/library are not included in permission backup.

How to perform Restore?

In the restore wizard, we are using a previous backup file to restore in a UAT/Production system. Click the Restore button from the Permissions Add-in.


You need to select the backup file in the next page.


In the next page you will be displayed the file contents as shown below:


In the next page choose the URL of the site to perform the backup.


Please note that the URL column of backup file will be used to match the target items.

Please note that this feature is only available for SharePoint 2010.


On clicking Next you can see the matching URLs.


You can verify the Source Objects in file & the Destination Objects in the destination Site URL specified.

On clicking Next you will see the Confirm prompt.


Click the Yes button to continue..

The restore operation will be performed & you can see the result as shown below:


This concludes our Restore Operation.


Permissions & Permission Levels


In this article we have explore the new feature in Squadron 2010. I believe this feature will be useful in backing up existing permissions before applying new ones. The Backup & Restore can be applied combined in scenarios of UAT Backup & Production Restore OR vice-versa.

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

Squadron Exception >> Unable to find SPDeletedSite…

Posted by Jean Paul on March 29, 2013

While using Squadron you might have faced with following Exception:


The exception states unable to load type ‘Microsoft.SharePoint.Administration.SPDeletedSite’ from assembly ‘Microsoft.SharePoint, Version’ with Public Key Token

Description of Problem

The stated assembly should be registered in GAC (Global Assembly Cache) for working with Squadron.


As Squadron is built based on Server Object Model, it is expected to be executed in the SharePoint Server machine.

Following are the solutions recommended:

  1. Execute Squadron from a machine with the above Assemblies installed in GAC
  2. Install above Assemblies to GAC  (

On Success

After solving the problem, you can execute Squadron again.  If the problem is resolved, you can see the Squadron Main Screen without any errors.


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

Squadron – PowerShell Code Command

Posted by Jean Paul on March 27, 2013

Observing the SharePoint Administrators, I found that they need a tool for examining problems with site/list/item objects & a PowerShell code to fix the problem.

As we already integrated Explorer with Properties in Squadron, I thought of easing their second step of using PowerShell code.


Squadron is a Free SharePoint Administration tool available at


What does PowerShell Code button do?

You can see the PowerShell Code button in the Explorer add-in.


The command is only available for:

1. Site Collection

2. Site

3. List

4. List Item

On clicking the command (button) you will get the PowerShell Code to point to the item.

For example, I am selecting the Site Collection object & clicking the button.


You can see the code in above screen. The code can be directly pasted to a PowerShell Editor for execution or debugging.

You need to enter your custom code after the last line of generated code 🙂 The generator helps in saving time skipping the plumbing work.

You can even launch PowerShell & PowerShell ISE using the buttons displayed.

Generate List Item Code

Both List & Library are internally Lists for SharePoint. So the list items & documents are the same List Item. You can select the item as shown below.


Click the PowerShell Code button to generate code.


You can launch the PowerShell ISE and paste the code there..


This concludes our article on PowerShell code command in Explorer add-in.



In this article we have explored a possible useful Add-in command option of Squadron. Please let me know about more functionality you need in Squadron.

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