Instead of the Default View 'All Site Content' links to List Settings

In Windows SharePoint Service v3 (WSSv3) and Microsoft Office SharePoint Server 2007 (MOSS), there is a link in the Quick Launch area of sub webs (unless it's been hidden or disabled) titled "View All Site Content". This link will navigate to an ASPX page in the Layouts folder called ViewLsts.aspx which is designed to show you all the libraries and lists within your web.

 

If you hover over the links for the Lists, you'll notice that out of the box (OOTB) they will all link to the AllItems.aspx view of each list -- because All Items is the default view for each of these lists. Now you may notice that some of your lists will be linked to ListEdit.aspx instead as in the next screenshot.

 

Now, this may or may not be a problem for you or your users, but I had a customer asking me first why this was happening and next how to fix it...

 

The first place I looked was in the 12 hive (by default, C:\program files\common files\microsoft shared\web server extensions\12) and down into Template\Layouts because that is where "View All Site Content" navigates to...specifically Viewlsts.aspx. If you open this aspx page in any text editor you can see the code used to render the results and you'll see something like the following:

 <%
 string listViewUrl;
 try
 {
 listViewUrl = spList.DefaultViewUrl;
 }
 catch
 {
 listViewUrl = "";
 }
 if (listViewUrl == "")
 listViewUrl = "ListEdit.aspx?List=" + spList.ID.ToString("B").ToUpper();
 %>

What this code shows us is that if the DefaultViewUrl property of the list being investigated throws an exception, then we will set the variable -listViewUrl- to an empty string. The next thing we check is to see if the variable is an empty string and if so, then we set the link to ListEdit.aspx.

 

Ok, great!  Now we have a theory as to why the link is different... how do we fix it?  That's the easy part, you simply have to set a view for the list in question as the default view. In my reproduction of the scenario, I navigate to the List Settings page and can easily see there is no default view.

 

By clicking on the link for "All Items", SharePoint will take me to the Properties for the View and I can select to make this view the default view.