Wednesday, July 29, 2009

Very useful resource for SharePoint developers

Hi all,

I came across a site which has immensely resources about all parts of SharePoint such as
  • Configuration
  • Webcasts and screencasts
  • Creating a MOSS environment
  • core objects - features
  • best practices
  • Web parts
  • Sliverlight details
  • workflows
  • security and architecture
Click here!


Tuesday, July 28, 2009

Access is Denied (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Hi All,

I had an issue once that I cant access any web site. When I try to use SharePoint manager 2007 to access a web site I get this error:

Access is Denied (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

In fact, I cant access any web, or site collection or a web application.

I tried many options but nothing worked out. But one trick worked for me.

These are the steps I followed:

Step1: Go to Start >> Run >> cmd >> attrib –s %windir%\tasks (in my case, i used attrib –s C:\windows\tasks)

Step2: In the Tasks folder, right click on Sharing and Security tab and click Add as wss_wpg user

Step3: WSS_WPG should have access to Read & Write.

Step4: Run this command attrib +s c:\WINDOWS\tasks.


Step6: Also check Index and Scheduling service are running.

You much check the you must have admin local rights or a user with admin local rights.
My issue with access resolve this issue.
Also check out


Sunday, July 26, 2009

How to: Create List Instance using WSPBuilder

Hi all,

In the blog post, I will cover how to create a list instance using WSPBuilder. There are few small points to be noted.

Step1: Create a WSPBuilder project called as ListInstance.

Step2: Right-click on project >> Add new item >> Choose Feature with Receiver element from WSPBuilder called as "ListInstanceReceiver"

Step3: In ListInstanceReceiver, create a list instance. Now, if you create a new Guid for "FeatureID", you will get an error. Lets create a new Guid for FeatureID (Tools >> Create Guid)

<Elements xmlns="">


Title="My list instance"




TemplateType="100" FeatureId="efca61a1-7f3f-4f8f-9515-e831008cba15'">



Step4: Build the solution, Build WSP and Deploy.

Step5: Go to the Site actions >> Site settings >> Site Features >> Activate the "ListInstanceReceiver". You will get this error:

Feature 'efca61a1-7f3f-4f8f-9515-e831008cba15' for list template '100' is not installed in this farm. The operation could not be completed.

Apparently, FeatureId: This is the ID of the feature in which the base list template is defined.

Therefore, we have to use pre-defined FeatureId.

Hence, we need to use "00BFEA71-DE22-43B2-A848-C05709900100" as our list is a generic list. Now, we have the upgrade our solution.

You can get all available list templates with their template type id and their corresponding feature id here.

When you again activate the feature, you will still get an error as follows:

The method or operation is not implemented.

We just need to remove the line throw new Exception("The method or operation is not implemented.");
in all the methods 


Therefore the ListFeatureReceiver.cs will look this

public override void FeatureActivated(SPFeatureReceiverProperties properties)

public override void FeatureDeactivating(SPFeatureReceiverProperties properties)

public override void FeatureInstalled(SPFeatureReceiverProperties properties)

public override void FeatureUninstalling(SPFeatureReceiverProperties properties)

Compile and upgrade the solution.


Download the code here.

Sunday, July 19, 2009

SharePoint document and picture rating features/webparts

Hi all,

I had requirement where users have to rate a picture and document. Each user can rate only once picture in different categories. Same applies documents as well.

I just searched and find an awesome toolkit which has on codeplex.
You can find it here.

Here are features of this toolkit:
- New "Show Ratings" webpart showing all the ratings of a given site/site collection
- New site collection report
- Using rating comments with blogs is now possible
- Custom stsadm rating commands have been added to ease the activation/deactivation of the rating features and to collect some rating reports accross webs/site collections/web applications
- Bug fixing in both Forms Designer and the rating solution
- The rating manual has been updated, make sure to download it*

It also comes with detailed documentation and 2 screencasts.


How to: Regional Settings for Central Administration

Hi All,

I was recently looking for regional settings for Central Administration and really could not find it. In fact, for site collection or sites we can easily set the regional settings using Site Actions -> Site Settings -> Regional Settings.

But you can access using this link: /_layouts/regionalsetng.aspx on the Central Administration.


How to: combine multiple projects in one WSPBuilder Solution

Hi all,

We frequently use WSPBuilder to package the WSP solutions. We may need multiple projects but we need to just one WSP solution. After reading WSPBuilder documentation, I found a that "BuildSolution" command doesn't work. (or may be I have not used it properly). But I have user an alternative approach.

For an illustration, I two WSPBuilder projects and already complied:
1) SimpleWorkflow
2) SimpleEventHandler

To combine multiple projects into one WSPBuidler solution (i.e. single WSP), we have to follow these steps:

STEP1: Choose any base project such as SimpleWorkflow.
Right-click on "Solution" and choose "Add Existing Project".

STEP2: View both the projects as shown:

STEP3: Add a new deployment project. Its better to add a completely new project just for the deployment.
Right-click on "Solution" and choose "Add New Project".

STEP4: Right click on _Deployment project, "Add New Item" >> Choose XML template and name is WSPBuilder.exe.config. (Its there from WSPBuilder documentation)

Just copy this code in WSPBuilder.exe.config

<?xml version="1.0" encoding="utf-8" ?>




<!-- As in C:\Program Files\WSPTools\WSPBuilderExtensions\WSPBuilder.exe.config -->

<!--<add key="BuildDDF" value="true" /> -->

<!-- As in C:\Program Files\WSPTools\WSPBuilderExtensions\WSPBuilder.exe.config, but value changed from 3 to 4 for more feedback -->

<add key="TraceLevel" value="4" />


<!-- The following key will ensure we build in debug mode. -->

<!--<add key="BuildMode" value="Debug" /> -->

<!-- The following key will override the wsp default of files in dev GAC dir going to the gac, and those in the bin dir going to the iis site bin directory. -->

<!--<add key="DeploymentTarget" value="GAC" /> -->

<!-- The following key will create a full 12 hive in your projects, so use only if you need all deployable folders -->

<!--<add key="Createfolders" value="True" /> -->

<!-- Don't delete intermediate files such as the manifest.xml (don't add these files to source control) -->

<!--<add key="Cleanup" value="False" /> -->

<!-- New name proposed for current BuildSolution key -->

<!--<add key="BuildMultipleProjects" value="True" /> -->

<!-- Build all projects into one solution -->

<add key="BuildSolution" value="True" />

<!-- Solution path - this tells WSP builder to step back one level for the master (startup/build) project to the main 'wsp solution'

folder, and build all projects within that folder to one wsp (cab). By default this wsp will take the name of the folder it sits

in, or use the WSPName key (see below) to give your own name. Unfortunately this dictates a rigid project folder structure, so it

is advised that projects used in more than one wsp solution solutions are subsequently 'referenced/linked' in source control to

match this client build structure rather than physically copied. They can then be 'project referenced' in Visual Studio, which

leaves the option of branching them completely if required. Although this promotes re-use, care should be taken as it often

indicates a new wsp is required to prevent inadvertent upgrades or clashes with already installed features in other solutions.

If it is a variation, consider branching or copying files (especially feature.xml to ensure guid is used), dll referencing of base

feature and inheritance. -->

<add key="SolutionPath" value="..\" />

<add key="OutputPath" value="..\" />

<add key="ExcludePaths" value="..\_Deployment\"/>



I have also added a key "ExcludePaths" and have value of "..\_Deployment".

STEP5: Build "_Deployment", compile it, and then use this command WSPBuilder >> Build WSP.

Your ONE WSP solution with two projects included.
The only small problem is in "_Deploy" does not an option for "Deploy" using WSPBuilder.

So, we have to use STSADM commands to add solution and deploy solution.


How to: fixing Out of box Approval Workflow issue and solution - Part 1

Hi All,

I came across an interesting behavior of SharePoint out of the box "Approval Workflow".

Apparently, when an item is attached to Approval workflow to control content approval for a user with contribute permissions, they can approve their own major version of an item through the approve button in the workflow.

There a no way to configure the workflow so the site members (contribute permission level) can not approve their own major versions of an item. Its really a MAJOR drawback of out of the box Approval Workflow.

For e.g.

>> Create a new team site such as Document Repository
>> Under "People and Group" section, configure site permissions for groups as follows:
i) Document Authors - with Contribute permission.
ii) Approvers - with Approvers permission.
iii) Visitors - with Read-Only permission.

>> Configure Shared Documents Library

Versioning Settings:

Require content approval for submitted items? Yes
Create a version each time you edit a file in this document library? Create major and minor (draft) versions
Who should see draft items in this document library? Only users who can edit items
Require documents to be checked out before they can be edited? Yes

Workflow Settings:

Start this workflow to approve publishing a major version of an item.
Allow this workflow to be manually started by an authenticated user with Edit Items Permissions
After the workflow is completed: Update the approval status (use this workflow to control content approval)


>>Login as Doucment Author
>> upload a new document and check in
publish a major version - Approval workflow will start
Enter the an Approver.
Use Approve/reject from the item drop down - will receive Error Access Denied. EXPECTED BEHAVIOR.
Go to task list and approve task - workflow will be completed and version 1.0 approval status approved. NOT EXPECTED BEHAVIOR.

Therefore, document author who has contributor permissions can approve his own document and its counter-intuitive.


Though we should not touch out of the box behavior, but can certainly change TASK list's behavior. Here is easy workaround.

These are the steps: (obviously, a coding effort is required!)

>> You need an event handler which is associated with TASK list.
>> Get the role definition for "Contributor" permission. (i.e. Document Author)
>> Check the role of user. If it’s a Contributor then throw an error. If it’s an approver then don’t take any action.
Here is the code. Though it needs some improvements but it works properly. I have not touched OOTB workflow, just modified its behavior using TASK list.


public override void ItemUpdating(SPItemEventProperties properties)


using (SPWeb currentTeamSite = properties.OpenWeb())
SPListItem currentItem = properties.ListItem;

// A role definition is required to represent a permission level in SharePoint site
SPRoleDefinition roledefinition = currentTeamSite.RoleDefinitions.GetByType(SPRoleType.Contributor);

bool isContributor = currentItem.AllRolesForCurrentUser.Contains(roledefinition);

if (isContributor)
properties.Cancel = true;
properties.ErrorMessage = "You dont have access to this operation because of your access rights.";


In the elements.xml, use ListTemplateId=107 which is base list template id. Tt worked perfectly fine for our case.

Hope it will work fine for others too,


How to: Use cascading drop-down lists in PowerApps

Hi all, Using cascading dropdown, users can easily fill the forms by selecting drop-down values dependent on values from another dro...