Friday, July 31, 2015

"This content cannot be displayed in a frame" CRM 2015 online SharePoint 2013 online issue

Recently i got this error message when i tried to show SharePoint 2013 online page in iframe in CRM 2015 online. I tried different options like adding both the sites to trusted zone and enabled mixed mode content in internet explorer but it did not work.

To solve this issue i added the below tag in master page of the site collection's root site and it worked like a charm.

I added this tag after all the <%@ Register tags

<WebPartPages:AllowFraming runat="server"/>

This allows the site pages to be shown in iframe outside the SharePoint.

Happy Coding !!!

Thursday, June 4, 2015

XSLT date sorting in RSS viewer Web Part

Recently i encountered a issue while sorting in RSS Viewer web part. In xslt you can sort only on number and text data type and no option for date-time data type.

I wanted to sort data on pubDate of RSS feed. I tried using the SharePoint designer and use the sort and group option but  did not work.
The trick is to convert the pubDate to some format and then split the year, month and day and then sort on these 3 parts.

Example:

In my case pubDate is in this format Wed, 20 May 2015 07:02:09 +0200
I format this using FormatDate(pubDate,number(2057),1) and output is 20/06/2015.
Then split the year 2015, month 06 and day 20 using substring method and then sort these respectively.

You have to use the xsl:sort under RSSMainTemplate.body template after the xsl:for-each.

Source Code:

<xsl:for-each select="$Rows">
<xsl:sort  order="descending" select="substring(ddwrt:FormatDate(pubDate,number(2057),1),7)"></xsl:sort>

  <xsl:sort  order="descending" select="substring(ddwrt:FormatDate(pubDate,number(2057),1),4,2)"></xsl:sort>
  <xsl:sort  order="descending" select="substring(ddwrt:FormatDate(pubDate,number(2057),1),1,2)"></xsl:sort>


Happy Coding !!!

Wednesday, February 11, 2015

Create External Content Type in SharePoint 2013 online from on-premises SQL Server


In this post i will explain you how to create a external content type in SharePoint 2013 online from a on premises Sql Server

1.       Create and Deploy OData Services to any server that can be accessed on internet


1.       Create BDC Model using Visual Studio

1.       Go to SharePoint Admin Center

a.       Click BCS from left menu and click Manage BDC Models and External Content Types


b       Choose BDC Model from drop down and click import

.


c.       Import the BDC model which you have extracted in Step 2
d.      Select the external content types from the drop down and choose your content type that is imported from the BDC Model and click set object permissions. Permissions are required so that users can read the data using this content type


1.       Create External List from this content type

Click add an app and then choose external list from the apps and then select the external content type for the data source of this list.