Monday, April 28, 2008

Antarctic pictures

I promised some people I would publish some pictures my girlfriend brought back from Antarctica, so here you are.

Tuesday, April 22, 2008

Event handlers configuration settings best practices

Where to place configuration settings for event handlers?
I have thought about it and came up with a few options:

Place config information in the event handler registration info
Every time you register an event handler with a list you can specify data specifically for that registration. This can be done with a feature, or using code (see my utility pack for an easy way to do that)

  1. Can be deployed using a feature. We can have different config per list.
  1. We only have a seperate config per list (no one place to manage all lists).
  2. Limited to 256 characters.
  3. You will need to run code to change the configuration.

Place config information in the web.config <appSettings> section
I was surprised to find that the event handlers get access to the web.config as if they were web applications. Cool!

  1. One place to manage per web application. can be deployed using a web application feature and some custom code (
  1. Hard to deploy every time you create a new web application in the farm. This can be resolved by creating a feature and stapling it at the farm level (scope is webapplication) that modifies the web.config to include the section you want, and setting some defaults - so that the event handler finds what it is looking for when a new web application is created.

Place config information in a settings file on the file system

  1. One place for the enitre farm, can be deployed using a solution package
  1. Location is hard coded in the event handler (unless we use this approach mixed with option one!).
  2. Folder must allow users to read, or impersonation will be required.

Place config information in a settings file in the GAC, next to the assembly
I used this a few times. You can put a file right next to the dll, and use a helper class in the dll to deserialize it and read the values.

  1. one place for the enitre farm, no hard coding of location.
  2. Use Mide Woodring's AssemblySettings class to read from it. can probably be deployed as a farm feature
  1. Every time a new dll version is entered, the config will be deleted and will have to be added again.

Place config information in a document library\list in the root sharepoint site of a site collection or in the central administration site or the shared services site for that web application

  1. Deployable as a feature at the site collection level
  1. still requires custom code to get the config.
  2. performance hit on reading the configuration (can be minimized with caching).
  3. (if root site collection option) Only supports site collection level configuration.

Special thanks to Reza Alirezaei who pointed out some spelling mistakes and commented on the web.config section.

Monday, April 21, 2008

Checking the current user's permission on a web site or a list by code

in answer to a question in the forums:

SPWeb has a "CurrentUser" attribute which gives you a SPUser object. the GetAssignmentByPrincipal function of the RoleAssignments collection of the SPWeb object will get you what roles the current user has.


here is an example:

SPWeb web = SPControl.GetContextWeb(this.Context);

SPRoleAssignment assignment = web.RoleAssignments.GetAssignmentByPrincipal((SPPrincipal) web.CurrentUser);

StringBuilder sb = new StringBuilder("");

foreach (SPRoleDefinition role in assignment.RoleDefinitionBindings)








This sample will give you a string with all the information. if you want to check if a use is allowed to add list items


note - don't dispose of the SPWeb object in the example above, since it comes from the context.


another note - this checks the web site permissions - not the permissions for a specific list. if you want to check a list you will have to get the roles from an SPList object. in the following example I am doing the same for the announements list in the current site:


SPList list = SPControl.GetContextWeb(this.Context).Lists["Announcements"];

SPRoleAssignment assignment = list.RoleAssignments.GetAssignmentByPrincipal((SPPrincipal) web.CurrentUser);

StringBuilder sb = new StringBuilder("");

foreach (SPRoleDefinition role in assignment.RoleDefinitionBindings)







How to find the default SSP with code

Answer: (update - thanks to Gary Lapointe who pointed out that my last post used internal objects, I actually tested my code and did more research and found that there is no way in the API to get to the default. If someone knows of a way I'm happy to learn. for now, here is a workaround that I have found - using the STSADM command line)

Process stsadmProcess;
stsadmProcess = new Process();
stsadmProcess.StartInfo.WorkingDirectory = @"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN";
stsadmProcess.StartInfo.FileName = "stsadm.exe";
stsadmProcess.StartInfo.Arguments = "-o enumssp -default";
stsadmProcess.StartInfo.UseShellExecute = false;
stsadmProcess.StartInfo.RedirectStandardOutput = true;
stsadmOutput = new StringBuilder("");
XmlDocument xdoc = new XmlDocument();

Thursday, April 17, 2008

Open microphone event in Sydney next month

Just got this from Lee in Sydney:

Sydney SharePoint User Group is pleased to bring back Mike Fitzmaurice to Australia– Monday May 5th 2008

Would you like to find out;

  • How can you leverage Microsoft Office SharePoint technologies to provide a platform for collaboration, ECM, search, BI and social computing?
  • The interoperability with MOSS and other line of business applications such as SAP?
  • How SharePoint and Office can be the people friendly face of service oriented architecture?

Well we’ve got just the man to answer those burning questions... Microsoft’s Mike Fitzmaurice, Enterprise Technology Strategist and former Technical Product manager for WSS/MOSS, has kindly agreed to hold a lunch time ‘Open Mike’ session when he visits Sydney in May.

We look forward to seeing you there!

Please click here to register for this event.

Registration opens at 12:30pm and the Q&A session commence at 1:00pm. The May User Group will be held at the Microsoft’s office, 1 Epping Road, North Ryde, Sydney.

Food & Refreshments will be provided.

‘Open Mike’ – Mike Fitzmaurice Q&A Date: Monday May 5th 2008 Time: 12:30-2:00pm

Visit for further information.
Mike Fitzmaurice Mike Fitzmaurice is an Enterprise Technology Strategist at Microsoft, advising customers, partners, and Microsoft teams on portal, collaboration, and search technology. He spent the past five years as a Technical Product Manager for Windows® SharePoint® Services and Microsoft® Office SharePoint® Server, focused on developer evangelism and interoperability issues. He joined Microsoft Corp. in December 1997 as a senior consultant for Microsoft Consulting Services, overseeing several development initiatives involving Exchange Server and SharePoint technology for a wide range of customers. Before joining Microsoft, Fitzmaurice served as Director of Research and Development at Advanced Paradigms Inc., a Washington, D.C.-based Microsoft Solution Provider Partner, as well as a five-year tenure as IT Director of the National Association of Broadcasters.

MVP summit - The SharePoint MVPs rock!

There is simply no competition. If anyone asks you what kind of MVP you want to be - say SharePoint. We are the best group of MVPs in the summit.
What makes me say that? read this from Lawrence Liu (Microsoft) about what we did this week.

Tuesday, April 15, 2008

Off topic- do you like pictures? see my other blog

In case you don't know, I have a private blog in hebrew, where I post pictures that I take of my life in Australia (and around the world).

Even though the description of what is going on is in hebrew, the pictures are in english (joke) so if you want to see - check it out at

Or, if you dont want to see the hebrew, just look in my picasa albums: and

Here are some samples of my attempts at photography:

Day 1 of the MVP summit - gaming discussion, kangaroos and

After the previous post I went to a session where we discussed the gamer community and how to promote it. we talked long and hard about many problems in the gaming community and it was very interesting. Would you agree that gamers have better hand-eye coordination than non gamers? would you agree that gamers are less likely to use drugs?
Anyway, after that we had welcome dinner and I hung around with the other Australian MVPs. Our Australian lead from Microsoft (Rose) brought two inflatable kangaroos and our table was the most popular table - so many people came to take a picture with the kangaroo. Since I was standing behind it, I am sure you will be able to spot me in blogs all over the world.
Hey - lets make a challange out of this - spot me in a picture from a different blog, post it in the comments, and I will...errr...I have no prizes, but I will post a big thank you right here for you!
Here is a blog with the kangaroo picture (but no Ishai) so you can see what it looks like.

Another MVP from Australia was promoting Schnubbs - the .NET tiger. Check out Schunbbs' blog and enjoy. He posted some pictures from yesterday soon - including one of mine with Schnubbs on my head:

Monday, April 14, 2008

First day in the MVP Summit, Seattle

So, I arrived here yesterday for the great MVP Summit of 2008, but I am sick. I am sneezing and coughing and my head is swimming. I guess people here will remember me as "that guy who kept coughing during the presentations".

For that reason I am missing the annual SharePoint MVP paintball game that is going on now, and I am sitting in my hotel room, writing this post.
On a brighter note, I have visited the Seattle Aquarium this morning and found it a very nice one - very well displayed. You have to love those otters.

Today we have nothing serious to do - some open sessions that I was planning to go to, but that have nothing to do with SharePoint - so I am resting and trying to build up my strength for tomorrow. That is when things get interesting and I will be hearing all kind of plans for SharePoint, and meeting with the people who make the product. Do you have any questions you want me to ask? just comment on this blog post, and I will try to get you answers.

Sunday, April 13, 2008

Tech.ED Israel 2008 done - now in Seattle.

Hope you got to see me last week in TechEd Israel. It was a lot of fun to meet so many friends, and past customers. I didn't get enough time to do the presentation I had properly, but I got it done in exactly the 60 minutes that were alloted to me. I hope people can forgive me for the speed - but I was playing with what I had. I wonder how my feedback was...I will let you know if they tell me (and if it was good).
I have also taken part in an exciting presentation by 7 presentors- it was a competition between us to deliver the best MOSS deployment tip in 7 minutes. If we went over 7 minutes, a "police man" would drag us off the stage (it happened to two presentors). Then, at the end, the crowd was asked to clap for the best presentation, and the "police man" judged the claps and announced me the winner with my tip of "deploy using WSP solution packages". I won a LifeCam vx-3000, which I will contribute to the Canberra SharePoint User Group as a door prize in next month's meeting (May).

I am now in Seattle, a bit sick and jet lagged, but hopefully well enough to learn more about SharePoint and it's future in the next week. If you are an MVP and here, look me up - I am the one with the crazy hair-do!

Tuesday, April 01, 2008

April's Fools! I am still an MVP

Hope you didn't buy into the post from yesterday where I sounded a bit down for not getting the MVP award. While everything written there was 100% true, the tone was the joke - I wasn't really worried, and only wanted to see who will bite! hehehehe...
Anyway, during the night I got this email:
Congratulations! We are pleased to present you with the 2008 Microsoft® MVP Award! The MVP Award is our way to say thank you for promoting the spirit of community and improving people’s lives and the industry’s success every day.
So I am an MVP for one more year. I hope to earn it again next year - so I'd better keep posting here, answering in the MSDN forums and improve the Canberra SharePoint User Group!