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