Pages

Tuesday, September 24, 2013

ddwrt:FormatDate bug - still in SP2013

OK, firstly, if you didn't know, SP2010 had a bug in the ddwrt:FormatDate function in XSLT where it assumes that you always use Locale: English (US). So if you live in any other part of the world you can't use this function.

Well, thanks to a bunch of other people and their posts, here, here, and kinda here, there is a way around this using even more XSLT.

So for me, I was calculating differences between dates using strings (yeah I know, probably not the best way but...) and because my Australian Dates were all over the place but I was always calculating them using yyyyMMdd I modified Elio's template for my own.

Hope this helps others, at least as a starting point. Oh yeah, and I hope one of these days MS get around to fixing the root cause!

<!-- ***************************************************************************** -->
<!-- This template fixes an issue where the US think they are the only ones on earth -->
<!-- NOTE: Returns date in yyyyMMdd -->
<!-- If you went to town implementing string manipulation templates to parse a date format out of a parameter you would -->
<!-- be able to return any formatted date, but I don't have the time at the moment -->
<xsl:template name="CustomFormatDate">
<xsl:param name="dateValue" />
<xsl:param name="monthFormat" />
<xsl:param name="locale" select="3081" />

<!-- Split Date -->
<xsl:variable name="day" select="substring-before($dateValue, '/')" />
<xsl:variable name="month" select="substring(substring-after($dateValue, '/'), 1, 2)" />
<xsl:variable name="year" select="substring(substring-after(substring-after($dateValue, '/'), '/'), 1, 4)" />

<!-- Create US Date Format -->
<xsl:variable name="USDate">
<xsl:value-of select="$month" />/<xsl:value-of select="$day" />/<xsl:value-of select="$year" />
</xsl:variable>

<!-- Month Notation -->
<xsl:variable name="monthString">
<xsl:choose>
<xsl:when test="$monthFormat='MM'">
<xsl:value-of select="$month" />
</xsl:when>
<xsl:when test="$monthFormat='MMM'">
<xsl:value-of select="ddwrt:FormatDateTime($USDate, $locale, 'MMM')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="ddwrt:FormatDateTime($USDate, $locale, 'MMMM')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:variable name="twoDigitDay">
<xsl:choose>
<xsl:when test="string-length($day) = 1">0</xsl:when>
</xsl:choose>
<xsl:value-of select="$day" />
</xsl:variable>

<!-- Create Date -->
<xsl:value-of select="$year" /><xsl:value-of select="$monthString" /><xsl:value-of select="$twoDigitDay" />
</xsl:template>

Thursday, September 19, 2013

Filter web parts not working in SP2013

Recently I was building a new SP2013 site using the same techniques we had developed for SP2010, namely composite pages using query string parameters to filter on Master / Detail records. But we discovered that the filtering web parts were not filtering!

To get to the point, after much search around, turns out that for this feature to work, you need to ensure the ‘Server Render’ checkbox is enabled in the Miscellaneous section of the consuming web part.

To go even further, I would say that this field needs to be set for more than just this feature to work. XSLT doesn’t work properly if this isn’t enabled, and I’m sure there are other things that when they don’t work, will trace their roots back to this checkbox.

Thursday, September 5, 2013

Windows Workflow Manager Authentication

Although classic mode authentication is supported in SharePoint 2013, in reality you can only really use Claims. Workflow Manager 1.0 requires Claims-based authentication otherwise you will see all sorts of errors.

Thursday, April 18, 2013

Scripting User Profile Properties in SharePoint

Just can across a couple of great articles on how to script the creation and modification of the User Profile Properties. For those who are into repeatable process, this allows you to map out what properties you want in your environment and how you want users to interact with them. Then you can run the script through all your environments (assuming your AD/LDAP attributes are the same in all environments ;)) to configure all your farms accurately.

This one describes how to add new property mappings. ie. If you want a property called Pets that you want users to be able to fill in.
http://blogs.msdn.com/b/tehnoonr/archive/2010/11/22/mapping-user-profile-properties-in-sharepoint-2010-to-ldap-attributes.aspx

This one modifies existing ones (including new ones you create I guess) and allows you to set the other options around each property, like whether its alias, who can edit etc
http://www.c-sharpcorner.com/uploadfile/anavijai/modify-user-profile-properties-in-sharepoint-2010-using-powershell/

Reference material on SharePoint property constants that are used
http://msdn.microsoft.com/en-us/library/microsoft.office.server.userprofiles.propertyconstants_members.aspx

Thursday, February 7, 2013

Good SharePoint Blog

Karine Bosch has a great little blog that shows you how to create SharePoint-like Application Pages using the OOTB control templates and also has a great piece of source that wraps the Content Query WP's Select Site/List/Item dialog (LaunchPickerTreeDialog). Very handy.
http://karinebosch.wordpress.com/