Friday, January 31, 2014

Office 365 SharePoint 2013 - Blog Customization - List By Year

I got an opportunity to customize the Office 365 SharePoint 2013 Blog customization.

Here is how you can show the years list for blog like "Archive" and "Category"

This post is demonstrated on video:
The XSL file you need.
Here is the XSL code:

<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:param name="ManualRefresh"></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">RepForm3</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" />
  <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/>
   <xsl:when test="$dvt_IsEmpty">
    <xsl:call-template name="dvt_1.empty"/>
    <ul class="ms-core-listMenu-item static ms-noList link-style1">
     <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">
        <xsl:variable name="PostDateFormatted" select="ddwrt:FormatDate(@PublishedDate,1033,1)"/>
        <xsl:variable name="PostYear" select="substring(substring-after(substring-after($PostDateFormatted,'/'),'/'),1,4)"/>   
    <xsl:variable name="NewGroup" select="ddwrt:NameChanged(string($PostYear), 0)" />
    <xsl:if test="string-length($NewGroup)">
  <li class="static linkitem">
   <a class="ms-core-listMenu-item">
    <xsl:attribute name="href">
    <xsl:value-of select="concat('/Blog/Date/',$PostYear)"/>
    <xsl:value-of select="$PostYear"  />
 <xsl:template name="dvt_1.empty">


Step 1

Go to your blog site and edit the page

Step 2

Insert "Post" webpart

Step 3

Speicify XSL file in webpart settings

Step 4

Specify a proper title to webpart

Step 5

Update "Title URL" & "Description" so that clicking on webpart title don't take anywhere and a description that user will when mouse over to webpart title


Office 365 SharePoint 2013 Public Site - Allow Anonymous Users

I created the public facing site on Office 365 SharePoint 2013 but when I tried to access the site as anonymous user, I was redirected to authentication page.

I went to Site Permission settings, Anonymous permission was not there.

I started looking around for an option that could make the site open for anonymous and found this options that made the site open for anonymous. This option can also be used to take off from anonymous users:

Make Website Online option

Thursday, January 30, 2014

SharePoint 2013 Left Navigation Gets Hidden When Using Bootstrap 3

I was branding SharePoint 2013 and using Bootstrap 3.
When I gave QuickLaunch / Left Navigation to col-md-3 and main content to col-md-9, suprisingly on lower screen when it supposed to display full width it was getting hidden.

I figured out that QuickLaunch menu was floating on left by default so it was causing issue.

Here is the fix:

Hope it will help someone!

Sunday, January 26, 2014

SharePoint 2013 oData query _ModerationStatus field

Today I found some of the field whose internal name starts with a underscore chracter ("_") has "OData_" prefix that makes it  OData__ModerationStatus.
This prefix is only appears in oData query result.

The this link for list of special fields:

Saturday, January 18, 2014

ItemStyle.xsl - Clickable Title Showing Default View Form In Modal

This is customized item template for ItemStyle.xsl SharePoint 2013 CQWP showing only clickable title that shows default view form in modal. You can just copy and paste in ItemStyle.xsl file at the bottom (of course before </xsl:stylesheet> :) ) to test it:

<xsl:template name="ItemTitlePoupView" match="Row[@Style='ItemTitlePoupView']" mode="itemstyle">
    <xsl:variable name="SafeLinkUrl">
        <xsl:call-template name="OuterTemplate.GetSafeLink">
            <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
    <p class="anntitle">
            <xsl:attribute name="href">
              <xsl:value-of select="concat(&quot;javascript:SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', {url:'&quot;,$SafeLinkUrl,&quot;'})&quot;)"/>
            <xsl:value-of select="@Title"/>

SharePoint 2013 CQWP ItemStyle.xsl - Match today's date

Following code demonstrate how we can match "Modified" date of an announcement and output if date is today rather than show date. 

List of LCID:
For list of LCID and Format also thanks goes to this blog:

<xsl:variable name="AnnModifiedDate" select="ddwrt:FormatDate(@Modified,3081,1)"/>
<xsl:variable name="TodayDate" select="ddwrt:FormatDate(ddwrt:Today(),3081,1)"/>
<span class="anndate">
    <xsl:when test="$AnnModifiedDate = $TodayDate">
      <xsl:value-of select="$AnnModifiedDate"/>

This code converts the Modified and Current date to Australian date format (d/m/yyyy) and does the match.
If matched outputs "Today" else the date.

SharePoint 2013 - ItemStyle.xsl - How to get today's date

I was wondering how I can get today's date to use in customization of ItemStyle.xsl, here it is:

Put it in a variable:
<xsl:variable name="TodayDate" select="ddwrt:Today()"/>

Another example to create a span tag:
<span class="todaydate">
<xsl:value-of select="ddwrt:Today()"/>