“Give a man a fish and you feed him for a day. Teach a man to fish and he will start providing fish for his community, putting other fishers out of business making them unemployed and totally dependent on the man, turning them into rebels who will one day turn against society and burn the whole village down. Give a man a fish.” – Unknown
Now, this took me some time to figure out.
There is an SPListTemplate property that is called UseRootFolderForNavigation, which is ‘documented’ in the SDK at http://msdn.microsoft.com/en-us/library/ms439434.aspx. The description hints that this can be a really useful thing for modifying a list, stating that by setting this property a use can be sent to a custom page rather than directly to the default view. To accomplish this a custom welcome url should be set.
The problem arises because there is virtually no other information available on this property. Do a google, at the time of this writing, a whooping 5 hits are found, including two from MSDN, one question just listing the property and one blog post that is just a copy of one of the MSDN articles. Where would I set the custom welcome url?
So, it is time to do some digging. Here is how I dug, the conclusion and the solution is further down.
Why explain how I found this? Well, first of all, I spent several hours trying to search for the solution. If I spend that much time you should at least suffer a bit with me. I am evil, I know.
Second, by seeing how I searched, perhaps you guys and gals can gain something from the process.
But mostly, it is to make you suffer. Muhaha.
I started with the SPList. After all, it is an SPListTemplate, right? So, it stands to reason that the custom welcome url should reside in the list somewhere. Not at all. No property called welcome url or anything welcome at all.
So I thought, perhaps this is deprecated and not in use? After all, I never did anything like this in WSS2, so I don’t even know if it is a new feature or existed earlier. However, the documentation for SPListTemplate in WSS2 lists no such property so this is actually a new feature.
Then I thought, if this is a new feature, they must have put it there for a reason. Likely some new feature of WSS 3 uses this thing. What kind of new feature in SharePoint is a list with a custom welcome url? Ah, the wiki page library!
Sure enough, the Wiki page library feature element file WebPageLibrary.xml sets UseRootFolderForNavigation to True. Surely, creating a wiki library and then examining the list would reveal some clues to my mystery. At least there should be a hint from the welcome page being home.aspx?
But no. There is no welcoming url, no home.aspx, and, as we all know, there is no property bag in SPLists that could have held the secret. There is a PropertiesXml but that does not hold anything resembling our treasure either.
However, there _must_ be something that makes the wiki list go to home.aspx rather than the default allitems.aspx. And I also know, or at least I have seen no evidence to the contrary, that Microsoft has used only documented features when they make their site definitions. Perhaps, then, there is a feature which references home.aspx. Can there be something in the feature framework that I have missed? A search for home.aspx in the \TEMPLATE\FEATURES yields no results. Darn.
My final shot before I went mad was to try .Net Reflector. Looking at the source code for SharePoint must produce something that can reveal the truth. It turns out that I should have gone for reflector right away, my hours of research would have been done in 5 minutes.
Turns out, a quick search for welcome in the Microsoft.SharePoint.dll reveals that SPFolder has a property called WelcomePage. Doh. UseRootFOLDERforNavigation. Why didn’t I see that before. So, a quick verification with SharePoint Manager 2007 reveals that the folder for the wiki library, located under the root folder of the site indeed has the WelcomePage set to home.aspx.
How is the property set? There is a feature called WikiWelcome that contains a FeatureReceiver called SPWikiWelcomeFeatureReceiver. This feature is activated when you create a wiki site and a team site. The feature receiver OnFeatureActivated sets the WelcomePage property of the folder.
So, now you can go out and have your lists behave like pages. I’ll get back to that in a future article.
Edit: Actually, there still is a mystery to be solved. I stated above that the WikiWelcome is activated on the team site. It isn’t. The wiki page library is activated on team sites, not the WikiWelcome. So, that still leaves the mystery of where the WelcomePage is set when adding a WikiPage library to a non-wiki site. Expect a follow-up at some point.
Found this article valuable? Want to show your appreciation? Here are some options:
a) Click on the banners anywhere on the site to visit my blog's sponsors. They are all hand-picked and are selected based on providing great products and services to the SharePoint community.
b) Donate Bitcoins! I love Bitcoins, and you can donate if you'd like by clicking the button below.
c) Spread the word! Below, you should find links to sharing this article on your favorite social media sites. I'm an attention junkie, so sharing is caring in my book!