SharePoint Harvester

Thursday, 13 November 2008 23:27 by RanjanBanerji

Often one has to write code to loop through all of SharePoint to make some sort of a sweeping change. Making such changes directly in the database is a bad idea and is not supported by Microsoft. So the best way to do so is to use the SharePoint WSS object model. SharePoint Harvester hopefully will make it easier to do so by providing a recursive traversal of a SharePoint application firing events when a site, list, item etc is found.

The SharePoint harvester code is really simple and can be accessed from  I am not going to start discussing the code itself.  Simple recursion and when webs, lists, items, etc are found it calls a virtual method and fires an event.  This way a user may choose to inherit from this class and override some methods or they can subscribe to relevant events.

So for example if you want to turn off versioning for every list in on every site in an application.  How would you do that?  You could go through the UI and browse to each site and each list and then turn off versioning for that list.  What if you had 500 sites each with 10 lists.  That is a lot of work.  Using SharePointHarvester you could do something like:

public void TurnOffVersioning() {
    SiteHarvester siteHarvester = new SiteHarvester();

    siteHarvester.Url = "http://some.sharepoint.url";
    siteHarvester.Recursive = true;

    siteHarvester.ListFound += new ListFoundHandler( siteHarvestor_ListFound );


void siteHarvestor_ListFound( object sender, ListFoundEventArg e ) {
    e._list.EnableVersioning = false;

You do not have to run this code for the entire application.  The URL you provide could easily have been for some sub site, for example:

siteHarvester.Url = "http://some.sharepoint.url/SomeSite/SomeSubSite";

Harvester will now only get lists for SomeSubSite and all its descendant sites.  As you can see, it makes life a lot easier instead of having to write the recursive code over and over.  More complex situations can now be handled.  For example what if you wanted to check-in all images that have been checked out across the entire application, or delete versions of all images because you are suffering from DB bloat.

More examples will follow.


My Take on the Bailouts

Wednesday, 12 November 2008 22:00 by RanjanBanerji

The US economy is in shambles but that by itself is not a big deal. Business cycles occur and this current crisis too will pass. What is incredibly amazing about this crisis is the amount of businesses being bailed out. And there is talk about bailing out people who made bad financial decisions. The bailout was marked as necessary by George Bush. He said if there is no bailout the results would be catastrophic. Barack Obama now wants the auto industry and home owners to be bailed out. Basically, whether you are a democrat or a republican, rewarding failure and stupidity is the new American way. The American dream is no longer to be successful by virtue of hard work. It is now about being bailed out by an increasingly socialist government, led by the current president, George Bush (Marx must be laughing in his grave).

Blame seems to be flying in every direction except the direction of those responsible for the problem. Sure the banks were trying to push loans that were not in the best interest of borrowers. But you know what? Casinos are not in your best interest either. Yet people gamble there. Should they be bailed out by other tax payers money too when they lose? If not then why should a consumer who makes a stupid financial decision be bailed out?

GM, Ford, and Chrysler are now demanding a bail out.  Hmmm! so for the past 15 years they have been building and perfecting trucks and SUVs while every other auto manufacturer in the world focused on fuel efficiency.  And now the tax payer must pay for their stupidity?

Now the newest argument being made by the communists in Washington DC is that they agree that these companies and people should not be bailed out but if they are not then the impact on the economy will be huge or catastrophic.  So bailing out the people who made the mistakes is supposedly in our best interest.

Let's see how this plays out.  Imagine you bought a house for $500,000 and so did your neighbor.  But you see, you worked hard and you were smart so though you could have bought a $1000,000 house on an interest only loan you stuck to buying what you knew you could truly afford.  Your neighbor however was gambling.  He, unlike you, could only afford a $200,000 house.  But he ought the $500,000 house on an adjustable rate loan that made the first 5 years of ownership affordable.  He knew very well that the rates can go up after 5 years.  He also knew very well that real estate prices can go down.  But he gambled on the fact that a decrease in real estate prices is rare.  So he thought he can live beyond his means for 5 years and then when the mortgage rates goes up he can sell the house for a profit or refinance it at a lower rate.  Hey! dumbo, rare doesn't mean never.  Real estate prices do go down.

So now your neighbor's 5 year honeymoon with a low rate and probably no principal payment has come to an end and he has to pay 7% on a house that he couldn't and still can't afford.  He tries to sell his house, but wait, its worth only $300,000.  So if he sells he takes a $200,000 loss which he cannot pay for.  Ahaa! so let's refinance it.  Wait, who will refinance a $500,000 loan on a house worth $300,000?

Bingo! and so we have our housing crisis. Well just one facet of it.  There is a lot more to our current global financial crisis.

So now our president and president elect feel that these stupid home buyers should be rescued.  How?  By screwing you, you the person who made the wise choice when buying your house.  They want your tax money to buy the bad loans from the banks and then reissue loans to those morons who made bad decisions under more favorable conditions. 

For example:

  • Your neighbor's loan will be bought by the government using your tax money and then your neighbor will get a $300,000 loan for his house, i.e., his loan will be adjusted to match the current property value.
  • Or maybe the government through the  banks will ensure he gets an interest rate of say 3% so he can afford payments on his house.
  • Or a combination of the two

What?  Now wait a minute.  Here you are.  You made all the right decisions and you are paying $500,000 at 6% for a house that your bought for $500,000 and your neighbor is going to pay $300,000 at 3% for his $500,000 house.  And to make matters worse its your tax money that is going to give your neighbor this sweet deal. 

Wow! even the mob could not have created a better scheme than Washington.

A New Approach - Reward the Smart People

So how about a new approach?  An approach that will actually reward the people who made the right decisions and who did not create this economic crisis in the first place.  How about if the government did the following:

  • Offer low interest rates to people who have good credit.  These special rates are available only to buy houses that are owned by distressed (stupid) owners.
  • So you (the smart owner) can buy your neighbor's $500,000 house for $500,000 but at 1% or maybe 2% 30 year mortgage.
  • This way the stupid owner can pay off his debt.  Yes, he no longer owns a house.  He is back to renting.  But that's ok.  He should never have been owning this house to start with.  remember?  That's how the problem started.
  • The smart owner gets rewarded for being smart and helps preventing an economic crisis.
  • Oh! How do you afford the 1%-2% rates?  Well that's the bail out money put to good use.  Tax dollars should be used to provide incentives for  growth, not to reward stupidity.

Ok, enough rants for the day..... :-)


Categories:   Rants | Economics
Actions:   E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed