Thursday, May 24, 2012

Hide Old Events from Calendar's 'calendar view' in SharePoint

By default, SharePoint calendar provides two types of views : Calendar View and All Events View. Hidding old enteries from all events view is straight-forward. In this view, you can apply filter on 'End Time' field of calender event something like this expression:

'End Time' [Today]  -> (Please note this is only a representation)

It hides all events older than today.

BUT, achieving same thing in Calendar view is not so easy as it doesn't show 'Start Time' and 'End Time' fields in filter column. But, still it's possible !

Here's the solution !!!

Select 'Created' field as a filter column. In operator control, select 'is greater than or equal to' and in value, type [Today].
So filter expression will look like : 'Created' [Today].

Click 'Ok' to save.

Now, click 'modify view in SharePoint designer' on calendar ribbon to make changes in view using SharePoint designer..
[Calendar Tools -> Calendar -> Modify Views -> Modify View in SharePoint Designer (Advanced).]

Calendar view opens in the SharePoint designer. Search for 'Created' keyword and you will find given line:

<Geq><FieldRef Name="Created"/><Value Type="DateTime"><Today/></Value></Geq>

This is CAML query which filters calendar items in view. Replace 'Created' with 'End Time' and save.

You will see that all events older than today are hidden in Calendar view.

Please let me know if you face any issue.

Friday, May 18, 2012

Best practices for planning My Sites

When you plan and set up My Sites, you should always follow Microsoft's best practices as given below :
  1. Dedicated Web Application : You should use a dedicated web application for hosting My Site host site collection for following reasons:
    • To improve performance and manageability.
    • As enabling self-service site creation feature on a web application makes them vulnerable for cross-site scripting, it is required to isolate any scripts running in My Site from affecting other sites in your environment (see more details).
  2. My Site host at Web Application Root : My Site host should exist at the Web application root unless it's a requirement to create it deeper in the path.
          Note : Without this, you will get an error message saying that no site collection exists when enabling self-site creation for web application. If there is a requirement of creating My Site host deeper in the path, it must be under an explicit inclusion managed path. Additonally, you must create a site collection at the Web application root, although this site collection can be empty and created without a template.
  3. User's 'My Content Section' Naming Format : While setting up My Site, in the 'Site Naming Format' avoid choosing 'User name (do not resolve conflicts) option if you are not sure about the uniqueness of the user account (in multiple domains). This format is used to create a site collection for user when he/she first time clicks 'My Content' section of My Site.
  4. Plan for Profile Syncronization : Although configuring the User Profile service application is required for My Sites, synchronizing profiles between SharePoint Server 2010 and directory services or business applications is optional. This option is highly recommended for consistent and timely information on user's My Site.
  5. Configure Managed Metadata service application : The Managed Metadata service application enables Web applications to store and access keywords from a managed metadata term database.
    For My Sites, this functionality is required for users to specify keywords as their areas of expertise in the Ask Me About section and to use keywords for social tagging by using the Tags and Notes and I Like It features on the My Profile page of a My Site.
    A Managed Metadata service application is highly recommended for My Sites.  

For more details, visit this link.

Thursday, May 17, 2012

SharePoint 2010 Databases

SharePoint 2010 is a combination of range of products like foundation, standard, enterprise editions, project server, FAST search server for SharePoint 2010.

All these products have their own databases which are categorized as below:

Product version and edition Databases
SharePoint Foundation 2010 Configuration
Central Administration content
Content (one or more)
Usage and Health Data Collection
Business Data Connectivity
Application Registry service (if upgrading from Microsoft Office SharePoint Server 2007 Business Data Catalog)
Subscription Settings service (if it is enabled through Windows PowerShell)
Additional databases for SharePoint Server 2010 Standard editionSearch service application:
  • Search administration
  • Crawl (one or more)
  • Property (one or more)
User Profile service application:
  • Profile
  • Synchronization
  • Social tagging
Web analytics service application
  • Staging
  • Reporting
Secure store
Managed Metadata
Word Automation services
Additional databases for SharePoint Server 2010 Enterprise editionPerformancePoint
Additional databases for Project Server 2010Draft
Additional database for FAST Search ServerSearch administration

For details, go to this link.

Tuesday, May 15, 2012

Rotating images using JQuery and Data View Web Part in SharePoint Foundation 2010

This post is about rotating images with fixed captions in SharePoint Foundation 2010. There are a few posts around which talks about gettting it done but doesn't work properly so thought to write a step-by-step blog on it.

Note: You can also rotate images using Content query web part (link), but for that you should have SharePoint Server 2010, as content query web part doesn't come with SharePoint foundation 2010!

- Download jquery-1.7.2.min.js
- Download captify.tiny.js (for fixed caption)
- Create a picture library or use the default one and put some pictures into it.
Keep both JQuery files in the <14 hive>\Templates\Layouts\JQuery (create this folder if doesn't exist)

1. Create a new site page.

2. Now edit page in normal mode in SharePoint designer. Put your cursor before SPAN tag with id 'layoutsData' and insert an Empty Data View.

Switch to 'Split' mode, click 'Click here to select a data source' and select the picture library.
Select 'Title' for image caption and 'URL Path' for link to image. Now insert selected fields as multiple item view. It will insert complete xslt required for rendering the picture library on page.

Switch to 'Code' view. Automatically generated code contains few XSLT tag which are of no use in our case so I have removed these. Select automatically generated <XSL> tag and overwrite it with the <XSL> tag given below.

<!----- XSL Tag: START ------>


 <xsl:stylesheet xmlns:x="" xmlns:d="" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="" xmlns:asp="" xmlns:__designer="" xmlns:xsl="" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">    
 <xsl:output method="html" indent="no"/>    
 <xsl:decimal-format NaN=""/>    
 <xsl:param name="dvt_apos">'</xsl:param>    
 <xsl:variable name="dvt_1_automode">0</xsl:variable>   
  <xsl:template match="/" xmlns:x="" xmlns:d="" xmlns:asp="" xmlns:__designer="" xmlns:SharePoint="Microsoft.SharePoint.WebControls">        
 <xsl:call-template name="dvt_1"/>    
 <xsl:template name="dvt_1">        
 <xsl:variable name="dvt_StyleName">Table</xsl:variable>        
 <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>        
 <xsl:variable name="dvt_RowCount" select="count($Rows)" />        
 <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />

<!-- Jquery file and plugin reference -->
 <script type="text/javascript" src="_layouts/JQuery/jquery-1.7.2.min.js"></script>
 <script type="text/javascript" src="_layouts/JQuery/captify.tiny.js"></script>

 <script type="text/javascript">

  $(window).load(function() {

   // This code provides the fade-in and hide effect on regular interval
   var InfiniteRotator =    
           init: function()

                 //initial fade-in time (in milliseconds)
               var initialFadeIn = 1000;
                 //interval between items (in milliseconds)
               var itemInterval = 5000;
                 //cross-fade time (in milliseconds)
               var fadeTime = 2500;
                 //count number of items
               var numberOfItems = $('#headers li').length;
                 //set current item
               var currentItem = 0;
               if(numberOfItems &gt; 0) {
                //show first item              
                $('#headers li').hide();
                $('#headers li').eq(currentItem).fadeIn(fadeTime);
                //$('#headers li').eq(currentItem).fadeOut(fadeTime);
                if(numberOfItems &gt; 1)
                 //loop through the items
                 var infiniteLoop = setInterval(function(){
                     $('#headers li').hide();                  
                       if(currentItem == numberOfItems -1){
                         currentItem = 0;
                     $('#headers li').eq(currentItem).fadeIn(fadeTime);                  
                 }, itemInterval);
               else {                 
                $('#headers').append('<li><span>No images.</span></li>');

 <script type="text/javascript">  

    speedOver: 'fast', 
    // speed of the mouseout effect 
    speedOut: 'normal', 
    // how long to delay the hiding of the caption after mouseout (ms) 
    hideDelay: 500,  
    // 'fade', 'slide', 'always-on' 
    animation: 'always-on',   
    // text/html to be placed at the beginning of every caption 
    prefix: '',   
    // opacity of the caption on mouse over 
    opacity: '0.7',      
    // the name of the CSS class to apply to the caption box 
    className: 'caption-bottom',  
    // position of the caption (top or bottom) 
    position: 'bottom', 
    // caption span % of the image 
    spanWidth: '100%'
  }); });       

 <style type="text/css">
 /*********** CAPTIFY CAPTION ***************/
 .caption-top, .caption-bottom {
       background: #000000;     
       color: #ffffff;     
 .caption-top {
 .caption-bottom {
 .caption a, .caption a {
 .caption a:hover, .caption a:hover {

 #headers, #headers li{
 #headers li img{    
  display:none; /* hide the items at first only */       
 #rotating-item-wrapper {
     position: relative;


 <ul id="headers">   
  <xsl:call-template name="dvt_1.body">    
    <xsl:with-param name="Rows" select="$Rows"/>    

 <xsl:template name="dvt_1.body">        
   <xsl:param name="Rows"/>        
     <xsl:for-each select="$Rows">            
       <xsl:call-template name="dvt_1.rowview" />        
 <xsl:template name="dvt_1.rowview">
   <div id="rotating-item-wrapper{generate-id()}">
       <img src="
{@FileRef}" class="captify" alt="{@Title}"/>




<!----- XSL Tag : END ------>

Note : For your information, I have highlighted the text which is inserted after cleaning the xslt code.

Done! Just save the page and navigate to it. You should be able to see images fadding in with a regular interval having fixed caption.

Additional Notes : You can also filter the images/items by providing required filter criteria in this tag:

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[<filter_criteria>]"/>

Please let me know if you have any query.

  • link to rotate images infinitely.
  • link to captify images.

Visual Studio 11 Beta - What's new in SharePoint Developer tools

Here are the most attractive features which are available/supported in Visual Studio 11 Beta:

1. SharePoint Lists and content types can be visually created using SharePoint List Designer in Visual Studio 11 Beta.

2. NowVisual Web Parts support sandbox solutions deployment

3. Silverlight web parts are available

4. SharePoint solutions can now be published to remote SharePoint server, no matter if it's on-primises or Office 365 (SharePoint Online), remote or local.

5. Full in-built support for performance testing of SharePoint Solutions in Visual studio.

6. Better intellisense and debugging support for Javascript solutions.

7. Right API intellisense for Sandbox solutions. So no need to worry if included API will work in Sandbox solution or not.

Quite interesting list !

For further details you can refer SharePoint Developer Team blog here.

Tuesday, May 8, 2012

Error occurred in deployment step ‘Recycle IIS Application Pool’: The local SharePoint server is not available.

While deploying a solution to sharepoint 2010, if user gets an error like "Error occurred in deployment step ‘Recycle IIS Application Pool’: The local SharePoint server is not available".

It means that account doesn't has sufficient rights to deploy a solution.

To solve the issue, you need to run Add-SPShellAdmin powershell command providing user name and content database GUID.

Syntax :
Add-SPShellAdmin -UserName user_name -database db_guid

[You can use Get-SPDatabase to get GUID for your content database. Make sure user running this command has permissions on SQL Server Database]

What it does?

i.) Add the user into WSS_Admin_WPG role
ii.) Provide him/her 'dbowner' and 'SharePoint_Shell_Access' permission in following databases :
  • Provided database in parameter.
  • SharePoint_AdminContent_<guid>
  • SharePoint_Config
I inspired to write this post from this link

Friday, May 4, 2012

Quick launch shows sites and page regardless of navigation settings

To resolve this issue, please make sure data source for quick launch navigation is surround by these tags:

     //Quick launch site map data source

See the sample code below:

<SharePoint:DelegateControl runat="server" ControlId="QuickLaunchDataSource">