Archive for the ‘Web Parts’ Category

Code Console Web Part

May 13, 2009 1 comment

Interesting project by Einar Otto Stangvik, Basically you can execute server side code using webpart directly using browser with SharePoint.

I should say  I haven’t tested it out but I can think of couple of ways it can be useful.

Click here for original blog post


(Jquery)Display Video in SharePoint Blogs from document library

March 24, 2009 4 comments

SharePoint Blogs OOB filters out all the html for embedding any kind of video in them. I use Windows live writer for my Blog post. I use one of the plug-in I think, but even though it wont embed the video within SharePoint it will show take a screenshot of  the video and link to the external site, which is fine for me.

To Display local intranet videos within blog takes bit of work, either hyperlink to media file or Content Editor web part for embedded code.

I using Jquery to accomplish this.

Instead of embedded we shall use Hyperlinks to media files and Jquery.Media plugin for turning them into inline videos.


1.Create 2 Document Libraries

  •  Media: To store all your media files.
  • Resources: To store JavaScript and other files.

2. Download Files.

3.Upload the Jquery JS and mediaplayer.swf to Resource Document library

4.  Edit Jquery Media JavaScript File . In Default Configuration section change location of mediaplayer.swf to the one you just uploaded. Save the file


5. Save and Upload Jquery Media to the Resources document library.

6. On Blog Home Page. Add a content Editor Web Part and Open Source Editor.

Add following script tags to it. (Change the src of javascript location to reflect the files you uploaded in steps above.)

<script type="text/javascript" src="/sharepoint/Sharepoint%20Blog/Resources/jquery-1.2.6.pack.js"></script>

<script type="text/javascript" src="/sharepoint/Sharepoint%20Blog/Resources/"></script>

<script type="text/javascript" >




7.Upload some media files to Media Library

Create a new blog post

in Body Section add a Hyperlink to a video you uploaded to Media library.


File Jquery Media Supports

* Supported Media Players:
*    – Flash
*    – Quicktime
*    – Real Player
*    – Silverlight
*    – Windows Media Player

For more information on Jquery Media click here

Note : If script doesn’t execute replace inline script with this :


function loadMedia() {





If that does not work  I would try this in inline script tags

$(document).ready(function() {



Get Current Page URL using XSL for Content Query Web Part

March 16, 2009 8 comments

I frequently write custom XSL templates for Content Query Web Part (CQWP) for Rolling up List Items. I use  CopyUtil.aspx for link items to to Display Form Pages which on close or after editing the items takes you back to default list item page instead of where CQWP is located.

You can either fix this by

  1. opening a item new window (target =”_blank”  in your href’s )

<a href=”{$DetailPageLink}” title=”{@LinkToolTip}” target=”_blank”>

2. Using Source attribute in your URL. SharePoint ListForm Pages use this to navigate back to location you arrived .

<xsl:variable name=”DetailPageLink” select=”concat($SafeLinkUrl,’&amp;Source=/myPage/CQWP.aspx’)” />
<a href=”{$DetailPageLink}” title=”{@LinkToolTip}”>

3. The Problem with above approach is, If I am reusing this template at different location(page or Site) I would need to recreate this template to just change the source attribute. Also in case you are moving XSL files between environments it could break.

To fix it you can probably use JavaScript to get your current Page URL. I won’t go over this. I will be using often ignored ddwrt xml namespace. (it is 2003 version article but most of the functions work ) and more

Read more…