Ten Themes for SharePoint in VSeWSS Projects

By Namwar Rizvi - Last updated: Wednesday, March 25, 2009

Ten new SharePoint themes have been released by Microsoft to help SharePoint designers to make new sites more efficientlty. You will find them as individual  Visual Studio 2008 projects which when deployed to SharePoint offer fresh new designed themes you can use in your projects. 

Themes can be downloaded from here

Following is a preview image of these themes (from Sharepoint.microsoft.com)

Filed in Guidance, Templates • Tags: , , ,

Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 – Mar 2009 CTP

By Namwar Rizvi - Last updated: Tuesday, March 24, 2009

A goow news for SharePoint community 🙂 Microsoft has releasesd the Mar 2009 CTP of Windows SharePoint Services 3.0 v1.3. This CTP contains excellent set of functionalities and saves your precious time. You can download the extensions from here

Following is the overview as released by Microsoft

This is the SharePoint developer tools for Visual Studio 2008. These tools are suitable for use with Windows SharePoint Services 3.0 or Microsoft Office SharePoint Server 2007. It includes project and item templates for common SharePoint artifacts, it includes build, packaging and deployment for SharePoint solutions and it includes the SharePoint Solution Generator which creates a new Visual Studio 2008 project from a SharePoint site.

The tools provide item templates for List Definition, List Definition from Content Type, Content Type, Field Control, Web Part, Module, Root File, Template, Event Receiver, and List Instance. It provides project templates for Team Site Definition, Blank Site Definition, List Definition, Web Part and Empty. It works with Visual Basic .NET and C# languages and a comprehensive user guide is included. It does not include the SharePoint Workflow templates as they are built in with Visual Studio 2008.

New features in version 1.3 include:

Filed in Debugging, Guidance, Templates, Tools • Tags: , , , , , , ,

Display filtered files list without creating new views

By Namwar Rizvi - Last updated: Sunday, March 15, 2009

You may have noticed already thatwhen you try to save file in any document library from Microsoft office applications, you get a nice view of files list inside file dialog box like below:


This view is just an html generated by the owssvr.dll file located in _vti_bin folder of your virtual server. You can use this to display list of files on your web page by using Page Viewer Web Part. Say, for example, you want to display all the .doc files of Shared Documents documents library then URL will be


You will get the following display in your Page Viewer Web Part


Following are the details of query parameters:

  1. location=document library name
  2. dialogview=FileSave (there may be other options but for the list, we will use this options)
  3. FileDialogFilterValue =specifies what type of files will be displayed in the list, feel free to specify any file filter as you normally specify in windows file dialgogue boxes. For example, for all xls files starting with a can be listed by specifying the filter value as a*.xls.

Filed in Management • Tags: ,

Display "! Updated Today" indicator just like "! New" icon in Document Library

By Namwar Rizvi - Last updated: Sunday, March 1, 2009

One of my cliens wanted to display “! Updated Today” icon (just like New icon) against all of those documents which are updated today so that their users can easily identify these documents. Since the customer just wanted this behaviour in some of the document libraries instead of all of them therefore, I opted to update the “AllItems.aspx” in Sharepoint Designer. By using a few lines of xsl code, I was able to achieve it. Following is the step-by-step procedure:

  1. Open the target page (normally it will be “AllItems.aspx”) in Sharepoint Designer
  2. Right click the ListViewWebPart and select Convert to XSLT Data View”
  3. context-menu

  4. Switch to Code view and search for 
    <xsl:if test="ddwrt:IfNew(string(@Created))"><IMG SRC="/_layouts/1033/images/new.gif" alt="New" /></xsl:if> 
  5. press Enter after the closing tag of above line i.e.  </xsl:if>
  6. Insert the following lines 
  7. <xsl:if test=”ddwrt:FormatDate(string(@Modified), number($Language), 1)=ddwrt:FormatDate(ddwrt:TodayIso(), number($Language), 1)”>

    <xsl:if test="ddwrt:FormatDate(string(@Modified), number($Language), 1)!=ddwrt:FormatDate(string(@Created), number($Language), 1)">

    <span style="background-color:maroon;color:white"> ! Updated Today</span>




  8. Save the file and refresh your browser.Bingo!  you will start getting “! Updated Today” indicator against all those files which are updated today similar to following:
  9. document-library1

Filed in Uncategorized

Launch Office Application from SharePoint Portal Page

By Namwar Rizvi - Last updated: Thursday, February 26, 2009

Business Problem:

    One of my client wanted to have links on main portal to launch Microsoft Office key applications i.e Word, Excel, Power Point and Outlook directly by clicking on a link at portal page.


I searched the net and find a nice solution here It is a small piece of JavaScript code which you can put in CEWP and use it on your portal page. I added some formatting and relevant icons against the office applications and wraps it up in a webpart dwp file. After importing this web part on your page, you will get something like this:


You can download the dwp file from here

Filed in Customization, JavaScript, Uncategorized • Tags: , , , ,

Add Custom context menu by Javascript in SharePoint

By Namwar Rizvi - Last updated: Thursday, February 19, 2009

If you want to add a custom menu item in Document Library’s item context menu just by Javascript without going into the details of  adding any new feature or writing your own assembly then here is a quick trick:

  1. Add a new Content Editor Web Part on your target page
  2. Open the tool pane of the web part
  3. Click Source Editor and add following Javascript code in it
    <script language="javascript">
    function Custom_AddDocLibMenuItems(m, ctx)
      var strDisplayText = "Say Hello World!";
      var strAction = "alert('Hello World')";
      var strImagePath = "";
      // Add our new menu item
      CAMOpt(m, strDisplayText, strAction, strImagePath);
      // add a separator to the menu
      // false means that the standard menu items should also be rendered
      return false;
  4. Click Save
  5. Click OK in toolpane to close it
  6. Now open the context menu of an item of the document library and you will see your new menu item in it similar to following


Please note that this menu item will only be visible on your target not on every page of your document libraries.

Filed in Uncategorized • Tags: ,

Got MCTS Status Today! – Exam 70-542 Done!

By Namwar Rizvi - Last updated: Saturday, February 7, 2009

Today, I got the status of MCTS: Microsoft Office SharePoint Server 2007 ― Application Development. This exam focuses on Application Development for Sharepoint Portal Server by utilizing enterprise features. If you are preparing for this exam then I will recommend you the book Professional SharePoint 2007 Development from Wrox publishers.

Main topics covered in this exam are:

  1.  Business Data Catalog (Definition, management etc.)
  2. Data Connection Management, Trusted locations
  3. Audience Management
  4. User Profiles Management
  5. InfoPath Form Server
  6. Records Management
  7. Documents Management
  8. Excel Web Services

You will need to do hands on practice by writing code to make sure you understand object model and context management of API calls.

Good Luck!

Filed in C#, Certification • Tags: ,

How to fix Cannot run Windows SharePoint Services on this page?

By Namwar Rizvi - Last updated: Tuesday, February 3, 2009

If you are getting “Cannot run Windows SharePoint Services on this page…” error while trying to upload multiple files in Sharepoint and you are banging your head against the wall then don’t worry you are not alone 🙂 It is the shared pain by many of us facing the legacy errors of FrontPage Server extensions in Sharepoint. This error occurs if you modify Upload.aspx located in layouts folder. First and foremost, do not modify the standard upload.aspx or any other standard file in Sharepoint as it is not supported by Microsoft and your change will be overwritten by any new service pack or hot fix.

So having said that, if you have made a copy of upload.aspx, customized it and trying to use it then you may certainly face this error. Following is the solution to fix it:

  1. Open your copy of upload.aspx and search for 
    <input TYPE="hidden" NAME="_charset_" VALUE="utf-8"><!--webbot bot="FileUpload" endspan i-checksum="45034" -->
  2. Update the following string as follows
    <input TYPE="hidden" NAME="Cmd" VALUE="Save"><!--webbot bot="FileUpload" endspan  -->
  3. Save your file.
  4. Reset IIS
  5. Try to use the file in Sharepoint and Bingo!!!! no more error :):):)
Filed in Uncategorized • Tags: , , , ,

Verify your code with SharePoint Dispose Checker Tool

By Namwar Rizvi - Last updated: Monday, February 2, 2009

Today, a new tool  SharePoint Dispose Checker Tool  has been released at MSDN for checking your code against incorrect processing of IDisposable objects like. SPSite and SPWeb. This tool checks your assembly and identify potential problems of not disposing these objects. 

You can download SharePoint Dispose Checker Tool from here

and here is the great article from Paul Andrew (Microsoft Technical Product Manager for the SharePoint Developer Platform) about best practices and how to use this tool.

Filed in Bugs, Debugging, Object Model, Tools • Tags: , , , , , ,

How to get all available search contexts for the current site collection?

By Namwar Rizvi - Last updated: Monday, January 26, 2009

If you want to retrieve all available search contexts for the web site collection where your application is initiated then you can use the following code to get it

SearchContext searchContext = SearchContext.GetContext(ServerContext.Current);
Filed in Uncategorized