15. December 2009  

After nearly 2 years and 4 months with my current company, I will start working for another one here in Singapore from mid-January onwards.

I definitely learned a lot during my employment here at my current company, and gained a lot of experience in different fields. It was a great work environment, with great colleagues and a very interesting job scope.

My new job will be very similar to my the old one, but with some more responsibilities. I'm already very excited about the opportunities this brings with it, and I'm looking forward to applying my knowledge and experience which I gained during the past nearly 2.5 years in a new environment.

technorati tags: , ,
 
04. December 2009  

Right now, there's a book warehouse sale organised by Penguin Books at the Singapore Expo.

I was hoping to get some good business books (I didn't....), but didn't even think about any IT books (which I got!). They had several very good books on various topics (Cisco related, Adobe related, Microsoft related, some Unix/Linux books, PHP, Ruby, ...), and to my surprise even three SharePoint books, which I bought:

SharePoint Books SharePoint Books SharePoint Books

If I had bought these three books on amazon.com, I would've paid a bit more than $110 (USD, that is). At the sale, I paid $10(SGD) each! At the current exchange rate, that's about $21.72(USD).

 
13. July 2009  

The SharePoint team has released a sneak peak into SharePoint 2010:

 http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/default.aspx

The preview is divided into three areas: Overview, IT Professional, and Developer

technorati tags: , , ,
 
30. June 2009  

I noticed some interesting, and in my case not desirable behaviour when I was exporting the results from a SharePoint survey to Excel: the order of the questions in Excel differed from the order in SharePoint.

Some further analysis showed the following:
When you export to Excel, the order is determined by the creation time of a question, so the questions that were create first appear before the others. This even happens after you reordered your questions in your survey, which was what I did.

To give an example:
I create a survey with 3 questions in the order 1,2,3:
SharePoint Survey Questions Order

I then reorder them to 3,1,2:
SharePoint Survey Questions Order

If I export them now to Excel, the order of the columns however is still 1,2,3:
SharePoint Survey Questions Order

So in case you need to export to Excel and don't want to reorder your columns there afterwards, make sure you got the order right when you create your survey questions.

technorati tags: , , , , ,
 
15. May 2009  

Recently, I wanted to display some small statistics about how often people participated in the discussions in a SharePoint discussion board. I wanted to show the total number of postings in a small web part. The solution for this requires SharePoint Designer, as it makes use of the Data View Web Part.

I'll show the steps to display the list of people who participated in a discussion board and their total number of postings from the beginning:
First, I create a new blank site and add a discussion board:
Discussion Board Postings

I open the site in SharePoint Designer and add a Data View Web Part into the right web part zone. In the Data Source Library to the right, I select the discussion board, and then Show Data:
Discussion Board Postings

Right now, only the discussion topics are contained in the rows returned, but not all postings. To change this, click on the name of your Data Source, in my case Discussion Board:
Discussion Board Postings

In the following dialog, select RecursiveAll under Item and folder scope:
Discussion Board Postings


Next, select Created By (if wanted also additional fields), and choose Insert Selected Fields as.... Multiple Item View. The Data View Web Part is now populated with the selected fields.


In the Data View Web Part, select Sort and Group from its menu:
Discussion Board Postings

Sort by Created By, and select Show group header and Collapse group by default:
Discussion Board Postings

You will get something similar to the left part of the following image:
Discussion Board Postings
I then removed the unnecessary parts as seen in the image above, and added a new column for the number of postings. 


Click inside the cell underneath Postings, and in the source code add the following line into it:

<xsl:value-of select="count($nodeset)" />


Next we need to change the query fetching the rows. Find the following line 

<xsl:with-param name="nodeset" select="msxsl:node-set($dvt_Rows)/root//Row[((@Author)=$groupheader0 or ((not(@Author) or @Author='') and $groupheader0=' '))]" />

and replace it with 

      <xsl:with-param name="nodeset" select="msxsl:node-set($dvt_Rows)/root//Row[substring-before(substring-after(string(@Author),'userdisp.aspx?ID='),'&quot;')=substring-before(substring-after(string($groupheader0),'userdisp.aspx?ID='),'&quot;')]" />

 

That's it, the result will look like this:
Discussion Board Postings

 

The drawback at the moment here is that it doesn't sort by the number of Postings, which I haven't found out (yet) how to do. 

 
08. May 2009  

Update 14 December 2009: Improved slightly, first the tags are stripped, then content shortened. 

Displaying a textual preview of an wiki's article in SharePoint is quite easy. All one needs to do is create a data view web part with SharePoint Designer (free since April 1) and have it display the field 'Wiki Contents' from the wiki's pages library. Now the contents of this field contain all the HTML markup of the article, which we now need to strip of the tags and also reduce in size.

In order to strip the 'Wiki Contents' of the HTML markup, we need to apply XSLT. In the xsl:stylesheet section of the data view web part, add the following template:

<xsl:template name="strip-tags">
  <xsl:param name="text"/>
  <xsl:choose>
    <xsl:when test="contains($text, '&lt;')">
     <xsl:value-of select="substring-before($text, '&lt;')"/>
     <xsl:call-template name="strip-tags">
      <xsl:with-param name="text" select="substring-after($text, '&gt;')"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="$text"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Afterwards, find <xsl:value-of select="@WikiField" /> and replace it with the following

<xsl:variable name="strippedWiki">
  <xsl:call-template name="strip-tags">
     <xsl:with-param name="text" select="string(@WikiField)"/>
  </xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(substring($strippedWiki,1,800),
        substring-before(substring($strippedWiki,801,850),' '))"/>
<a href="{@LinkFilenameNoMenu}" mce_href="{@LinkFilenameNoMenu}">....(more)</a>

This calls the template above with a part of the wiki article's content (replace 800, 801, and 850 accordingly if you want to show more/less) and adds a link to it add the end. The concetanation here is to avoid having a word cut off by adding text add the end of the first substring until the first space is encountered.

The result looks like this:

sharepoint wiki preview
technorati tags: , , , ,
 
23. February 2009  

Update: There was a mistake in the IsInCurrentWeek formula (ignored the year....), the updated version is now here. 

Recently a colleague asked me for some modifications on one of her calendars. Basically, she wanted to display only the events of the current week in the corresponding web part.

In order to get the default web part to do this, I had to find out whether a calendar entry is in the current week or not. At http://blogs.microsoft.co.il/blogs/sps/archive/2008/06/26/how-to-calculate-week-number-by-sharepoint-formula.aspx, I found the necessary information to calculate the week number of a given day.

What I did was to create 4 calculated columns for the calendar, namely WeekNumberStart, WeekNumberEnd, CurrentWeek, and IsInCurrentWeek. WeekNumberStart and WeekNumberEnd calculate the week number for the start day and end day of a calendar. IsInCurrentWeek returns a string (“Yes”, “No”) by comparing the current week number from CurrentWeek with the one from WeekNumberStart and WeekNumberEnd, and also checking if it lies in between these two.
CurrentWeek itself is actually a redundant value, as it is the same for all entries. So instead of using this extra column, the calculation could’ve also been used in the IsInCurrentWeek directly. I chose to create the extra column to make the calculations more readable at the expense of the redundancy.

The two calculated columns WeekNumberStart and WeekNumberEnd are calculated with the following formular (Replace Start Time with End Time for WeekNumberEnd):

=INT(([Start Time]-DATE(YEAR([Start Time]),1,1)+(TEXT(WEEKDAY(DATE(YEAR([Start Time]),1,1)),"d")))/7)+1

This calculated column returns a number, namely the actual week number of the given day.

The same calculation is done for CurrentWeek, but with SharePoint’s built-in Today as the given day:

=INT((Today-DATE(YEAR(Today),1,1)+(TEXT(WEEKDAY(DATE(YEAR(Today),1,1)),"d")))/7)+1

As SharePoint doesn’t allow to use Today in a calculated column, I had to create a single line of text column called Today first before I could create the CurrentWeek column. Afterwards, it could be deleted again.

Lastly, IsInCurrentWeek is used to check if the WeekNumberStart or WeekNumber end are equal to CurrentWeek, or if CurrentWeek falls between these two.

=IF(OR(AND(YEAR([Start Time])<Year(Today),YEAR([End Time])>Year(Today)),OR(YEAR([Start Time])=Year(Today),YEAR([End Time])=Year(Today))), IF(WeekNumberStart=CurrentWeek,"Yes",IF(WeekNumberEnd=CurrentWeek,"Yes", IF(WeekNumberStart<CurrentWeek,IF(WeekNumberEnd>CurrentWeek,"Yes","No"),"No"))) , "No")

On the web part to display the calendar, the filter settings are updated to IsInCurrentWeek Equals to Yes

 The final result: