Monday, February 20, 2012

Access denied error on sharepoint 2010 pages with broken inherincet

Recently we were stumped by a very strange issue with Sharepoint 2010 publishing page library where we were unable to give users access on one page in pages library.
The way it is supposed to work is
1. We break inheritance for a particular page(Say page P) in pages library
2.Give read access to user A on Page P
3. User A automatically gets Limited Access on pages library ,site and site collection
4.User A directly accesses the Page
Expected result :Page P is displayed
Actual result:User gets access denied

Friday, December 3, 2010

Designing Intranet search…Its not google

Search enables users to find what they are looking for…a myth

Believe it or not ,search in intranet domain is not centered around what users want to see but more importantly what business wants the users to see.This statement might seem radical but it is not so when you look behind the intent. Business generally knows what are the repositories available,what are the expected searches and what type of search result might help you do your Job better.Its like a Big brother watching you and guiding you to search. You may be typing in Holiday Calender but what you really need is the corporate calendar because there us nothing called a separate calender.Many Large firms spend considerable energy in driving employees to the places they deem are important rather than firing a true search

Since intranet is a managed content with clearly defined content creators and owners the search design is different from normal internet search. Here the focus is not on covering all the data but how to block certain data,its more focussed on promoting a few pages on top rather than finding the best fit for your search.

A wrong result is more worry some rather than a missing right result.Consider an example here: HR releases a not so popular  policy and this leads to a lot of backlash from employees on Intranet forums,internal blogs ,reviews etc..

Now irrespective of  how popular a certain disgruntled employees blog is on the intranet a company will never want to get that as top search result for someone searching about it.

It will be like training your own contract killer….:)

So what do companies do?..

Stop indexing the blogs… a highly unpopular decision leading to further back lash….

Block that page:…..Going toooo far

quietly push the HR pages up…..various search providers give this functionality especially fast esp which basically lets you give HR sites a Static boost that will surpass any amount of traffic going to the particular site…

So Now you know…while designing search solutions for intranet..Do not always look at google…remember these intents

1.Its about what we want to show rather than what user wants to see

2.Its about controlling rather than freely searching

3.Tweaking queries or simply changing them is OK

4.Its focus is to not show certain sites or show certain sites rather than cover everything..

Now you know……
Comments welcomed

More such articles at:

Thursday, November 18, 2010

7 things I hate about SharePoint designer

OK I will be honest, as a developer I try not to use SharePoint designer...I wont say its BAD or limited ..its Damn can create things like simple workflows in minutes which might take me a minimum of an hour ...

But still there are may call me a biased developer who leans on heavy customization :)(thats how i earn my bread and butter)...but i finally decided to list top 7 things I hate about SharePoint designer

You can also view this article at

Why you should not use SharePoint designer 2007

and many more like this at

1.You can break things very easily: Yes irrespective of how easy SharePoint designer maybe,breaking things is way to easy. A missed checkin , an accidental Zone deletion...its way to easy to run into problems. I know a person who spent 2 days figuring out why a SharePoint workflow would trigger using admin account while not by End user account. He finally figured out because a few files were checked out in SharePoint designer. I know you may argue that these problems may arise in custom deigned visual studio workflows also but the process there is little more technical eliminating such missed thing to a minimal. Sharepoint designer is scary because its too easy to use yet gives too much power to the user

2. No reusable workflows: I designed a workflow for my document library ,another department also wants it for their doc library and wants to keep it in sync with myworkflow...can i do need to recreate the workflow for them and do all updations seperately

3. No Looping in workflows:Yes its true...if you want to create a workflow which sends out email reminders to task owner untill he/she completes it,you cannot do it easily in SharePoint designer. Yes there are need to create two workflows..almost identical to do it...More on that later

4. Unghosted pages: Whenever you customize any page/page template that page basically becomes simple terms you can say that all the changes are stored in DB rather than on your file system. So if you added some new webpart zones and you want to use the same template on another sharepoint environment you CANNOT simply download the pagetemplate file from your server and upload into other server.

Where as in case of site definitions you can,because whats in document library is nothing but whats in your 12 hive

5. Inherent limitations of Site templates over Site definitions: Using sharepoint designer you can very well modify your site and create site templates but remember,site templates are linked to their site definitions tightly ie suppose you create a team site and them modify it and save it as a template called myTeamSite this new template is essentially linked to team site. Any updates by MS on team site would directly effect your Site

Where as Site definitiosn are independent entities...MS updates will have no effect on them...

6. Ok i may be repeating myself here but just that this issue needs a seperate point..think about so many diffrent webparts like data view etc that you can use in sharepoint designer...Look at the example here

here a contact list is integrated with bing maps to automatically display the map along with contact details...sounds cool..yeah it is  Suppose you followed this blog and modified the xslt etc of contact list page to display page of contact list...Now...Imagine you are a developer did this on your you want to port it to your customers will you do it?? well you go to production environment and do the exact same things with a list..Like it???

easier solution is to create a webpart ,create a list definition and add this webpart in dispform.aspx page :)

7. It wastes time: Yes you read it right..for any complex requirement its better to code rather than try figure out the logic in SharePoint designer. Yes i accept that here i may be biased like most Sharepoint develeopers...:)..

If you agree/ let me know your views

PS:Most developers I have spoken to do not like using SharePoint designer..part of the reason being it does not require any coding..its mostly configuration...and developers hate configuration...I being from the same fraternity am biased against SharePoint designer...take my views with a pinch of salt

this article is valid for MOSS and WSS 3.0 and not for Sharepoint 2010.hate to say this looks promising...

Authors and copywrite owners:
Paromita Mondal
Madhur Chadha

Thursday, November 4, 2010

New place fot sharepoint Blogging

Finally bought my own domain name and have decided to move my blogs out there

I will be expanding my Blogging now to inclide sharepoint 2010 as well as FAST Search

See my Blog for tips and tricks on Sharepoint,wss 3.0,Moss,FAST ESP an sharepoint 2010

Or copy paste this URL

Monday, August 17, 2009

How to get a sharepoint list GUID without using code

Since in sarepoint everything is diffrentiated with a GUID,many a times you are required to get the GUID of say a list.The usual way is to write a small console application to get the GUID of the list...a quick way is
1.Go to the list
2.Go to list settings
3. see the URL, it would be something like
4.Copy the value after List= ...
5. Remove startin and ending %7B and %7D
6.Replace %2D with -
simple enough.....

Wednesday, July 29, 2009

Basic Event Handling in Sharepoint

Let me start with what is event handling.

Definition of event handling “an event handler is an asynchronous callback subroutine that handles inputs received in a program”

Confused?? Ok in simple language event handling is doing some stuff when some predefined stuff happens. Example theft happens àpolice starts investigation.

Now here eventàtheft happens

Event handleràPolice(keeps a watch)

Event handler functionàInvestigation starts

Event handling is software is also the same . In MOSS various events happen like adding a new item, deleting an item, creating a site,deleting a site etc

Now if we want to do some stuff whenever these events happen we need an event handler. Like if there is a theft an investigation can start only if there is a police officer

Now what are the types of crimes errr types of events an event handler can handle? Some event receiver base classes are listed below

Base Receiver







Base Receiver


























You need to write your custom code using these base classes for creating an event handler.

Now lets start and create our first event handler. Note this is not a hello world event handlers so you won’t see any hello world popping on your screen .The event handler that we will create will simply copy a newly added list item’s title into another list as simple as that.

1. Go t visual studio and create a new class library project

2. Give it any name you wish to(No restriction of MY_First_Event_handler J)

3. Now delete the default class

4. Add a reference to Microsoft.SharePoint.dll(May be visible with the name windows sharepoint services)

5. Create a new class and inherit it from SPItemEventReceiver class

6. Now since we need to trigger it on item added override the ItemAdded method(its like we tell the policeman what action to take when a murder happens)

7. Argument for this function is SPItemEventProperties properties . this variable properties can be used to access the properties of an event like itemname, itemId,Web name,site name etc(its like initial FIR who was murdered,where did the murder took place etc etc)

8. Using this write your custom code. See the code snippet below

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SharePoint;

namespace __madhur_ClassLibrary1_event


class ApplicationEventReceiver : SPItemEventReceiver


public override void ItemAdded(SPItemEventProperties properties)


SPWeb web = properties.OpenWeb();

SPList list = web.Lists["Events"];

SPListItem item = list.Items.Add();


item["Title"] = properties.ListItem.Title;






9. Next step is to sign your assembly ,compile it and put I into GAC(global assembly cache)

10. Now we have told the policeman what he needs to do when a murder happens. But should he start his investigation whenever a murder happens, anywhere? I mean should a policeman in Punjab start investigating when someone is murdered in Honolulu .No, we need to assign him an area. Like you will investigate only if something happens in suppose sector 6,7,8 Chandigarh .Similarly we need to add our event handler to some list/library.So that it fires only when an item is added to that list

11. To do this we need to write a console application.See the code sample below

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SharePoint;

namespace EventReceiverRegister


class Program


static void Main(string[] args)


SPSite site = new SPSite("");

SPWeb web = site.OpenWeb("");

//list to which the event receibver is attached

SPList list = web.Lists["EventGenearte"];

//assembly details of event handler

//the public key token of the dll can be taken from GAC

string assemblyname = " __madhur_ClassLibrary1_event,Version=,culture=neutral,PublicKeyToken=b82dc21758d228b3";

string classname = " __madhur_ClassLibrary1_event.ApplicationEventReceiver";

list.EventReceivers.Add(SPEventReceiverType.ItemAdded, assemblyname, classname);






That’s it!!

NOOO.Please run this console application once

Now you can say that’s it. Now your event hadler is ready.. Whenever any new item is created in the list named EventGenearte a new item with the same title is created in the list called Events

Code project profile CodeProject

Friday, July 17, 2009

Developer resources on sharepoint

a good collection of places where you could find developement resources for sharepoint

checking if a sharepoint list exists or not

One of the major problem is sharepoint object model is handeling lists....
what to do is a list does not exist??
Once we needed to write a code that would rename a list if it to do that we neede to put the
web.lists["listname"] in try catch block....doing it again and again is really a pain...
i read this cool way of writing extension methods.on Bill's (a MVP) blog...
wat it will eseesntially do is ,it will create an extension method through which you could check something like
have a look...simple but a pretty good idea..
thanks bill

Amazing link for beginning sharepoint

i just love this UI...its intutive,its siple and to top it all its gorgeous....also the theme is Black my fav :D

WSS is not free

One day during a discussion on WSS vs MOSS  a point that came up was
WSS is free...creating an application on WSS would involve no liscencening cost,but is it so??
a quick initial search gave me the answers i was looking for
Though WSS in itself might be free but we do forget thet we still need CALs for SQL server.Though you may argue that its essentially WSS that interacts with SQL and not the users directly ,you still need to have a CAL foe each and every user accesing the WSS application that you develop.
This shoud not be a problem if you have enterprise wide liscence for SQL...or else you do need it
So saying that WSS is entirely free is not soo true,yes if you compare MOSS and WSS its essentially free because you save on MOSS Liscensining  cost...but still SQL is there....

Wednesday, June 18, 2008

My baby step into sharepoint blogging

wanted to share some sharepoint tips and tricks...started by using google pages ...but i think blogging would be better....
any ways heres a link to my google pages

My google pages

have written two articles
linking back mysite to portal site. this talks about a very common requirement of linkimg my site of users back to portal homepage.Details out two methods which can be implemented without a single line of code and without changing master page of mysite

Link: Linking My Site Back To Portal Site

Second one talk about basic event handling in MOSS. Its basically a small tutorial for absolute beginners.Am actually thinking of posting tutorials on spobject model starting from beginners and raising the level as i learn and raise mine :)
Basic event handling in MOSS
was pretty surprised to find this link on top of google search for the query "basic event handling in MOSS"
will think of adding a visitor ticker to know how many ppl visited it