Monday, November 30, 2009

Displaying thumbnail using DataViewerWebPart

Displaying thumbnail using dataview webpart may tweaking In order to display thumbnails from a picture library.

You may receive XML errors if you try to do following steps
1. Drop listview webpart for picture library showing thumbnail and name of image
2. Right click and convert it to DataViewWebpart

So you may probably need to do following to resolve it.
1. Drop list view webpart and change its view to show name and url of image.
2. edit your file and replace XSL for displaying URL with following code to display thumbnail.
There is a limitation in a code that it will not be able to diplay thumbnail if you repeat file extension in your file name. So if your file name is like name.gif.gif it will not be able to display its thumbnail.

<img border="0" src="{concat('/',@FileDirRef,'/_t/',

Sunday, November 29, 2009

Write custom workflow for content approval

In order to write custom workflow for content approval you may need to do a lot depending on your requirements but following are few useful tips that may help you to to it quickly

1. How to approve list item from your code

In order to approve list item from your code you need to need to modify list item's moderation status using following line
Item.ModerationInformation.Status = SPModerationStatusType.Approved
Where Item is your list item

2. In order to start workflow automatically on item publishing event
You need to select following option while associating custom workflow with your list
"Start this workflow to approve publishing a major version of an item"
You may not find this option with your custom work flow if you haven't placed following configuration in your wokflow meta data while defining work flow.

<Workflow .... .> .......... <MetaData> <InitiationType>

InitiationType> </MetaData> </Workflow>

Friday, November 27, 2009

General correlation token related issues with CreateTaskWithContentType

You may encounter different issues while working with windows workflow foundation if you have not initialize you correlation token correctly or not configured you activity properly.

When you enable tracing or start debugging your workflow you may get following.

CorrelationToken Uninitialized for {corelationtokenname} owner activity {Task Name}

following configuration needs to be checked in order to rectify above issue.

1. Check "Correlation Token.Owner Activity" is set to current state
CreateTaskWithContentType should not run with shared workflow correlation token. You should define separate correlation token for all task activities. The owner of defined correlation token should be your activity.

2. Check all related activities e.g. OnTaskChange etc has same correlation token
When you utilize CreateTaskWithContentType activity you may need to place few more activities e.g. OnTaskChange, CompleteTask etc. Activities related to CreateTaskWithContentType activity should have same correlation token assigned.

3. Check that content type is added (enabled) in your task list
When you use CreateTaskWithContentType with custom content type you may get this issue if content type is not added in your task list. In this case you will have to add your content type in your task list using following steps
- Go to list setting screen of your task list
- Allow management of content type from advance setting link
- Add your custom content type in task list

Tuesday, November 17, 2009

Sharepoint : How to set content approval status programatically

There are business scenarios when we need to programmatically set content pusblishing status of an Item. Examples would be the custom workflow for publishing or content approval. Following simple line of code can be used to set approval status.

item.ModerationInformation.Status = SPModerationStatusType.Approved;

Sunday, November 15, 2009

How to query data from multiple sharepoint lists

Share point provide two mechanism for querying data from multiple share point lists

  1. SPSiteDataQuery
  2. FullTextQuery

Following link on msdn explain usage for SPSiteDataQuery

Friday, November 13, 2009

Installing Sharepoint Server on Windows 2008

Windows 2008 does not support installation of Share point Server 2007 without Office/WSS Service pack 1. Therefore when you try to install share point setup on Windows 2008 machine it will give you an error that service pack is required to run this installation.
In order to run installation on windows 2008 machine you need to perform following set of activities.

First download WSS Service Pack 1 and Office Sharepoint Server 2007 Service Pak 1 from Microsoft site.

Copy all files from installation CD to local disk.

Open command prompt and navigate to folder where you have downloaded service pack1 for WSS and Office server and run following commands
wssv3sp1-kb936988-x86-fullfile-en-us.exe /extract:C:\WSSSP1
officeserver2007sp1-kb936984-x86-fullfile-en-us.exe /extract:C:\MOSSSP1

Copy all files you extracted in last step i.e. C:\WSSP1 and C:\MOSSSP1 to Updates folder of Sharepoint installation (at local disk)

Now run sharepoint setup from your installation files in your hardisk. It should run properly.

Basically Windows 2008 require you to install Sharepoint setup file with SP1. Sharepoint setup looks in updates folder and applys those updates with installation so as we copied extracted files of SP1 in updates folder of shrepoint setup it will automatically deploy those files and will not give any error.

Wednesday, November 11, 2009

Using SQL Reporting Services with in Microsoft Sharepoint in native Mode

If you need to display Reports developed using SQL Reporting services there
are two options. Either you use you Share point Server in integrated mode with
SQL Server Reporting services or you may use it in Native Mode. Following
defines the steps you need to perform in oder to use reports in Native Mode.

Microsoft provide report explorer and report viewer web part to display and
browse reports deployed at MS SQL Server Reporting Server. But these web parts
are not installed by default so you need to download and install reporting
server add on (SharePointRS.msi) following link may be used for
downloading SQL Server Add-on from Microsoft site.

Now even if you installed the addon it will deploy necessary cab files in your
system but web part will not be activated automatically and you need to run
following stsadm command in order to activate and utilize web parts

"%SystemDrive%\Program Files\Common Files\Microsoft Shared\web server
extensions\12\bin\stsadm.exe" -o addwppack -globalinstall -force -filename
"C:\Program Files\Microsoft SQL Server\90\Tools\Reporting

After running above command reporting server web part will be
available in miscellaneous group.

Monday, November 9, 2009

Favourite Quotes

  • The best way to predict the future is to invent it.
  • Make everything as simple as possible, but not simpler. -- Albert Einstein
  • Any fool can make things bigger, more complex, and more violent. It takes a touch of genius and a lot of courage to move in the opposite direction. -- Albert Einstein
  • Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. -- Albert Einstein
  • Trust yourself. You know more than you think you do. -- Benjamin Spock

Monday, November 2, 2009

Sharepoint - How to design printer friendly pages

I was thinking about adding support for printing my content pages in my share point site. As I have done this before in my custom side so I utilize same idea for hiding content displayed in my master page in print view. I created a css file and published in my style library and add css link in my master page with media set to print

<link href="[cssfilelink]" rel="stylesheet" type="text/css" media="print" /&gt

Then I added following 4 css classes in my stylesheet. After finishing this when I print my sharepoint page from browser it autmatically removed master page section and print only content area.





Any suggestion or better strategies for achieving above is welcome

SQL Server 2005 Reporting Services using Visual Studio 2008

Reports for SQL Server reporting services requires Visual Studio 2005 on your machine. So even if you have Visual Studio 2005 you will need to install Visual Studio 2005 for development of your SQL Server 2005 Reports.


Friday, October 30, 2009

Sharepoint Workflows / ASP.NET - Logging using diagnostic traceing

One of the coolest feature in is its tracing. Good thing is that it can be utilized in sharepoint as well and provide an easy way for logging inside workflow foundation.
You just need to add following in you sharepoint web.config file

<add name="System.Workflow LogToTraceListeners" value="1" />
<add name="System.Workflow.Runtime.Hosting" value="Verbose" />
<add name="System.Workflow.Runtime" value="Verbose" />
<add name="System.Workflow.Runtime.Tracking" value="Verbose" />
<add name="System.Workflow.Activities" value="Verbose" />
<add name="System.Workflow.Activities.Rules" value="Verbose" />
<add name="[Your namespace]" value="Verbose" />
<trace autoflush="true" indentsize="4">
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Output.log" />

and use following command in your code for sending log to your file for your logging


Thursday, October 29, 2009

Lotus Notes Email search - Searching Email to Notes client

When configuring lotus notes content source with sharepoint server you will noticed that search results return urls for lotus notes document. These URL transfer controls to lotus notes web access so that user can access his search email and look at its content.

There are few scenarios when user will not like to use webaccess and would like to open searched emails in lotus clients.

1 - Intranet Environment when all users accessing sites have lotus client installed.
2 - Company policy to restrict web access to all users.

Following are step for configuring sharepoint to display Lotus notes document URLs to Lotus notes client instead of lotus notes web access.

1. Goto shared service provider.
2. click search settings.
3. click server name mapping.
4. Add new mapping with following details
a. Address in index : http://[Lotus server name]
b. Address in search result : notes://[Lotus server name]

Please notes that lotus notes client will be required on all end user machine for opening emails.

Tuesday, October 27, 2009

Configuring sharepoint search to crawl lotus notes emails and database

Recently I was assigned with an assignment to integrate/configure moss so that it can crawl the lotus notes database and provide search mechanism to moss users. Following are some really really useful links for that

Following links on tech net are helpful for achieving the 90% of functionality.

The trickiest part of solution is to select the correct field of person view in creation of notes mapping database. As that information is not clear in above technet article.
Creation of mapping table and setting/picking up lotus id (using owner field of person view) is well defined in following POC.

Another trickiest part that I face was that you need to explicitly assign default security setting to reader by clicking document properties of security mapping views.

I have tested that lotus protocol handler is working fine with
Lotus 6.0 client
Lotus 7.0 client
and Lotus 8.5 client

I have tested this with following domino server
Domino 7.0
Domino 8.5

An interseting thing was that even I managed to integrate it properly but face strange errors in adding notes content sources using moss UI (using SSP).

I downloaded search admin utility from following link to add content and it worked great for me

Another added feature of above utility that I discovered later is that it allow assigning multiple domino database as a single content source. Which remove that restriction of enabling search on maximum of 500 notes databases. so if you use standard database for adding content database you will not be able to search more than 500 notes database. But this utility will allow searching on 500X500 databases

Sunday, October 25, 2009

Sharepoint 2007 - Tracing if variation crashes

Sharepoint system will not provide any alert or notification to user if any thing crashes in varaition system.
e.g. If any issue occurs it will not copy pages but you will be noticed that later when you will find broken links on your site.

It is recomended that administrator checks logs after publishing new contents to see if everything working as per expectation. Varaition logs can be location in site settings at your top level site.

If you think you are getting unexpected behaviour and your logs are not showing any useful information you may further investigate logs in "hive 12" i.e. "[Program Files]\Common Files\Microsoft Shared\web server extensions\12". You may check status of your scheduled job for locating any issues in variation. If you found that issue is due to execution of your job restart Windows sharepoint timer service using services console "services.msc" to fix issue.

Wednesday, October 21, 2009

Sharepoint - Issues with language selection in using MOSS variations

While working with MOSS varaitions you may noticed that you will not find any mechnasim for switchin youg language i.e Language selection will be missing on you page. This is bacuse the language selection is disabled by default.

For enabling language selection you need uncomment a line in VariationsLabelMenu.ascx mnually. It can be located at "[Program Files]\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\" folder.

you have to uncomment line for language selection in "VariationsLabelMenu.ascx" to enable language selection on your MOSS site

Monday, October 19, 2009

Sharepoint 2007 (MOSS) - Multilingual Implementation issues using variations

Microsoft Sharepoint Server 2007 (MOSS) provides multiplingual functionalities using its language pakages and variations. When proper language packages are installed you can use power of variation to build multiligual side.

The way variation is designed, It provide you alot but you still need to think on several points and issues while designing your site structure using MOSS Varaition.

Variation simply copy pages from one site to another and provide you functionality to maintain two copies of sites but sharepoint list and other structures remains in master site and will give you un anticipated behaviour.

When you create variation label it will create sites with in your varaition root with selected local and sharepoint will set culture of site.

Following are the problem that you may need to think on while woking with mutlilingual sites that provides more then content publishing.

1. Deployment of custom workflows.

Workflows associated with lists in sharepoint, when you design any custom workflow it will be binded with either a list in English site or Other Language site. so out come of workflows will be in one language and lot of custom components will be required in order to support it.
If you use out of box workflows, the porblem remain same.
So you need to be very carefully in placing your sharepoint lists in multilingual environment.

2. Deployment of sharepoint Content except pages.

If you deploy any out of box feature that will be deployed in sites separately. i.e. If you are thinking of deploying surveys the surveys will be deployed separately on each language site and will not have any association. Say we have two sites in English and French then survey list needs to be created separately in both sites. These will be totally in dependent you need to create survey in both language manually and out of box functionality doenst provide any mechanism to show result.
The similar behavior will be noticed in all othey contents and one needs to be very careful while designing shepoint multi lingual sites

Sunday, October 18, 2009

Sharepoint Web Control - Validating date time control (SPDateTimeControl with validators)

When working with Sharepoint Controls you may experience different behavior sometime as anticipated with any other controls library. I was thinking of doing some date validation and found some interesting fact with SPDateTime Control.

Few were not relevant to me so I didnt looked up them but I need to put required field validator for my mandatory field. I noticed that required field validator included in libaray was not working. After looking at member properties I found that there are properties included in controls for handling this

1. IsRequiredField
2. ErrorMessage

I used above fields and it worked for me nicely. The second task was to control invlaid dates entry from user. I thought it would be built in in the control and my guess was right with some exception. Sharepoint was handling this but for some reason it was not controlled at client side. I checked SPDateTimeControl.IsValid at server side and it worked for me.

Though it was working on server side I decided to stop false entry at client side for better GUI. I placed regular expression validator but it was not workin again. I did some research and find a soloution fo it i.e in ControlToValidate property place [ControlName]$[ControlName]Date instead of control name and it will solve issue

Wednesday, October 7, 2009

Starting child sharepoint workflow from a custom parent workflow

In case you need to encounter a case when you want to run child work flow from you parent share point work flow the obvious option would be the invoke Work flow activity.

It is out of box and run asynchronously naturally same goes in my mind. I tried it in my parent work flow and result was very strange. Invoke work flow activity works fine but none of the child flow get started.

I tried debugging and found several errors generated by work flow runtime few of them are mentioned below

System.Workflow.Runtime Information: 0 : CorrelationToken Uninitialized for owner activity
System.Workflow.Runtime Information: 0 : CorrelationToken Uninitialized for owner activity
System.Workflow.Runtime Critical: 0 : Uncaught exception escaped to the root of the workflow.
In instance in activity
Inner exception: System.Workflow.Runtime.Hosting.PersistenceException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.SaveWorkflowInstanceState(Activity instanceState, Boolean unlock)
at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
--- End of inner exception stack trace ---
at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
at System.Workflow.Runtime.WorkflowExecutor.ProtectedPersist(Boolean unlock)

I did lot of searching on and find an interesting article ( that help to to divert my attention to other workarounds

Now I start believing that invokeWorkflow will not work for me and looked for alternative and find an easy way to activate flow using Code Activity.

I simply write following code and luckily it did the same job as was expected.

SPWorkflowAssociationCollection associationCol = this.workflowProperties.List.WorkflowAssociations;
foreach( SPWorkflowAssociation association in associationCol )
if( association.BaseId.Equals(new Guid( "" ) ) )
this.workflowProperties.Site.WorkflowManager.StartWorkflow( workflowProperties.Item, association, "", true );

I hope this post will help other user to find solution quickly.

Tuesday, September 29, 2009

Using sharepoint webcontrols for desinging forms

I prefer using share point web controls for designing share point custom aspx form as they provide extended properties and also provide look n feel similar to out of box look n feel.

Following is an useful msdn link for getting help related to controls

They are easy to brand with overall theme and master pages. following are list of few important controls

  1. Text Box -- SharePoint:InputFormTextBox
  2. Drop down -- SharePoint:DVDropDownList
  3. People Editor -- SharePoint:PeopleEditor
  4. Date Time -- SharePoint:DateTimeControl (for details on validation)
  5. Labels -- Sharepoint:EncodedLiteral
Also there are few important webcontrol that can be utilized for creating sections and aligning controls

  1. /_controltemplates/InputFormSection.ascx for Defining section
  2. /_controltemplates/InputFormControl.ascx for defining control
following is a sample ascx for above

<%@ Assembly Name="Sample, Version=, Culture=neutral, PublicKeyToken=68802d514f1e9922"
<%@ Control Language="C#" AutoEventWireup="true" Inherits="SampleNamespace.Sample"%>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="/_controltemplates/InputFormSection.ascx"
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="/_controltemplates/InputFormControl.ascx"

<wssuc:InputFormSection Title="City" Description="Please select City." runat="server">
<wssuc:InputFormControl runat="server" LabelText="Country:" >
<SharePoint:DVDropDownList ID="cmbCoutnry" runat="server" AutoPostBack="true" />
<wssuc:InputFormControl runat="server" LabelText="City:">
<SharePoint:DVDropDownList ID="cmbCity" runat="server" />

<wssuc:InputFormSection Title="Dates" Description="Please select Dates." runat="server">
<wssuc:InputFormControl runat="server" LabelText="Start Date:">
<SharePoint:DateTimeControl ID="dtStartDate" runat="server" />
<wssuc:InputFormControl runat="server" LabelText="End Date:">
<SharePoint:DateTimeControl ID="dtEndDate" runat="server" />

Monday, September 14, 2009

How to upload a document in a document library programmatically

Recently I have encountered in a situation where I was required to upload few documents in a document library using my code. I found this fairly simple. Thanks to object model exposed by Microsoft.

Following code can be use to upload a document to document library with in specific site.

SPSite mySite = new SPSite("http://");

SPWeb spWeb = mySite.OpenWeb();

SPDocumentLibrary docLib = (SPDocumentLibrary) spWeb.Lists[""];

SPFolder folder = docLib.RootFolder;
using( FileStream fs = File.OpenRead("" ) )
SPFile file= folder.Files.Add("",fs);

I hope this will be helpful for those who wants to update documents and also needs to perform few custom actions on uploaded documents.

Sunday, September 6, 2009

Sharepoint workflow doesnt started automatically

I recently experienced this issues with my custom work flow designed using share point designer. Work flow didn't started automatically even though option was selected.

After doing a little research I found that issue was due to a security fix in WSS 3.o SP1
Therefore, after installing WSS 3.0 SP1, declarative workflows will not start automatically start if

1. The Windows SharePoint Services Web application runs under a user's domain account.
2. The user logs in by using this domain account.
3. The site displays the user name as System Account.

Wednesday, September 2, 2009

Configuring MOSS SSO Service

I was working on configuration settings for MS SSO service in MOSS. I think following information may also be useful for you.

You need to perform following simple steps for configuration of MS SSO Service.

1. Configure log on account to administrator user and run Microsoft Single Sign On Service.
2. Go to CentralAdministration->Operations->SecurityConfiguration->ManageSingleSignOn Serice.
3. Configure single sign on using available links i.e. Manage Server Settings, Manage Encrption Key, Manage Setting for enterprise application definition, Manage account information for enterprise application definition

For details please see following link

Tuesday, September 1, 2009

Sharepoint designer workflow : Getting data from user and storing it in workflow vari

Sharepoint designer workflows provide a great functionality using its out of the box activity for collecting data from user with in workflow.

When this action is used a form for getting data is created automatically as shown in images below

So if a user want to do some small customization the form will be available to him to do so.
The data collected in response to this action becomes part of task and can be used later in your flow for any decsion or can be utilized in other actions.

For e.g. I used data (comments) from user and update column of my list called comments.

This Action ask you three things

1: Data (Used for desinging question and creating form)
2: User (Used for assigning for to MOSS user)
3: Output Variable (List Item Id for fetching data later)

In my sample I clicked on data and add a field for asking comments from user. Assigned this to appropriate user and set output variable to a newly created variable collect3

I created a new workflow variable of type comments for storing user comments and add another action Set Workflow Variable for initializing my workflow variable with information provided by user.

Action set workflow variable provide two fields Workflow Variable and Value
I slected comments Varaible in workflow variable. Now real issues came when I need to pull up comments from my workflow form using list Item Id.

I performed following steps.
(Please note before moving ahead save your workflow by clicking on finish and repoen it by clicking on xoaml file)

1. Click on value
2. Selected Task in source
3. Selected Field "Rejection Reason" (This was the same field that I defined in my form earlier for collecting data from user)
4. It gives me two more option to select In Field I selected "Task:ID"
5. In Value I selected the WorkflowData -> Collect 3 (Same variable I used to kept the reference of my comments field)
as shown below

Now after defining above I managed to initialize my workflow variable with details collected from user in middle of workflow execution.

Sunday, August 30, 2009

Sharepoint Designer Workflow Calling a webservice function

Share point 2007 provide great functionality of work flows using share point designer. Sharepoint designer workflow provides different set of workflow activities to support users in designing their custom workflow. However designing is not limited to out of the box activities but it also provides power to create custom designer activities so that user can design their own logic according to their business.

In my case I was just thinking that if we can call a webservice from a sharepoint designer it would make a life easy for doing lots of things can can only be achieved by complex calculation from external systems.

There are two ways for this
1. Write your own custom activity
2. Use an extension from codeplex

I found following extension package very help full

and not only this but the deployment is fairly simple and help provided on following blog is also great.

Using this in conjunction with my SPD workflow it makes my life easy and I managed to call my webservice from SPD workflows with in 15 minutes (Installation and configuration ) :)

Saturday, August 29, 2009

Missing option for creating and extending webapplication in central administration over Windows 2008

When you administrator your MOSS protal on Windows 2008 you may notice an lots of strange issues. One of them is that create or extend web application will be hidden and not available on central administration site.

This is due to security restriction in windows 2008. You need to start Internet explorer as an administrator in order to access several option including option for creating and extending application.

Thursday, August 27, 2009

BadImageFormatException on MOSS 64bit environment

I have deployed my system developed on 32 bit to 64 bit production environment and was continuously getting bad image exception.

After a lot of drill down I found that the issue was due to deployment of custom web parts developed for share point site.

The issue was that I was referencing sharepoint 32 bit dll from my visual studios for accessing moss object model. Issue get resolved after replacing dll at production environment from (\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI).

Though the problem is resolved but as I have compiled custom web part with 32bit dll I still thing compilation with 64bit will be better option this will lead to an issue that development for 64 bit require 64bit machine.

Wednesday, August 12, 2009

How to configure your MOSS site on a mobile devices.

I was working with share point site and lots of documentation is available on the net that claims that every list and library in MOSS 2007 and WSS version 3 is capable of hosting mobile view. And we can see the site after appending m in site URL.

I tried that it was not working and giving 404 error.

After some research I found that
http:///_layouts/mobile/mbllists.aspx was displaying mobile view.

That proves that MOSS supports mobile view but still not sure why appending m in my site not working as expected. Any ideas will be much appreciated.

Tuesday, August 4, 2009

Creating a new page layout using MOSS

Page layout is a very powerful feature for setting up templates of your pages in a publishing site. You need to do following steps in order to create pages using page layout

Define Site Column (If you need to add columns for your page you will have to define columns)
Define Content Type (Need to define content type based on column)
Create Page Layout
Modify it in Share Point Designer
Publish Layout
Create a new page using published layout

Sunday, August 2, 2009

Issue in starting search service for a server in MOSS Farm

I was deploying moss in a farm environment and faced strange issues. My configuration was a webserver, a query server and a database server. I deployed sharepoint on a webserver and join index server in farm. But when I tried to start services on index server the status seems to be stucked at "starting".
I tried to disconnecting and reconnecting index server in farm but problem seems to be persitent.
I tried running following command
stsadm -o spsearch -action stop
to stop search service and then issueing
stsadm.exe -o execadmsvcjobs
and strangely my problem get resolved.
I don't know the reason as my timer service was working fine before issuing above commands.
I am not sure about the issue so any comments will be really helpful in this regards

Friday, July 31, 2009

Customize content query web part title link to redirect to source after pressing close on detail button

I observed that whenever we use content query web part and try to browse for the list detail page. It will come back to View All page of list instead of going back to where it was coming from.
I resolved it by doing following small changes in XSL style of content query web part to fix this as per my requirement and making it consistent with other list options.

Create custom style Please refer my earlier post "How to add a new indicator in a Content Query Web Part" for details of customization and before following these step

1. Edit ItemStyle.xl
2. Add following name space at the to
3. Add <xsl:param name=”PageUrl” /> just after name space declarations.
This will define a variable Page URL and populate it with current page URL
4. In your custom template add following line before processing of title
<xsl:variable name=”CustomPageLink” select=”concat($SafeLinkUrl,’&amp;Source=’,$PageUrl)” />
This will creat a new variable custom page link and add append current page url stored previously
5. Change SafeLinkURL with CustomPageLink in your title hyperlink.
<a href=”{$CustomPageLink}” mailto:title=”%7B@LinkToolTip%7D”&gt;

Wednesday, July 29, 2009

Issues in sending MOSS Alert from Document Library

Working with MOSS is great but sometime its make you crazy for small issues. That happens to me.........

I was working with document library and adding alerts on document for notification from MOSS whenever any new document get inserted in the system. I realize that few of my alerts were not working. i.e. I get the initial email from Sharepoint application telling me that you have subscribed for alerts but when I did insertion nothing comes up in my inbox.

I did lot of searching on internet but didn't find anything related to my issue. I have verified that my timer service was properly scheduled and running and my user has proper rights on document library.

After sometime I realize that my alerts were working fine with normal document library but were behaving abnormally when I try to us custom content type. So I remove required alert and add a new alert for all type of changes!!!!!!!!!!!!!!!!!!!!!!!!!!!! and suddenly I get flooded with alerts in my alerts.

Now I understand issue. Issue was that whenever I try to use custom content type. Sharepoint is not raising add alert and send change event instead.

I am not sure how to fix this issue but I have decided to add alert for addition and modification as a work around but does any body has any idea related to fix for this issue??

Monday, July 27, 2009

How to add a new indicator in a Content Query Web Part

Content Query web part doesn't show New! status indicator for new items by

In order to add new indicator a customization of content query web part will be

Following steps define the process for adding new container

1. Open SharePoint Designer and connect to your site

2. Browse to following path from SharePoint Designer
StyleLibrary->XSL Style Sheets->Item Style.xsl

3. Above xsl contains style templaes that can be selected from Content Query web
part's properties. You need to implement your custom template.

4. Copy any suitable template that can become base for your custom style. I
would prefer to copy default template

5. Paste template at the end of file before </xsl:stylesheet> end tag

6. Change name to your style name e.g. CustomStyle and match to custom style
e.g. Row[@Style='CustomStyle']

7. Need to add following declaration at top of the file with other declarations


8. search following at you custom template

<a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}">

<xsl:value-of select="$DisplayTitle"/>


and replace with

<a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}">

<xsl:value-of select="$DisplayTitle"/>


<xsl:if test="ddwrt:IfNew(string(@Created))">

<img src="/_layouts/1033/images/new.gif" alt="New" />


9. Publish file

10. Open your page with content query webpart and select custom style created in
last step

Saturday, July 25, 2009

Issue in share point 2007 or MOSS menu selection

We have discovered an issue in share point / MOSS top navigation menu while associating menu headings with share point system pages like list details pages. Reproducing an issue is simple using following steps.
1. Go to your site
2. Select Site Action->Site Settings -> Modify All Site Settings
3. Select Navigation under Look n Feel section
4. Click on Add Heading
5. In Title write test
6. In URL select browse and browse to any list in your site e.g. /Documents/Forms/AllItems.aspx
7. Click ok
8. Go to home page of your site
9. Select top navigation menu created in step 4
10. You will find that your page will open but first menu item will remain selected in your top navigation menu
We have noticed this issue while doing modification with system pages only. So workaround to this solution will be to create a separate page and use show pages list to display pages and hide any additional pages that you don’t want to display

Thursday, July 23, 2009

STSAdm AddSolution - Failed to extract the cab file

Building and deploying solution in moss sometime throws error “Failed to extract the cab file” This issue generally occurs due to inconsistencies in your ddf file. Please check following for correction.

1. Open your ddf file and location duplicate entries. If found remove them
2. Open your ddf file and check if there is any entries present in ddf not included in your project.
A simple way to check is by clicking on “show all files” button in “Solution Explorer” view of visual studio 2008 and check if any file exists in root file that is not included in a project (Files not included in project will not become part of your cab files). For such files either include them in project if required or delete them from folder.

Tuesday, July 21, 2009

Customizing Share point 2007/MOSS Top Navigation Bar/Menu Control (ASP Menu Control)

Customizing Share point 2007/MOSS Top Navigation Bar/Menu Control (ASP Menu Control)

For customizing menu we have two options.
Write a custom control and embed it in Master
Customize existing share point menu control

I believe that option 2 is better as compared to option
1. But you may face certain issues in implementing option 2. We have listed
solutions for few issues in customization of share point menu using share
point menu controls.

Please note that following solution is based on
assumption that solution will be for single level menu.

Simple Customization using CSS

If your customization is simple i.e. can be catered
easily by applying CSS. Option2 will be fairly simple and can be implemented
easily without any issues.

In above case you have following options

a)Modify existing CSS class.
Create new CSS class and associate it with
share point menu control

In case you are using existing CSS class you don’t need
to change anything in master page and need to do styling using CSS in theme
or your custom style sheet depending on your implementation. Share point
uses following CSS classes for menu styling

· ms-topnav: For styling normal menu

· ms-topnavselected: For styling selected menu

otherwise you will have to write your own CSS classes
and specify them in StaticMenuItemStyle and StaticSelectedStyle tag under
SharePoint:AspMenu tag in your master page.

Complex Customization

If you have complex customization like adding a
complete structure or template for your menu item don’t worry as asp menu
control used in share point supports rendering of menu item using templates.

ASP Menu control support static template definition for
rendering menu item. Please see example, we have change menu item with a
custom HTML table.

<SharePoint:AspMenu ….




<asp:hyperLink runat="Server" id="urlNav"
%>' Text='<%#
%>' />

As you have noticed that we have added NavigateUrl
property and Text property to bind properties from our data source.

Now there is an issue of template rendering i.e. it
render different HTML in fire fox as compared to Internet explorer so you
need to properly test your template HTML and need to do CSS tweaking in
order to fit your page in generally used browser.

One of the biggest issue in using static item template
is that it only provide definition of menu template instead of separate
definition of static item template for normal rendering or selected menu
item rendering. Therefore if you used above technique it will not be
possible for you to show your menu item as selected (with different style).

In order to achieve this you need to take help of some
java scripting. I know it’s not a good approach but I believe it is the only


You need to add following script at the end of you
master page to change css class of selected menu item


var aryClassElements = new Array();
function getElementsByClassName( strClassName, obj )
if ( obj.className == strClassName )

aryClassElements[aryClassElements.length] = obj;


for ( var i = 0; i < obj.childNodes.length; i++ ){

getElementsByClassName( strClassName, obj.childNodes[i] );}


aryClassElements.length = 0;

//class name we have used may get change after applying pathes etc so
please verify this using
//any HTML inspection tool

'zz1_TopNavigationMenu_1 ms-topnav zz1_TopNavigationMenu_3 ms-topnavselected
zz1_TopNavigationMenu_9', document.body );

if( aryClassElements.length > 0 ){

var parent = aryClassElements[0].parentNode;

aryClassElements = new Array();

aryClassElements.length = 0;

//This represent name of class used for representing you menu item

getElementsByClassName ("customMenuItemClass",parent);

if( aryClassElements.length > 0 )


//This represent name of class you need to specify for your selected
menu item



You may need to alter above script to change multiple
classes with in your static template definition but you may use it as a
starting point of your implementation

Sunday, July 19, 2009

Using content query web part

A Content Query Web Part displays a dynamic view of content on a page in your Microsoft Office SharePoint Server 2007 site. The Web Part runs a query that can span lists and sites in your site collection, and then presents the results of that query on the page. You can, for example, use this Web Part to display the five most recently published articles in your Web site, regardless of where they are stored.
By default, the XSL style sheet that controls the presentation of the Content Query Web Part renders the Title, Description, ImageUrl, and LinkUrl columns (if present) of the items the query returns. The Web Part renders the ImageUrl and LinkUrl columns as an image and as a hyperlink, respectively. The Content Query Web Part uses XSL style sheets to render these columns by default.
If you want to query for custom content types and render specific columns from those content types in the Web Part, you need to perform some minor customization in the .webpart file.
Follow these steps in order to display custom fileds in content query web part
1. Add a Content Query Web Part to a page.
· In the Query section, set the Source to show items from the Knowledge Base Articles document library (list). Set the list type and content type accordingly.
· In the Presentation section, set the Item Style to Title and description.
2. Edit the properties in the Web Part file to display custom fields. To access the .webpart file for the Web Part, on the Web Part's edit menu, click Export.
· Office SharePoint Server 2007 generates a .webpart file with the complete set of properties that are available for this Web Part. The .webpart file is an XML file that you can edit using a text editor.
3. In the .webpart file, locate the CommonViewFields property. Use this property to specify the additional fields you want to display in the Web Part. Add the internal names of the columns and the type.

You can map above field with tile, description, image url and link url or you can use above fields in your custom style.
Please note that following are types available for data type specifications. If you specify wrong type it will not break code but field will not be displayed on site.
· Text
· Note
· Number
· Currency
· Integer
· Boolean
· DateTime
· Threading
· Lookup
· Choice
· Counter
· DisplayOnly
· RichHTML
· Image
4. Map these internal column names to the columns' Title and Description present in the XSLT transformations. To do this, edit the DataColumnRenames property.
CustomField1,Title; CustomField2,Description
5. Save the .webpart file locally.
6. In the Web page, delete the Content Query Web Part you added in step 1.
7. Import the .webpart file and add the Web Part to your page. To import the .webpart file, click Page, click Add Web Parts, and then click Import. Browse to the .webpart file, and then click Upload.
8. Drag the Web Part to the appropriate zone in the page. The Web Part should display the Knowledge Base Title and the product name.
If you have added multiple fields in CommonViewFields and you need to customize XSL for this please follow steps below
· Open the site in SharePoint Designer (SPD). Navigate to Style Library, then XSL Style Sheets. Open ITEMSTYLE.XSL.
· Take a minute to look at the file. Every time you see

"> xsl:template..." that is the start of a new Item Style. There is one for each of the out-of-the-box Item Styles that show up in the Styles drop down in the Web Part Tool Pane. For every custom Item Style that is needed, a new xsl:template block will have to be created.
· Scroll down to the bottom of the file. Copy the last xsl:template code block and paste it above the closing xsl:stylesheet tag.
· Change the name and match properties in the Template tag to a unique name of your choice:
· Change following

<div class="description" >
<xsl:value-of select="@Description">


<div class="description" >
<xsl:value-of select="@">

· Repeat above with title as well and assign custom xsl using Content Query Web Part -> Presentation-> Item Style

Friday, July 17, 2009

Importing user profile from LDAP

MOSS provide out of box support for importing users from LDAP directory. You need to perform following steps in order to configure share point shared services provider to enable imports.
1. Open Central Administration site
2. Go to shared service provider link under shared service Administration link
3. Select User Profile and Properties under User Profile and My Site section
4. Select View Import connection
5. Click on create a new connection
6. Provide connection setting similar to that. Please note that example are for connecting your site with LDAP Server comes with domino server.
a. Type: Select LDAP Directory
b. Connection Name: Write name of your connection e.g. LotusLDAPCon
c. Directory Server Name: Write IP Address of your LDAP Server or your Server name e.g. LOTUSSRV
d. Port: Leave it to default i.e. 389 if your LDAP is deployed at custom port specify your port.
e. Time Out: Specify time out or leave it to default.
f. Provider Name: Specify LDAP Provide name e.g. LdapMembership
g. User Name Attribute: Leave it to default. If your LDAP has custom username attribute specify that
h. Search Base: Specify search base under which you have all your user e.g. O=TestDomain
i. User Filter: Specify user filter as per your ldap server. E.g. (objectclass=dominoPerson)
j. Scope: Select sub tree
k. Page Size: May leave it to default
l. Page Timeout: May Leave it to default
m. Authentication Information: Select specify account and write username and password of user have appropriate rights on LDAP server e.g. Administrator
7. After filling above select ok to add connection
8. Select User Profile and Properties from bread crumb
9. Click on Start Full Import
Please note that you may encounter strange errors while creating connection with LDAP directory. We experience following error
“An error occurred while validating or updating the directory service connection. No connection was added LDAP”
We found that it is a know issue with MOSS and at the time when I was writing this article, Microsoft has released a hot fix for resolution of above issue KB 949402 at following link
We have found that few tools are available on internet for free download that many help you in connecting and testing with LDAP Directory
e.g. LDAP Brower from LDAP Soft at following link

Wednesday, July 15, 2009

Sending alerts to group using Share point 2007/MOSS

Sending alerts to users are much easier and administrator can assign active directory user for dispatching emails.

Please note that share point uses email address from user’s profile for dispatching emails. Therefore alert cannot be configured for user if email address is not associated in active directory account.

Coming back to original points sending alerts to groups can be of two types.
1. Sending alert to AD Group
2. Sending alert to Share point Group

For sending email to AD Group you need to make sure two things.

1. Group needs to be “email enabled security group”. As distribution lists are not supported in share point
2. You need to explicitly add group in permission setting in list/Document Library etc

There is one limitation is that you cannot edit group and can only delete/recreate alert from Site Action->Site Setting ->User Alert (Site Administration) option

For Sending email to Share point Group

There is no out of box support for sending email alerts to share point group.
However there is a free solution for sending emails to group at codeplex that can be utilized for this purpose. (This will not update alert when new user added in groups)
Few solutions are also available for purchase e.g.

Monday, July 13, 2009

How to find internal column name of share point list’s column

Most of customizable feature such as Content Query Web Part require columns internal name for customization same is true for building CAML query. Following will help you in getting internal name of list’s column.

1. Open share point list setting
2. Right click on column and select properties
3. In Address URL field search for value of field (e.g. ….%7D&Field=Details)
4. Value of field represent internal name of share point list’s column.

Saturday, July 11, 2009

Creating/Deploying simple farm for MOSS

Following post is really helpful for configuring simple farm environment on share point portal server 2007 or MOSS.

I believe any novice person can start deployment reading this

Following define a specific scenario deployment for share point server 2007 with three separate servers.

1. Database Server (SQL Database)
2. Share point Web Front End (Web server, Central Administration, Query Server)
3. Indexing Server (Indexing Server)

Please follow these steps.

1. Install SQL Server on Database Server.
2. Install Share point Portal Server 2007 on Share point Web Front End with following consideration
a. Select Advance option
b. Select Complete in Server Type
c. Do not run Share point Product and Technology Configuration Wizard
3. Install Share point Portal Server 2007 on Indexing Server with following consideration
a. Select Advance option
b. Select Complete in Server Type
c. Do not run Share point Product and Technology Configuration Wizard
4. Install available Services packs on both Indexing Server and Web front End without running Share point Product and Technology Configuration Wizard.
5. Run Share point Product and Technology Configuration Wizard on Share point Web Front End
a. Select create a new farm
b. Provide database settings
6. Run Share point Product and Technology Configuration Wizard on Indexing Server
a. Select connect to existing farm
b. Provide configuration database settings.
7. Start Share point Windows Search Service on both Share point Web Front End and Indexing Server
a. From Share point central administration select operation
b. In Operation Page select “Services on Server” from “Topology and Services Section”
c. Select server one by one and repeat d for each server
d. Click start next to Windows Share point Services Search
e. Provide content access account and indexing schedule
8. Stop Share point Central Administration service on indexing server.
a. On the services on Server page, select the indexing server from server drop down list
b. Under Select server role to display services you will need to start in the table below, select the custom option
c. In the table of services, click stop next to central Administration
9. Start Share point Office Search
a. On the SharePoint Central Administration home page, click the Operations tab on the top link bar.
b. On the Operations page, in the Topology and Services section, click Services on server.
c. In the Server list, select the server that you want to configure as an index server and — optionally — as a query server.
d. On the Services on Server page, next to Office SharePoint Server Search, click Start.
e. Select the Use this server for indexing content check box. This expands the page and adds the Index Server Default File Location, Indexer Performance, and Web Front End and Crawling sections.
f. If you want to use this server to service search queries, select the Use this server for servicing search queries check box. This expands the page and adds the Query Server Index File Location section. If not, skip to the next step.
g. In the Contact E-mail Address section, type the e-mail address you want external site administrators to use to contact your organization if problems arise when their sites are being crawled by your index server.
h. In the Farm Search Service Account section, specify the User name and Password of the account under which the search service will run
10. Create SSP
a. On the SharePoint Central Administration home page, click the Application Management tab on the top link bar.
b. On the Application Management page, in the Office SharePoint Server Shared Services section, click Create or configure this farm's shared services.
c. On the Manage this Farm's Shared Services page, click New SSP.
d. On the New Shared Services Provider page, in the SSP Name section, click Create a new Web application.
e. On the Create New Web Application page, in the Application Pool section, specify the User name and Password for the user account that the Web application pool will run under.
f. You can also configure other settings on this page, or click OK to create the new Web application
g. On the New Shared Services Provider page, in the SSP Service Credentials section, type the user name and password for the user account that the SSP service will run under.
h. Optionally, you can also configure other settings.
i. When you have configured all the settings, click OK.
j. If you used the same Web application for the SSP administration site and the My Sites site collection, you will be prompted to use separate Web applications for these site collections. If you want to use the same Web application, click OK. For more information about site planning, see Plan Web site structure and publishing (Office SharePoint Server).
k. After the SSP has been created, click OK on the confirmation page that appears.Now you are ready to create application and site collections.

Thursday, July 9, 2009

Configuring SMTP Service for routing emails to an external SMTP Server

Following are step for configuration of SMTP service for routing your email to an external SMTP Server.

1. Install SMTP Services from Add Remove Windows Component (This may require a windows CD)
2. Open IIS Admin (IIS Manager) Console from Administrative tools
3. Select Domains under Default SMTP Virtual Server
4. Right click and select new domain
5. Give name to your external domain
6. Got to properties setting of domain created in step 4
7. Check “Allow incoming mails to be relayed to this domain”
8. Select forward all emails to smart host and write local host in text box below
9. Select “Default SMTP Virtual Server” right click and select properties
10. Go to delivery tab and select advance option
11. Write your external SMTP server name e.g. or IP address e.g. [] Note: Make sure to enclose IP address in square brackets
12. Go to Access tab and select Relay Restriction
13. Add IP address or set it to “All except the list below”
Test your SMTP Server using email client like outlook or manually using following commands
1. Go to command prompt
2. Run command “telnet localhost 25”
3. On telnet console run following command
4. Mail from:
5. Rcpt to:
6. Data
7. Subject:
9. .

Tuesday, July 7, 2009

Using MOSS Out of box RSS Viewer Webpart

I was trying to use RSS Viewer web part and noticed lots of issues.

I did a lot of searching over the web and finally managed to make it work for me. Thanks to fellows who have already published their finding.

The first or general issue that can be found using RSS Feed Viewer web part is mentioned below

"An unexpected error occured processing your request. Check the logs for details and correct the problem"

There are many possibilities for this but the most common issue arise is related to configuration of proxy settings in your application web.config.

As RSS Viewer use internet for downloading feed it requires proper proxy configuration for locating internet source. Similar is true for any custom application that requires data access from internet and is behind proxy.

Following are steps to configure proxy settings.

1. Go to web application directory generally (C:\Inetpub\wwwroot\wss\VirtualDirectories\)
2. Edit web.config using proper text editor like notepad. (I used word pad for editing and lost my application)
3. Search defaultProxy in web.config
4. Change above XML tag as shown below

<proxy proxyaddress="http://<your proxyserver>:<Your Port>" bypassonlocal="true"/>

5. Please make sure to place proxy address in above format http://: e.g. instead of otherwise you will encounter above error.

Sunday, July 5, 2009

Backup and restoring MOSS site/sitecollection using stsadm

There are multiple ways for taking MOSS Site collection backups and restoring backups at later time.

However it is recommended to backup/restore site collection using stsadm utility
Following are command for backup/restore share point site collection using stsadm

Stsadm –o backup –url -filename


Stsadm –o restore –url -filename

Tuesday, June 30, 2009

How to display list of MOSS Document Library, MOSS Surveys etc on your page

It seems quite obvious that one will have the requirements for displaying list of content collections like Document Libraries in current site or Surveys presents on current site.

I find that though it is very general requirement but there is no straight forward out of box solution in MOSS for displaying this simple information.

I first investigate Content Query Webpart but found that content query webpart is designed to fetch data related to contents within content collections rather then content collection itself.
In simple word you can fetch documents from multiple document library using content query webpart but it is not possible to get list of document libraries avialable.

I found one simple solution for it but obviously not acceptable as it doesnt display list on standard page or at an specific location on page. Solution is to add a menu item and set it URL to
and it will display all document libraries with in site. Now this has several limitation and the biggest one is that it cannot be utilize as webpart.

Now 2nd solution for this is to use data view. Hummmmmmmmmmmmmmmm Sharepoint designer but still this can be achieved easily with the help of webservice avialable in sharepoint.

You need to do following step to achieve this

1. Create a connetion to web service

2. Selection web function

3. Connect DataView to connection created in step 1.

4. Filter results based on Base Type = 1 (In case of documents)

5.After finishing with above search

in code of your page and replace it with following in order to add link on document titles


thats it and it will add list of all document library in your page.

I hope this will help you in getting better understanding on how to utilize designer and data view to achieve this simple function of getting list of document library, survey or any other content collection.

Saturday, June 13, 2009

MOSS Form based authentication Implementation

MOSS 2007 provides intranet and intranet sites development using its out of box zones and SSO (Single sign on) security model.
User can easily configure form based authentication and extranet zone on MOSS 2007 website to provide accessability to users belong to organization active directory as well as users registered using website.

Following explains how to configure secity on sharepoint

Sunday, March 29, 2009

Danish Hussain

I am working at : Avanza Solutions (Pvt) Ltd as Senior Consultant.