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

Archive for April, 2012

Error: This document was checked out to your local drafts folder but the local copy could not be checked in or check out could not be discarded. Close any application that is editing the document and try to check in again, or discard the checkout.

Posted by Paul on April 27, 2012

My customer was reporting the following error.  He was in the middle of Check out of a document.

Now the user interface is not allowing Check In / Discard Check Out



Go to the SharePoint Drafts folder and Delete the particular file from there.

eg: C:\Users\HP\Documents\SharePoint Drafts

(Please ensure  you have a backup copy)


In my customer case the solution worked well and he was happy.


Local Drafts Folder

The local drafts folder helps in working offline.  The checked out document gets saved here temporarily.

You will be getting the prompt while Check Out of a document.


The drafts folder is located in the Operating System Drive > User > Documents > SharePoint Drafts

eg: C:\Users\HP\Documents\SharePoint Drafts


Posted in C# | Leave a Comment »

Web Database Templates

Posted by Paul on April 26, 2012

There are many site templates included in SharePoint 2010.  In this article we can explore web database templates included in SharePoint 2010.  The 5 web database templates are:

1.      Assets Web Database

2.      Charitable Contributions Web Database

3.      Contacts Web Database

4.      Issues Web Database

5.      Projects Web Database

What is a Web Database Template?

Web Database Template provides Site Templates for Browser based interaction to an MS Access application.   Thus web database templates provide Centralized Access for the database file, Flexibility in working with Access application without having MS Access installed in the client computer etc.

SharePoint 2010 is having some pre build Web Database Templates for ready use.  These templates provide solutions to the respective area as their name denotes. 

Under the hood SharePoint has Access Service Application running to support the web database templates.  You can configure the service applications & services through Central Administration.

Advantages of Web Database

Following are the advantages of using Web Database:

·         Supports uploading of Access Application into SharePoint

·         Access Application can be accessed through a Browser

·         Centralized database storage for Access Application

·         Flexibility in downloading the application file and working offline

Note: There are thousands of users having created their own MS Access solution involving Tables, Forms and Reports.  The Access Service application allows them to Publish these solutions to the SharePoint site.

Pre-Requisites for Web Database

As the web databases are using Access Service Application and Access Services, following are the pre-requisites:

1.      Access Service Application has to be created and started in Central Administration



2.      Access Database Service has to be started in Central Administration


Is MS Access needed in Client Machine?

MS Access is not needed to work with Web Database site templates.  But having MS Access enables more flexibility in working as it allows opening server database file in the client side.

Using MS Access with Web Database

You can use the Open in Access action to edit the web database file.


Assets Web Database

The Assets Web Database provides a site template for managing Assets in an organization.  It provides Assets management through creating Current Assets, Retired Assets and Reports.  The Owner of the Asset can be managed through the Users interface. 

We can create new Assets Web Database template using Site Actions > New Site > Assets Web Database Template.


Following is the initial site instance screen:


Charitable Contributions Web Database

The Charitable Contributions Web Database provides a site template for managing Charity Contributions activities.  The site provides pages to manage Donors, Campaigns, Users, Upcoming events and Reports.

We can create new Charitable Contributions Web Database template using Site Actions > New Site > Charitable Contributions Web Database Template.


Following is the initial site instance screen:


Contacts Web Database

The Contacts Web Database provides a site template for managing Contacts information.  The template provides Contact Entry Forms to capture Name, Email, Address, Phone details and Reports.

We can create new Contacts Web Database template using Site Actions > New Site > Contacts Web Database Template.


Following is the initial site instance screen:


Issues Web Database

The Issues Web Database provides a site template for managing Issues and Problems.    The template provides Issue Creation forms, Prioritizations and other screens to track the progress of fixing issues.

We can create new Issues Web Database template using Site Actions > New Site > Issues Web Database Template.


Following is the initial site instance screen:


Projects Web Database

The Projects Web Database provides a site template for managing Projects.  The template provides screens to manage Projects, Tasks, Customer, Assign Tasks and generate reports.

We can create new Projects Web Database template using Site Actions > New Site > Projects Web Database Template.


Following is the initial site instance screen:



Site Settings & Site Permissions

As the web database template instances are still Sites, we can use the Site Settings and Site Permissions options on them.

To access the Site Settings, choose the Options menu item from the title area.


To access the Site Permissions, choose the Options menu item from the title area.




In this article we had an overview of the 5 web database templates in SharePoint 2010.  You can use the associated video to get more detailed information on them.  Although not widely used, the knowledge of these templates should be helpful in creating rapid solutions or reusing existing solutions around MS Access.

Posted in C# | Leave a Comment »

TFS :: Programmatically get folder content

Posted by Paul on April 20, 2012

In this small article, I would like to show you how to get the contents of the folder from TFS server.

The post could be useful while creating deployment tools.

1. Create a new Console Application

2. Add references to following assemblies

You can get those from the references assembly or from folder 
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0
3. Get the TFS server url 
Use Team Explorer to connect to a TFS server and use Properties window to the get the url.
4. Get the path to required folder
Get the folder path from Source Control Explorer
Eg: $/Projects/MyApplication
5. Use the following code to retrieve all folders
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace MyConsoleApp
{     class Program     {         static void Main(string[] args)         {             RegisteredProjectCollection server = RegisteredTfsConnections.GetProjectCollection(new Uri("URLHER"));             TfsTeamProjectCollection projects = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(server);             VersionControlServer versionControl = (VersionControlServer)projects.GetService(typeof(VersionControlServer));             Workspace workspace = versionControl.CreateWorkspace(AppDomain.CurrentDomain.FriendlyName + "-installer", versionControl.AuthorizedUser);             WorkingFolder folder = new WorkingFolder("$PATH", "c:\\output");             workspace.CreateMapping(folder);             workspace.Get(); // Receive all the files             workspace.Delete();         }     }
6. Execute the application
Now you can see the c:\output folder to view the files.
var dzone_url = ‘’;var dzone_title = ‘TFS :: Programmatically get folder content’;var dzone_blurb = ‘TFS :: Programmatically get folder content’;var dzone_style = ‘2’;

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

WCF Large Data Upload Problem and Resolution

Posted by Paul on April 11, 2012

While dealing with large data using WCF services you might have encountered the following error message.


Type: ProtocolException

Message: The remote server returned an unexpected response: (400) Bad Request.

Problem: The message size was exceeded and it resulted in reconstructing the message at server side.  So the incomplete message lead to Protocol Exception.


The solution is to increase the Received Message Size for the service.  Please do the following.

1. Add the following tags inside the service configuration.

  maxReceivedMessageSize=”2147483647″  maxBufferSize=”2147483647″

2. Build the service

3. Update the client consumer with the new service reference


// Interface

namespace WCF_LargeUpload
    public interface IService1
        int Save(DataSet ds);

        DataSet Get();

// Service

namespace WCF_LargeUpload
    public class Service1 : IService1
        public int Save(System.Data.DataSet ds)
            return ds.Tables[0].Rows.Count;

        public System.Data.DataSet Get()
            DataSet ds = new DataSet();
            ds.Tables.Add(new DataTable() { });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Id”, DataType = typeof(int) });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Name”, DataType = typeof(string) });

            for (int i = 1; i <= 1000; i++)
                ds.Tables[0].Rows.Add(1, “A lengthy Name for the Item”);

            return ds;

// Server Config

<?xml version=”1.0″?>

    <compilation debug=”true” targetFramework=”4.0″ />
        <binding name=”NewServiceBinding”   maxReceivedMessageSize=”2147483647″  maxBufferSize=”2147483647″>
          <readerQuotas maxDepth=”2147483647″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″ maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″/>
          <security mode=”None”>
      <service behaviorConfiguration=”NewServiceBehavior” name=”WCF_LargeUpload.Service1″>
        <endpoint  address=”” binding=”basicHttpBinding” bindingConfiguration=”NewServiceBinding”
          contract =”WCF_LargeUpload.IService1″>

        <behavior name=”NewServiceBehavior”>
          <serviceMetadata httpGetEnabled=”true” />
          <dataContractSerializer maxItemsInObjectGraph=”2147483647″ />
          <serviceDebug includeExceptionDetailInFaults=”true” />
    <serviceHostingEnvironment multipleSiteBindingsEnabled=”true” />
    <modules runAllManagedModulesForAllRequests=”true”/>


// Client Console Application

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            Service1Client client = new Service1Client();

            DataSet ds = new DataSet();
            ds.Tables.Add(new DataTable() { });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Id”, DataType = typeof(int) });
            ds.Tables[0].Columns.Add(new DataColumn() { ColumnName = “Name”, DataType = typeof(string) });

            for (int i = 1; i <= 1000; i++)
                ds.Tables[0].Rows.Add(1, “abcdefghijklmnopqurstuvwxyzabcdefghijklmnopqurstuvwxyzabcdefghijklmnopqurstuvwxyzabcdefghijklmnopqurstuvwxyz”);

            int result = client.Save(ds);


This post confirms my ownership of the site and that this site adheres to Google AdSense program policies and Terms and Conditions: ca-pub-9482913752970808

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

SharePoint 2010 – Enterprise Document Management

Posted by Paul on April 11, 2012

SharePoint provides good amount of features supporting Enterprise Document Management.


The main features supported by SharePoint 2010 are:

1. Metadata

2. Versioning

3. Alerts

4. Workflows

5. Check Out

6. Search

7. Co Authoring

8. Auditing


SharePoint supports public, major and minor versioning support. To enable versioning use the Library Settings > Versioning settings option.



We can store information about the library items as Metadata using Columns. For adding Metadata for any library item use the Library Settings > Create Column option.


Using Enterprise Keywords we can tag a particular document. As they are indexed they are searchable and provide meaningful organizational capabilities.

Types of Libraries

SharePoint 2010 provides different types of in-built document libraries.

Library Type


Document Library

For all document types

Asset Library

For images, video files

Connection Library

Storing connection files

Report Library

KPI (Key Performance Indicator), BI files

Slide Library

PowerPoint Slide files

Picture Library

Picture files

Form Library

InfoPath Form files

Document ID Service

The document ID feature creates document identifiers that can be used to retrieve items independent of their current location. The document ID service is responsible for providing the Document ID feature.

When a document is added to the collection SharePoint assigns the Document ID to it. The administrator needs to configure the Persistence setting of Document ID.

To enable this feature use Site Actions > Site Settings > Site Collection Features item.


Click on the Activate button to make the service running.

Document Set

Document Set is a new feature in SharePoint 2010. It is similar to a zip file and a good solution while working with a group of files. While working with a project, people usually needed a set of files instead of a single file. So the Document Set feature is really useful once we know how to use it.

To enable this feature use Site Actions > Site Settings > Site Collection Features item.


Click on the Activate button to make the service running.

The creation of document and document sets are discussed in the upcoming article.



In this article we have explored the Document Management Features supported by SharePoint. The versioning, check out, co authoring features provides the SharePoint end users a great tool in hand.

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

SharePoint 2010 – Views, Lookups and Validations in List

Posted by Paul on April 11, 2012


We can associate a View for a List. Views provide a different representation of the existing information. If a List has columns Name and Country we can create a View for the List with county as India. Here we are experimenting with custom column creation as well.

For this create a new List with Custom List as the template.


Add the following columns into it.

· Name

· Country

Now add the following data into the Contacts List


Now there are 2 records with India and Other as country.

From the List ribbon item and click Create View button.


In the appearing page select Standard View option.


In the appearing page, enter the name for the view as Contacts in India.

Scroll down and in the Filter section use Country as filter equal to India.


Click the Ok button to create the View. Now you can see the view only lists one record.


This concludes our View creation.

Note: Views can be used to show grouped data, filtered data etc. based on the existing Lists items. In this way it is similar to the database Views which operate on tables. In SharePoint the contents are getting stored in SQL Server database.


A column in a List can integrate with another List column. For example we have 2 lists.

Doctor List




Patient List




Doctor (Referring to Doctor.Name column)

Here the Patient List is referring to Doctor List through the Doctor column which is acting as a Lookup column.

To accomplish the same create a custom list named Doctors with Name and Qualification as columns.

Note: The Title column will be already there, renaming/deleting can be done through the List Settings screen.

Now create a new list named Patients using Custom List template. Add the properties Name, Address and Doctor. For the column Doctor choose Lookup field.


Choose the highlighted list items as shown in the screen above. The Lookup field is required to fetch data from other Lists. We need to specify the List and Column for Lookups.

After setting the Lookup properties click the Ok button.

Now add some data to the Doctors list as shown below:


Now use the Add new item for the Patients List. You will be able to see the Doctor lookup field auto populated from the Doctors List.


Enter the details and click Save button. You are ready with the Patient with Doctor as Lookup value.


So this concludes our experiment with Lookup values. In real life scenarios we will end up with multiple Lookup values and validations. The Lookup values are implemented using Relationships. It is similar to the foreign key relations of a Relational Database Management System like SQL Server.


We can add validations for the columns. Now we can start experimenting with them. Here we are starting with a List of Employees. The columns are:

· Title

· Name

· Age

Make sure that the Age column is in the range 18 to 100. Any out of range values should populate the error message “Invalid Age – Please enter a value between 18 and 100!”

Create a List from the Custom List template and name it as Employees. Add custom column Name and Age. For the Age column make the type as Number. In the Column Validation section at bottom enter the following properties.

Formula: =AND(Age>=18,Age<=100)

User Message: Invalid Age – Please enter a value between 18 and 100!


Click the Ok button to continue. Now the List is ready with Name and Agecolumns.

Try to add a new item into the list with an invalid age (age = 11 for example)


You can see that the error message is shown for invalid Age.

This concludes our experiment with validations. In real world scenarios more complex validations need to be performed. For reference on the formulas you can use the link provided in the References section of this article.



In this article we have learnt about Views, Lookups and Validations. These knowledge are needed in building real world record management systems using SharePoint 2010.

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

SharePoint 2010 – New Features

Posted by Paul on April 11, 2012

In this article we can explore the new features of SharePoint 2010. Some of the new features of SharePoint 2010 are:

· Ribbon UI

· Status Bar

· Dialogs

· Branding and Theming

· Multilingual User Interfaces

· Inline Editing

· Developer Dashboard

· Silverlight Web Part

· Service Applications

For exploring the features please open the SharePoint 2010 default web application.

Eg: http://yourmachinename

Ribbon UI

The Ribbon User Interface can be considered as a major UI change in SharePoint 2010. It makes it similar to the Microsoft Office family of products. The advantages are user friendliness, easier access, categorized menus etc.


Opening a list shows the above Ribbon UI.

Status Bar

SharePoint 2010 provides a Status Bar which is below the Ribbon UI. It is not the Browser status bar. The Status Bar is configurable through pages.

Inline Editing

SharePoint 2010 allows the List items to be edited inline. This is without the use of an additional dialog with Ok/Cancel buttons. For enabling this we have to use the Modify View option in List Settings and choose Inline Editing enable checkbox.

New Dialogs

The dialogs are enhanced in SharePoint 2010. Some of the examples are given below.

New List and Library Dialog, Status Dialog



Branding and Theming

In SharePoint a new theme engine is included. This allows the users to create a theme from PowerPoint and use it inside SharePoint 2010.

The existing themes can be found in the Theme Gallary. (Site Actions > Site Settings > Themes)


You can anytime change the Site theme using the Site Settings > Look and Feel > Site theme option.


Silverlight Web Part

New silverlight web part has been added to SharePoint 2010. This allows us to embed silverlight applicatons inside the web pages. You can access this from the Add Web Part screen.


Developer Dashboard

The developer dashboard is a new feature in SharePoint 2010 which can be used for debugging and tracing purposes. It provides the performance related information to the developers. It is by default turned off and can be enabled by using PowerShell or StsAdm tool.

Service Applications

In the older version SharePoint 2007 there exists Shared Services Providers (SSP). This feature no longer exists in the SharePoint 2010 version and only Service Applications exists. The service applications like Search, Excel Services are unboxed and run independently.



In this article we have explored the new features of SharePoint 2010.

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

Code :: Get Controls Recursively

Posted by Paul on April 6, 2012

Returns the list of controls in a form irrespective of the container it has.

(extensibility possible to web forms as well)

private IList<Control> _controlsList = new List<Control>();

public IEnumerable<Control> GetControlsRecursively(Control container)

return _controlsList;

private void FindControlsRecursively(Control container)
foreach (Control control in container.Controls)
if (container.HasChildren)

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