Sharepoint Interview Questions with Answers Monday, May 31 2010 

What is a SharePoint Feature? What files are used to define a feature?
A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, scope of which are defined as
1. Farm level 2. Web Application level 3. Site level 4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is
Installing, Uninstalling, Activated, or Deactivated.

The element types that can be defined by a feature include
menu commands, link commands, page templates, page instances, list definitions, list instances,
event handlers, and workflows.

The two files that are used to define a feature are the feature.xml and manifest file(elements.xml). The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.

• Workflow can be applied to what all elements of SharePoint ?
Workflow associations are often created directly on lists and libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list. In short, it can be applied …
At the level of a list/library
At the level of a content type defined at site scope
At the level of a content type defined at list scope

• What are the types of input forms that can be created for a workflow ?
You can create four different types of input forms including
1. An association form
2. An initiation form
3. A modification form
4. A task edit form.

Note that these forms are optional when you create a workflow template.

• What are ways to create input forms for workflow ?
1. You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)
2. Using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

• What is the difference between method activity and event activity in WorkFlow ?
A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.

• What are content types?
A content type is a flexible and reusable WSS type definition (or we can a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.
• Can a content type have receivers associated with it?
Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?
There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

What is an ancestral type and what does it have to do with content types?
An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

• Can a list definition be derived from a custom content type?
Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

• When creating a list definition, how can you create an instance of the list?
You can create a new instance of a list by creating an instance.XML file

What is a Field Control?
Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

• What base class do custom Field Controls inherit from?
This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

Can multiple SharePoint installs point to the same DB?
Multiple SharePoint installs can use the same database server. Not literally the same database on that server. That server must be SQL Server 2000 or SQL Server 2005. It cannot be Oracle or another vendor.

• How to create links to the mapped network drives?
Creating links to mapped drives in WSS v3 or MOSS 2007 can be done via
the new content type for .lnk files.

• While creating a Web part, which is the ideal location to Initialize my new controls?
Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.

What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?
There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the
SharePoint WebPart Base class
or the
ASP.NET 2.0 WebPart base class.
When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure

What are the differences between the two base classes and what are the inherit benefits of using one over another?
The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure
ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

• What is the WebPartManager sealed class? What is its purpose?
The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

• What does AllowUnsafeUpdates do ?
If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property.

• What does RunWithElevatedPrivileges do?
There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.
• What does SPWeb.EnsureUser method do?
Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.
e.g SPUser usr = myWeb.EnsureUser(“hitenders”);

• What is a SPSite and SPWeb object, and what is the difference between each of the objects?
The SPSite object represents a collection of sites (site collection [a top level site and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

• What does a SPWebApplication object represent?
The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

• How do you return SharePoint List items using SharePoint web services?
In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.
Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

• When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?
In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

• What is CAML, and why would you use it?
CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.

• What is impersonation, and when would you use impersonation?
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

• Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?
Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.
Each custom property that you have must have the appropriate get and set accessor methods.

• What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?
ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

• What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?
A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:
allows deployment to all WFE’s in a farm
is highly manageable from the interface allowing deployment, retraction, and versioning
Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.
Can provide Code Access Security provisioning to avoid GAC deployments
And much more..

• What is a .ddf file and what does it have to do with SharePoint Solution creation?
A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

• What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?
The solution Manifest.XML file.

• What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

• What are event receivers?
Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

• When would you use an event receiver?
Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

• What base class do event receivers inherit from?
Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

• If I wanted to not allow people to delete documents from a document library, how would I go about it?
You would on the ItemDeleting event set: properties.Cancel= true.

• What is the difference between an asynchronous and synchronous event receivers?
An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding

.What are Application Pages in SharePoint?
Unlike site pages (for example, default.aspx), a custom application page is deployed once per Web server and cannot be customized on a site-by-site basis. Application pages are based in the virtual _layouts directory. In addition, they are compiled into a single assembly DLL.

A good example of an Application Page is the default Site Settings page: every site has one, and it’s not customizable on a per site basis (although the contents can be different for sites).

With application pages, you can also add inline code. With site pages, you cannot add inline code.

Typically, you link custom application pages to application.master, the master page file that is used by the default application pages in Windows SharePoint Services. You should also write application pages to inherit from a base class defined inside the Microsoft.SharePoint assembly named LayoutsPageBase.

.When to use Diffrent Site Collections?

Ans. An Individual Site collection offers following :

For the Users:

Dedicated Recycle bins
Dedicated usage Reports
Distributed administration (site collection administrators)
Dedicated search scopes, keywords, and best-bets
Custom feature deployments
Dedicated language translation maintenance
Dedicated galleries for web parts, master pages, content types, site columns, site templates, and list templates
Dedicated shared libraries, such as site collection images and site collection styles
Dedicated real estate (Self Containment)

For the IT Administrators:

Site quota templates
Distributed administration
Site locking
Database maintenance options
Backup / Restore abilities
Content Deployments
InfoPath forms services global template targeting.

.What are Security methods(Authentication methods) available in sharepoint.

Ans :“Out of the box”, SharePoint 2007 supports nine authentication methods. NTLM (short for NT Lan Manager, which is simply the Windows authentication that everyone is familiar with) and Kerberos (also a Windows “standard” authentication) are offered during installation, but I recommend to get started with NTLM, as Kerberos requires “special configuration by the domain administrator”, while NTLM works without further hassle.

.What does AllowUnsafeUpdates do ?
If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting theAllowUnsafeUpdates property.

using(SPSite mySite = new SPSite(“yourserver”))
using(SPWeb myWeb = mySite.OpenWeb())
myWeb.AllowUnsafeUpdates = true;
SPList interviewList = myWeb.Lists[“listtoinsert”];
SPListItem newItem = interviewList.Items.Add();

newItem[“interview”] = “interview”;

.How Does SharePoint work?
The browser sends a DAV packet to IIS asking to perform a document check in. PKMDASL.DLL, an ISAPI DLL, parses the packet and sees that it has the proprietary INVOKE command. Because of the existence of this command, the packet is passed off to msdmserv.exe, who in turn processes the packet and uses EXOLEDB to access the WSS, perform the operation and send the results back to the user in the form of XML.

.What is the difference between Syncronous & Asyncronous events?
Syncronous calls ending with ‘ing’
E.g. ItemDeleting
Event Handler code execute BEFORE action is committed
WSS waits for code to return
Option to cancel and return error code

Asyncronous calls ending with ‘ed’
E.g. ItemDeleted
Event Handler code executes AFTER action is committed
WSS does not wait for code to return
Executed in its own Worker thread.

.What is ServerUpdate() ?
Any changes in the list, i.e. new addition or modification of an item.. the operation is complete by calling the Update method.

But if a List is set to maintain versions .. and you are editing an item, but don’t want to save it as a new version, then use the SystemUpdate method instead and pass in ‘false’ as the parameter.

.What is query.ViewAttributes OR How can you force SPQuery to return results from all the folders of the list?

If you use SPQuery on any SPlist .. it will bring back results from the current folder only.
If you want to get results from all the folders in the list.. then you need to specify the scope of the query by the use of ViewAttributes..
e.g. query.ViewAttributes = “Scope=\”Recursive\””;


Key Performance Indicators (KPIs) Monday, May 31 2010 

Key Performance Indicators (KPIs)

A Key Performance Indicator (KPI) is a visual signal that tells us the amount of progress made towards a goal. In this article lets see how to create and display KPIs by using Microsoft Office SharePoint Server 2007 KPI list.

KPIs are valuable resources to evaluate progress against measurable goals. To create and publish KPIs, there is a four step procedure.

  1. Create a KPI list
  2. Add the KPI to the list
  3. Add a Web Part to a Web page
  4. Link the KPI list to the Web Part.

First of all we need to choose a KPI Type:

KPI types:

Using data in SharePoint lists
When SharePoint lists contain items that you can count, items that are part of a workflow, or items that contain dates, you can use a KPI to track how long the issues or tasks have been open, how many are open, and what percentage of a task is complete.

Using data in Microsoft Office Excel workbooks
You can set up a KPI in an Excel workbook and link to the KPI from Office SharePoint Server 2007. As the data in the workbook changes, the KPI is automatically updated.

Using data from Microsoft SQL Server 2005 Analysis Services
Office SharePoint Server 2007 can use KPIs from Analysis Services, a component of Microsoft SQL Server 2005. A systems administrator or database analyst usually sets up these KPIs and registers the data connection with Office SharePoint Server. Then, anyone with the appropriate permissions can access the database and link to the Analysis Services KPIs.

Using manually entered information
In situations where there is no formal system set up or you have a one-time project to track, you can use this KPI and enter the criteria manually. This KPI is useful for displaying information that is communicated in e-mail or some other nonstructured system.

Create a KPI list:
You can create KPI lists in the Reports Library of the Reports Center in a team or organization site, so that other people easily can find them.

  1. In the site where you want to create the KPI list, on the default page of the Report Center, click Site Actions, and then select View All Site Content. Under the All Site Content heading, click Create.
  2. On the Create page, under Custom Lists, click KPI List.
  3. Type a name and an optional description for the KPI list.
  4. Click OK.

You now have a KPI list to which you can add one or more KPI types.

Add a KPI to the KPI list
1.On the KPI list toolbar, click the arrow next to New.

2. Select “Indicator using data in SharePoint list” KPI type.

3. On the New Indicator page, do the following:

  1. In the Name and Description boxes, type a name and optional description for the indicator.
  2. In the Comments box, type text to help people who are viewing the KPI understand what it represents.
  3. Under SharePoint List and View, in the List URL box, enter the URL of the list or library.
  4. In View, select the view that contains the items you want to use in the KPI.
  5. Under Value Calculation, select one of the following ways to calculate the goal of the KPI:
  • Number of list items: A count of the total number of items in the list.
  • Percentage of list items: A calculation that compares the value of a content type within a column or up to five columns in the list.
  • Calculation using all list items in the view: A computation of Total, Average, Maximum, or Minimum of a numerical column in the list. Note The Calucaltion using all list items in the view option is only available if your list includes a numerical field.

6.   In the Status Icon section, under Status Icon Rules, in the Better values are list, select higher or lower to indicate which range of numbers will be green.

7.   Type the values for the status indicators in the boxes. For example, to track the minimum percentage complete for a set of tasks, you can set the green indicator at the goal value and the warning value to be one less than the goal value. In that case, if you want to see when the minimum percentage complete drops below 25 percent, you set the green indicator to 25 and the yellow indicator to 24.

After you add all of the KPIs that you want to the KPI list, you can publish them on a Web page by using one of two KPI Web Parts.

Publish the KPI on a Web page
After you add one or more KPI types to the KPI list, you can display the KPI list on My Site, a team site, or any other SharePoint page. In addition, the KPI list is available for use by anyone in your organization who has permissions to access it. You can use one or all of the KPIs that appear on the list. To display the KPIs, you edit the Web page where you want to display the KPI list and add a KPI Web Part. To display the entire KPI list, use the KPI List Web Part. To show only one of the KPIs from the list, use the KPI Details Web Part.

Add a Web Part to a page
1. On the page where you want to add the KPI, click Site Actions, and then select Edit Page.

2. In the zone in which you want to add the KPI, click Add a Web Part.

3. In the Add Web Parts dialog box, in the All Web Parts section, under Dashboard, do one of the following.

  • To insert the entire KPI list, select Key Performance Indicators.
  • To choose one KPI from the KPI list, select KPI Details.

4. Click Add.

Link the KPI list to the Web Part
1. In the Web Part, click Open the tool pane.

2. In the tool pane, under Indicator List, navigate to and double-click the KPI list that you created in the previous set of procedures. The list may be in the Report Center of the site.

3. Select one of the KPIs in the list. (If you selected the KPI List, the entire list is displayed.)

4. Click OK.

Hope this helps–

Source taken from:

Site Templates Wednesday, May 26 2010 

Site Templates

Site templates are used to allow the rapid creation of web sites and basic content in a SharePoint system. Any number of new sites can be generated based on a site template, which is a set of basic content pages and schemas (which are themselves stored on the Web server as a set of HTML and XML files).  There can be an unlimited number of site templates, although typically there are basic types and a few templates customized to an organization’s specific requirements.

A site template provides the basic components and layout of a new site created under SharePoint. A site template contains specific design information about a site, including the lists that are part of that site, Web Part Pages used in the site, the site’s themes and borders, changes to the Quick Launch bar, as well as some site content (such as document libraries).

A site template creates a copy of the template contents in the new site’s directory location.  These template-created sites can still be modified, but a lot of the basic formatting of the site, as well as the site flow and logic, can be created quickly using a template instead of requiring manual coding.

Where are site templates kept?

When SharePoint Services is installed on a Web server, a default set of site definitions (including site templates and list templates) is created.  Customized versions of an existing site definition can be created, modifying one of the existing sites to more closely suit specific requirements. Typically, new site definitions are made by copying an existing site definition, and then editing that copy.  Modifying the default site templates is not recommended.

Site templates are stored in the SharePoint database and can be accessed through template galleries. Once a site template has been created, other users can use that template (or create copies of it for further modification). User-created site templates can be imported to the site collection level, adding them to the site template gallery. Site template files have an “.stp” extension.

Creating a Site Template

To create a site template, the Add Items right must be granted to the user for the site collection gallery. By default, this exists for the Designer and Administrator site groups, but any group can be given this right by an Administrator.  To create a site based on a site template, the site definition must be available either on the server or in the SharePoint central template gallery.

To create a new site template, follow these steps:

  1. Click on Site Settings
  2. Under the Administration option, click on Go to Site Administration:


  1. Under Management and Statistics, click on Save site as a template


  1. When prompted, enter the name of the site template file. In the Template title field, enter the title of the site template as it will appear in the gallery (a descriptive title works best)


  1. To include any existing site content, click the Include content check box
  2. Click OK

The new site template is added to the site gallery:


Clicking on the template name will initiate the process of creating a new site based on this site template.

Adding a Site Template to the Site Template Gallery

When a site template is created, it is automatically added to the site template gallery. If you are copying site templates from another location as a “.stp” file, you must manually add the site template to the gallery.

To add a site template to the site collection template gallery using the “.stp” file, follow these steps:

  1. From the top-level Web site, click on Site Settings
  2. Under the Administration link, click on Go to Site Administration
  3. Under Site Collection Galleries, click Manage site template gallery


  1. Click Upload Template


  1. Browse to the site template file, or enter the path and name of the file directly.  You can upload several site templates at once by clicking on Upload Multiple Files.


  1. Click Save

The new file templates will now be included in the site gallery.

Deleting a site template

To remove a site template from the site template gallery, follow these steps:

  1. From the top-level Web site, click on Site Settings
  2. Under the Administration link, click on Go to Site Administration
  3. Under Site Collection Galleries, click Manage site template gallery
  4. Click the Edit icon next to the site template you want to delete


  1. Click the Delete button


The site template will be removed from the gallery, although the “.stp” file will not be deleted.

Editing a site template

To edit a site template name or description in the site template gallery, follow these steps:

  1. From the top-level Web site, click on Site Settings
  2. Under the Administration link, click on Go to Site Administration
  3. Under Site Collection Galleries, click Manage site template gallery
  4. Click the Edit icon next to the site template you want to change
  5. Make any changes and click the Save button

Changes to the site template are made immediately.

Source URL:

User Profiles and Audience Targeting in SharePoint 2007 Wednesday, May 26 2010 

Within any organization, a user is more than just the account he or she uses to log in to the network and the unique ID (for example, CustomerID, VendorID, or EmployeeID) he or she is assigned. A user has a name, a phone number, an address, a title, and maybe even a photograph and food preferences. An organization usually maintains such information in disparate databases. For instance, HR would have information such as emergency contacts and mailing address, whereas payroll may have tax and salary information.

This valuable information usually is locked away in systems that do not talk very well with each other. If all this information could be stored in one system, specific content could be targeted to specific users. So, for example, a new law that applies only to offices in California would be viewed only by users whose PositionState field is CA.

Microsoft Office SharePoint Server 2007 (MOSS 2007), or simply SharePoint 2007, provides just such a solution by introducing the concept of User Profiles. User profiles allow you to associate metadata with every UserID. In MOSS 2007, this metadata can then be kept in sync with the other systems in the organization using BDC, an Active Directory domain controller, or an LDAP server. Having such metadata from disparate systems aggregated and synchronized into one single system.MOSS 2007.presents a very valuable proposition to any organization.

It is quite reasonable to expect that a MOSS User Profile would be an amalgamation of information from various sources. Thus, MOSS provides you with the means to fine-tune such information and its import. This article examines the SharePoint 2007 User Profile feature, beginning with a discussion of what it takes to set up metadata.

User Profiles Setup

Putting User Profiles to Use.Audience Targeting

User Profile information can be incredibly useful. You could write custom utilities on top of such information. For instance, you could provide an “Emergency Contact List” in the form of an Excel spreadsheet by simply reading user profile information. This list then could be interlinked with an emergency coverage schedule, thus allowing the end user to very easily track down the right individual for the right job, along with his contact information, just when he or she needs it.

Besides writing custom utilities to leverage User Profiles, a rather useful way to use user profiles out of the box is audience targeting. Audience targeting refers to the ability to create an audience based on a specific set of rules and then target content to a specific audience.

Before you can use audience targeting, you need to set up a rules-based audience first. Here is how you do so:

  1. Under the Shared Service provider for the web site, click the “Audiences” link under the “Audiences” section.
  2. You will see the number of audiences that exist in the system and a listing of relevant links to view or create audiences. Click “Create Audience.”
  3. Specify an audience, as shown in Figure 4.Source is taken from:

Create a simple hello world custom Application Page in SharePoint. Wednesday, May 26 2010 

There are two approaches we can follow while creating an Application Page in SharePoint.

One is Inline Approach

  • Create a new default.aspx page rename it to HelloWorldAppPage.aspx
  • Put the following markup in it

<%@ Page Language=”C#”MasterPageFile=”~/_layouts/application.master”Inherits=”Microsoft.SharePoint.WebControls.LayoutsPageBase” %>

<asp:Content ID=”Main” ContentPlaceHolderID=”PlaceHolderMain”runat=”server”>

<asp:Label Text=”Hello World” runat=”server” ></asp:Label>


  • Every application page is an content page in SharePoint. And here to have same look and feel as the other application pages we have specified the application.master as the masterpagefile.
  • Inherits attribute of the Page directive refers to LayoutsPageBaseclass from which the application pages inherit.
  • We have than used a content server control that would be referring to the PlaceHolderMain content place holder inside the application.master page.
  • Than we have simple added a label control that would be displaying hello world.
  • Now go to your 12 hive i.e. C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS and create a folder (MyHelloWorld) over there and put theHelloWorldAppPage.aspx over there.
  • We could have directly placed the aspx page to layouts folder but than from better organization perspective we have created a folder and kept the aspx page inside it.
  • Now the page is available to all the SharePoint sites.


Another is code behind approach.

  • The easiest way is to first create a Asp.NET Web site project.
  • Add a class library project to the solution (GCL)
  • Delete class1.cs and copy the default.aspx.cs page from web site project to the class library project.
  • Delete the default.aspx.cs from the website.
  • Add reference to System.Web and Microsoft.SharePoint.dll  in your class library project
  • Put the following code in the _Default

public partial class _Default : LayoutsPageBase


protected Label Label1;

protected void Page_Load(object sender, EventArgs e)


Label1.Text = “Hello World Code Behind”;



  • Sign the assembly and put it in GAC.
  • Get the public key token.
  • In the default.aspx page replace and put the following markup to use the assembly.

<%@ Page Language=”C#”MasterPageFile=”~/_layouts/application.master”

Inherits=”_Default,GCL, Version=,Culture=neutral,PublicKeyToken=16391a8a7c882343″ %>

<asp:Content ID=”Main” ContentPlaceHolderID=”PlaceHolderMain”runat=”server”>

<asp:Label ID=”Label1″ Text=”Hello World” runat=”server”></asp:Label>


  • Put default.aspx to the  layouts folder or your custom folder inside it.

That’ s it !!

Changing the URL (host header) in SharePoint 2007 Wednesday, May 26 2010 

I have a SharePoint portal with the host header “http://intranet“, I want to change this to ““.
What’s the process?
After some investigation, I changed it using the steps below:
1. Open Central Administration.
2. Browse to “Operations” and then to “Alternate Access Mappings”.
3. Click on the dropdown displaying “Show All”, select “Change Alternate Access Mapping Collection”.
4. Choose the URL you wish to modify.
5. Select “Edit Public URLs”.
6. Change the URL’s for the zones you have defined in this case change default from http://intranet to and click save.
7. Update IIS to reflect these changes made to SharePoint.  Open IIS Manager, expand the nodes and locate the web site.
8. Right click and select properties.
9. Click on the Web Site tab.
10. Click on advanced.
11. Modify the host header to the new value.
12. Click OK and close IIS Manager.
13. Perform an IISRESET (Start > Run > IISRESET).
That’s it, job done …

Tuesday, May 25 2010 

Excel Services in MOSS 2007 Tuesday, May 25 2010 

Excel 2007 is the only compatible version for Excel Services Configuration with MOSS 2007.

Open your sharepoint portal -> Site Actions -> Create -> New Doc Library -> Give Title & Desc -> Select Document Template as Office Excel Spreadsheet

Open Excel Workbook -> File -> Publish -> My Network Places -> Select your Excel Library -> Chk open in excel services -> Excel Services Options -> Select Sheet -> Items in Workbook -> Select Chart -> It gives a permission error

Open Central Admin -> Shared Services Admin -> services on server -> start Excel Calculatio Services -> Shared Services -> Trusted File Locations -> Add T. F. Loc -> Add Library Location (URL) -> Select Children Trusted -> Select Trusted data connection libraries & embedded

Open the page on your portal where you wish to host your Excel Charts -> Edit Page -> Add New Web Part -> Select Excel Web Access Webpart (in business webparts) -> Open tool pane -> Select Workbook

Creating custom editor parts for a SharePoint webpart Thursday, May 13 2010 

For one of my SharePoint webparts I created a custom EditorPart to edit the properties of the webpart. I had some issues with this editorpart that caused me a headache.My webpart is an ASP.NET 2.0 webpart (System.Web.UI.WebControls.WebParts) that implements the IWebEditable interface. Here is the code of my webpart:


    public class TestEditorPart : System.Web.UI.WebControls.WebParts.WebPart, IWebEditable
        private string _myMessage;

        public string MyMessage
            get { return _myMessage; }
            set { _myMessage = value; }

        protected override void Render(HtmlTextWriter writer)
            writer.WriteLine(string.Format("Message: {0}.", MyMessage));

        EditorPartCollection IWebEditable.CreateEditorParts()
            List<EditorPart> editors = new List<EditorPart>();
            editors.Add(new MyEditorPart());
            return new EditorPartCollection(editors);

        object IWebEditable.WebBrowsableObject
            get { return this; }


In CreateEditorParts() my custom editorpart is created and returned in a new collection. My editor part is called MyEditorPart. I will not discuss the code in detail, because it is pretty straight forward.

    public class MyEditorPart : EditorPart
        private TextBox _message;
        protected override void CreateChildControls()
            _message = new TextBox();

        public override bool ApplyChanges()
            TestEditorPart webPart = WebPartToEdit as TestEditorPart;
            if (webPart != null)
                webPart.MyMessage = _message.Text;

            return true;

        public override void SyncChanges()
            TestEditorPart webPart = WebPartToEdit as TestEditorPart;
            if (webPart != null)
                _message.Text = webPart.MyMessage;

After compiling the assembly, deploying it to my SharePoint 2007 server and registering the webpart, I added the webpart to the page. After clicking the “Modify”Shared Web Part””, the page crashes with message “An unexpected error has occurred.”:


After adding a constructor to MyEditorPart and setting an ID for my editor part, this problem is solved.

        public MyEditorPart()
            this.ID = "MyEditorPart";

While testing the webpart, I used this webpart twice on the same page. I changed the message for the first webpart to “Message 1”. Then I set the message for the other webpart to a different text and switched back to the properties of the first webpart. Although I have the correct webpart selected (see screenshot below) the textbox in the editor part shows the message of the other webpart. See the screenshot below.


After some serious debugging I found out that the ID of the editor part has to be unique for each instance of your webpart. I changed the constructor of my EditorPart to take the ID of the webpart as a parameter. This solved my problem.

        public MyEditorPart(string webPartID)
            this.ID = "MyEditorPart" + webPartID;

In the webpart code I changed CreateEditorParts to pass the ID in the constructor:

        EditorPartCollection IWebEditable.CreateEditorParts()
            List<EditorPart> editors = new List<EditorPart>();
            editors.Add(new MyEditorPart(this.ID));
            return new EditorPartCollection(editors);

You probably already know this if you develop SharePoint webpart, but I didn’t and after nearly getting crazy because my text boxes displayed the wrong values in the editor part, I decided to share it.

This source is taken from-

Top 13 Funny Software Development Quotes Thursday, May 13 2010 

Over the years, I’ve collected some of the smartest-yet-funny software development quotes I have read. Here’s the current short list in no particular order. Oddly enough, there are thirteen of them and they all address the woes of programming.

Feel free to add any like quotes in the comment section!

  1. “The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill
  2. “In order to understand recursion, one must first understand recursion.” – Author Unknown
  3. “I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.” – Bjarne Stroustrup
  4. “A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.” – Mitch Ratcliffe
  5. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -C.A.R. Hoare
  6. “The gap between theory and practice is not as wide in theory as it is in practice.” – Author Unknown
  7. “If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.” – Gerald Weinberg
  8. “If debugging is the process of removing software bugs, then programming must be the process of putting them in.” – Edsger Dijkstra
  9. “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” – Bill Gates
  10. “Nine people can’t make a baby in a month.” – Fred Brooks
  11. “Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” – Rich Cook
  12. “There are two major products that come out of Berkeley: LSD and UNIX. We don’t believe this to be a coincidence.” – Jeremy S. Anderson
  13. “Before software can be reusable it first has to be usable.” – Ralph Johnson