Should not use DateTime Type Descriptor for BCS Entity

Hi All,

I wana share another finding of BCS SharePoint 2010.

I had few DateTime type fields for my External Content Type, I was developing through VS 2010 to bring the sql data using a sql view. All was working well but when i saw data in external list for these fields the time was coming 5:30 mins more than the actual time (:0 Strange right ! )

like if my actual date is : 2010-12-30 17:31:53.000

DateTime in External List was coming as : 12/30/2010 11:01 PM

After googling for some time I found one article which says BCS WebPart does not understand DateTime. (BCS WebParts are used to show external list data)

So, its alternative I found was to bring the DateTime field data as string into the External List. Which worked well for me.

Ref: Check out ‘Joran Markx’ answer in this Post


Happy SharePointing 🙂

Custom Search Tabs

Hi Experts,

Few more interesting point to share with you guys about custom search:

1) Configure custom tabs: You can add custom tab to search page just like OOB Tabs “All Sites” and “People”. Please follow given steps:

  • Point to Site Actions, and then click View All Site Content.
  • Click the Tabs in Search Pages list and click New and then Add New Item to add a new item that represents your new tab.
  • Provide a name and associate it with the custom search page that you created earlier.
  • Click the Tabs in Search Results list and and click New and then Add New Item to add a new item that represents your new tab.
  • Provide a name and associate it with the custom search page that you created earlier.


Edit the search page and add new tabs. see the screen shot below:

After creating new tab we have to associate custom scope to new search core results webpart:

  • Click the Search tab to go to the Search Center.
  • Go to the search result page.
  • Point to Site Actions, and then click Edit Page.
  • Find the search core result webpart and click on edit webpart.
  • Find the “Scope” option under the ‘Location Properties’ section.
  • Type your custom search scope name in scope section.

Here is the screen shot of the property.

2) Defining list item and list level custom scopes:

While configuring search we need to configure custom scops. In my last post, i define the scope settings for configuring People Search Scope. Now for creating custom search scope which limits your search with in various list or list items, we have to define STS_List_GenericList and STS_ListItem_GenericList(for custom list type). For reference please have a look to below available options:

“STS_Web”: // Site
“STS_List_850”: // Page Library
“STS_ListItem_850”: // Page
“STS_List_DocumentLibrary”: // Document Library
“STS_ListItem_DocumentLibrary”: // Document Library Items
“STS_List_GenericList”: // Custom List
“STS_ListItem_GenericList”: // Custom List Item
“STS_List_Links”: // Links List
“STS_ListItem_Links”: // Links List Item
“STS_List_Tasks”: // Tasks List
“STS_ListItem_Tasks”: // Tasks List Item
“STS_List_Events”: // Events List
“STS_ListItem_Events”: // Events List Item
“STS_List_Announcements”: // Announcements List
“STS_ListItem_Announcements”: // Announcements List Item
“STS_List_Contacts”: // Contacts List
“STS_ListItem_Contacts”: // Contacts List Item
“STS_List_DiscussionBoard”: // Discussion List
“STS_ListItem_DiscussionBoard”: // Discussion List Item
“STS_List_IssueTracking”: // Issue Tracking List
“STS_ListItem_IssueTracking”: // Issue Tracking List Item
“STS_List_GanttTasks”: // Project Tasks List
“STS_ListItem_GanttTasks”: // Project Tasks List Item
“STS_List_Survey”: // Survey List
“STS_ListItem_Survey”: // Survey List Item
“STS_List_PictureLibrary”: // Picture Library
“STS_ListItem_PictureLibrary”: // Picture Library Item
“STS_List_WebPageLibrary”: // Web Page Library
“STS_ListItem_WebPageLibrary”: // Web Page Library Item
“STS_List_XMLForm”: // Form Library
“STS_ListItem_XMLForm”: // Form Library Item
Please feel free to ask any doubt about configuring search.
Thanks for your time
happy sharepointing 🙂

Common problem with SharePoint 2010: System.Security.Cryptography.CryptographicException – Keyset does not exist

Hi All,

A very general issue when working Sharepoint 2010 ​along with visual studio 2010 is getting this unhandled security exception. Though this error prompt will not affect much but still its anoying.

Uninstalling Visual Studio will not resolve this issue.

To configure the server to no longer show a dialog when an unhandled exception occurs, use the registry editor to delete the following registry keys:
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger
On a 64-bit operating system also delete the following registry keys:
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger

Hope you will get rid of this message after doing thid configuration.

Thanks and Regards


Sharepoint Logs not working with Error: Usage log retention limit reached.

Hi All,

SharePoint generates multiple log types. Logs in SharePoint require three basic steps like all other logs: Logging, Processing and  Reporting. To diagnose any unexpected error one must have to open those logging files to know exact error root. Below are the locations where logs are stored:

SharePoint 2007 log files: “c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS

SharePoint 2010 log files:c:\Program Files\Common Files\Microsoft Shared\web server extensions\14\LOGS

Some tools are available on codeplex which works well as a log viewer tools. I generally use SharePoint Log Viewer 2010 and SharePoint ULS Log Viewer.

From last few weeks suddenly logs stopped working. When I open the last updated log file, I found an error saying: “Usage log retention limit reached.  Some old usage log files have been deleted.”

I have changed the Retention policy from central admin in order to make it work but no luck. These setting you can find at:

Central Admin> Monitoring> Reporting> Configure Diagnostic logging

Then finally after surfing, I found a small which really worked for me. Follow the given steps:
1. Open the command prompt and Navigate to the stsadm directory i.e. cd \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN

2. When in that directory simply type: “stsadm -o provisionservice -action start -servicetype spwebservice

then restarted iis.

Bingo…..This fixed it

Thanks for your time 🙂

Ribbon Customization


I have got chance to research on SharePoint Ribbon. I found few basics about the ribbon and implemented some of basic customization demos. For a beginner I think below demos are very helpful. I will first start explaining some basics of ribbon control.

The Out-of-Box ribbon is rendered by a single Xml file resides in 14 hive at location …\14\template\global\xml\cmdui.xml. Now in order to customize this we have to override the functionality of cmdui.xml file or extend it the way we want. There are the several ways VS 2010 development tool provides us to create/deploy a xml file but I think creating a module is quite simple and professional way to implement.

Ribbon Components:

  1. Tab: Tabs are the root of the Server ribbon. They contain one or more groups, and contain similar functions. For example, in Figure 2, the Page tab that is currently selected contains functions that pertain to working with the current page.
  2. Group:Every tab in the ribbon contains a series of one or more groups. Groups are used to associate controls with similar functionality. Each group is associated with a template that defines the layout of the group and how the group should appear based on the scale of the ribbon. The scale of the ribbon refers to situations where there are too many controls to show in the ribbon, for example, when the browser is not in a full-screen maximized state and is in a windowed state.
  3. Control:The ribbon would not be complete if users did not have anything to select or click. Controls are the items that live inside the ribbon that users can interact with. Controls reside within groups. These include things such as buttons, toggle buttons, check boxes, text boxes and many other controls.
  4. Contextual tab group:Contextual tab groups are used to provide functions that are not global to the current context, such as the page. They appear only when certain circumstances have been met and contain one or more tabs.

A ribbon can have mutiple tabs, each tab mutiple groups and each group multiple controls. These controls can be a Button, CheckBox, Dropdown etc. The complete list is here: Button, CheckBox, ComboBox, DropDown, FlyoutAnchor, GalleryButton, Label, MRUSplitButton, Spinner, SplitButton, TextBox, ToggleButton.

Any ribbon customization should be mounted within xml in feature declaration. The special xml tag exists for this purpose. Here is the example how it usually looks like:

RegistrationType=”[Scope of the custom action eg. List]”
RegistrationId=”[Id of the list]”



The CustomAction xml tag should have its Id in corresponding attribute – unique text value. The value for Location attribute should always be set to “CommandUI.Ribbon”, independently on what kind of ribbon customization it is created for. The CommandUIDefinitions tag should contain CommandUIDefinition child tags declaring all controls or containers which should be created (i.e. buttons, groups, tabs, etc.).

The CommandUIHandlers tag can contain commands declarations for registered controls, so some JavaScript code can be executed. It is not necessary to register all commands in custom action – it can be done on server (webpart/page code-behind). The way how to do it will be described in next.

I. Adding custom button to existing group

Here is the example of declaring button control to be added to the ribbon which should be added to Shared Document doc library xml node

<CustomAction Id=”CustomRibbonButton”
Alt=”Custom Ribbon Button”
LabelText=”Custom Ribbon Button”
CommandAction=”‘;);” />

Details of value of CommandUIDefinition Location: [Existing_Group_ID].Controls._children. You can find group’s ID in its declaration xml or using IE Dev Toolbar (the Group node is rendered as <li id=”[TabID]”>…</li> html tag)

II. Adding Custom group to existing tab:

Here is example how to add a custom group to the shared document library:

<CustomAction Id=”Ribbon.Documents.CustomGroupInExsitingTab” RegistrationType=”List” RegistrationId=”101″ Location=”CommandUI.Ribbon” >
<CommandUIDefinition Location=”Ribbon.Documents.Scaling._children”>
<MaxSize Id=”Ribbon.Documents.CustomGroup.MaxSize” GroupId=”Ribbon.Documents.CustomGroup” Size=”LargeLarge” Sequence=”10″ />
<CommandUIDefinition Location=”Ribbon.Documents.Scaling._children”>
<Scale Id=”Ribbon.Documents.CustomGroup.LargeSmall” Sequence=”230″ GroupId=”Ribbon.Documents.CustomGroup” Size=”LargeSmall” />
<CommandUIDefinition Location=”Ribbon.Documents.Groups._children”>
<Group Id=”Ribbon.Documents.CustomGroup” Sequence=”10″ Title=”Custom Group” Template=”Ribbon.Templates.Flexible2″ Image32by32Popup=”/_layouts/images/RibbonCustomization/images32x32.png”
Image32by32PopupTop=”-128″ Image32by32PopupLeft=”-192″>
<Controls Id=”Ribbon.Documents.CustomGroup.Controls”>
Sequence=”15″ Image16by16=”/_layouts/images/NoteBoard_16x16.png” Image32by32=”/_layouts/images/NoteBoard_32x32.png”
Description=”Notification hello message”
TemplateAlias=”o1″ />
<CommandUIHandler Command=”CustomGroup.Command.Notify” CommandAction=”javascript: SP.UI.Notify.addNotification(‘Hello from my custom group’);  ” />

In this sample you should pay attention to the following:

  1. Three different CommandUIDefinition xml nodes should be created: for deploying MaxSize, Scale and Group nodes; MaxSize and Scale nodes should reference to the group which is currently being declared (using GroupId attribute); the Size attributes should be based on the group template. If no MaxSize and Scale declarations for new group is created, on incorrect values of Size attributes are specified, the group won’t be visible or no controls should be shown in it;
  2. The Location attributes of CommandUIDefinition xml elements should be constructed in the following way: [ExistingTabID].Scaling._children – for MaxSize and Scale nodes; [ExistingTabID].Groups._children – for Group node;
  3. All controls for this group can be declared directly in the Controls node inside the group declaration xml.

III. Adding custom tab to ribbon:

Here is the example of declaring custom ribbon tab:

<CustomAction Id=”Ribbon.CustomTab” Location=”CommandUI.Ribbon” RegistrationId=”101″ RegistrationType=”List”>
<CommandUIDefinition Location=”Ribbon.Tabs._children”>
<Tab Description=”Custom Tab” Id=”Ribbon.CustomTabExample” Sequence=”1000″ Title=”Custom Tab”>
Size=”OneLargeTwoMedium” />

<Groups Id=”Ribbon.CustomTabExample.Groups”>
Description=”This is a custom group!”
Title=”Custom Group”
<Controls Id=”Ribbon.CustomTabExample.CustomGroupExample.Controls”>
Description=”Says hello to the World!”
LabelText=”Hello, World!”
Description=”Says good-bye to the World!”
LabelText=”Good-bye, World!”
Description=”Says I love the World!”
LabelText=”I love you, World!”
<CommandUIDefinition Location=”Ribbon.Templates._children”>
<GroupTemplate Id=”Ribbon.Templates.CustomTemplateExample”>
<Section Alignment=”Top” Type=”OneRow”>
<ControlRef DisplayMode=”Large” TemplateAlias=”cust1″ />
<Section Alignment=”Top” Type=”TwoRow”>
<ControlRef DisplayMode=”Medium” TemplateAlias=”cust2″ />
<ControlRef DisplayMode=”Medium” TemplateAlias=”cust3″ />

CommandAction=”javascript:alert(‘Hello, world!’);” />
CommandAction=”javascript:alert(‘Good-bye, world!’);” />
CommandAction=”javascript:alert(‘I love you, world!’);” />


VI. Handling action using JavaScript

There are two different ways that we define the custom action performed by the controls we placed under the custom tab/group/control.

1. Using “ScriptSrc”: Custom action tag contains this attribute to refer the js file which can contain the javascript/Jquery code. The simple example how to define this attribue is as follows:

<CustomAction Id=”Ribbon.Library.Share.Sample.Script”

Location=”ScriptLink” ScriptSrc=”/_layouts/SCRIPT/Ribbon.js”

2. Using “ScriptBlock”:Custom action tag contains this attribute to refer the code without defining any js file. The simple example how to define this attribue is as follows:

<CustomAction Id=”Ribbon.Library.Share.Sample.Script”

Location=”ScriptLink” ScriptBlock=”function viewDialog() {
var options = {
url: ‘;,
width: 800,
height: 600

Also we can define the javascrip to the server side for more details please refer to:

Custom Site definition with custom masterpage

Site definition can be considered as a  blueprint of a SharePoint site. When developing business solutions on WSS platform sometimes we will have to create our own site definitions to incorporate functional business modules. Site Definitions gives you lots of flexibility in terms of maintaining and upgrading your solutions compared to Site Templates. Its also gives us the flexibility of choosing custom layouts and the ability to pre program the sequence of the feature activation order when  you create a new site based on the definition.

To create a site definition follow given steps:

1)  Open Visual Studio 2010, click New on the File menu, and then click Project. In the Templates pane, select the Site Definition project template under SharePoint 2010 templates folder. In the Name box, provide a name for your solution. In the Name box, input DemoSiteDefs and then click OK (See below Figure).

2) At this point, the SharePoint Customization Wizard will appear (See below screenshot).You will see a SharePoint Customization Wizard asking for a local site for debugging and deployment. Enter the URL for the SharePoint server site where you want to debug the site definition, or use the default location (http://system name/). Select Deploy as a farm solution for “What is the trust level for this SharePoint solution?” Click Finish. The project appears in Solution Explorer.

A new solution will be created as shown in the image below. Note that two .xml files are created (WebTemp_DemoSiteDefinition.xml, ONet.xml). As well, Features and Package folders are created. (See Below Figure)

3) Add MasterPage Module: To do this, right-click the project node in Solution Explorer, point to Add, and then click New Item.Within the Add New Item dialog box, in the list of SharePoint templates, select Module. Give the module a name, input MasterPageModule. In the module, delete the default Sample.txt file.

Download starter master page from

Add the master page under the masterpage module. To do this, select the module node and then, on the Project menu, click Add Existing Item. Locate the master page and select it. Master page files have a .master file name extension. I added MyCustom.master file. See the following figure.

Now double click on element.xml file and replace the below code:

Note: Please note that feature id should be replaced with your project feature id.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
<Module Name="MasterPageModule" Url="_catalogs/masterpage" List="116" RootWebOnly="FALSE">
<File Path="MasterPageModule\MyCustom.master" Url="MyCustom.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE"/>

Open the Onet.xml file and place the code:

<?xml version=”1.0″ encoding=”utf-8″?>
<Project Title=”DemoSiteDefinition” Revision=”2″ ListDir=”” xmlns:ows=”Microsoft SharePoint” xmlns=””&gt;
Body=”&lt;a ID=’onettopnavbar#LABEL_ID#’ href=’#URL#’ accesskey=’J’&gt;#LABEL#&lt;/a&gt;”
ID=”1002″ />
Prefix=”&lt;table border=’0′ cellpadding=’4′ cellspacing=’0’&gt;”
Body=”&lt;tr&gt;&lt;td&gt;&lt;table border=’0′ cellpadding=’0′ cellspacing=’0’&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=’/_layouts/images/blank.gif’ id=’100′ alt=” border=’0’&gt;&amp;nbsp;&lt;/td&gt;&lt;td valign=’top’&gt;&lt;a id=’onetleftnavbar#LABEL_ID#’ href=’#URL#’&gt;#LABEL#&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;”
ID=”1004″ />

Default=”TRUE” />

<Configuration ID=”0″ Name=”DemoSiteDefinition” CustomMasterUrl=”_catalogs/masterpage/mycustom.master”
QuickLaunchUrl=”$Resources:core,shareddocuments_Folder;/Forms/AllItems.aspx” />
<Feature ID=”f6924d36-2fa8-4f0b-b16d-06b7250180fa”></Feature>
<Feature ID=”3d3245a5-6277-4dc7-848a-911fe1aa2247″></Feature>
<Feature ID=”94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb”></Feature>
<Module Name=”DefaultBlank” />
<Module Name=”DefaultBlank” Url=”” Path=””>
<File Url=”default.aspx”>

Press F5 to run and deploy the project.

Create a Site. In the new Site, you can see the custom master page as shown in the following figure.

To add more components refer to the onet.xml basics :

Thanks for time:)