Using a Document Property as a Page Title

There are a few pages on this site located in a basic Web Part Page library that is cleverly named Webpart Pages. The default page title for these pages is ‘ListName – ItemName‘.

The code that does this is:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">

    <SharePoint:ListProperty Property="Title" runat="server"/> –

    <SharePoint:ListItemProperty Property="BaseName" MaxLength=40 runat="server"/>

</asp:Content>

If I left this alone and added a page named MyPage to the library, the page title will be Webpart Pages – MyPage.

The user will see this title on their browser’s title bar, but more importantly, the title will show up in any search engine results.

If you need more control you can add a column to the document library and use its contents instead. Add a column named PageTitle to the library and set it to whatever you want to display.

Change the code to:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">

    <SharePoint:ListItemProperty Property="PageTitle" MaxLength=40 runat="server"/>

</asp:Content>

As you can see, the SharePoint:ListItemProperty web control is a handy way to insert the value of any column in the current item wherever you need it in your page.

February Atlanta .Net User Group Meeting

Monday, February 25, 2008

6:00

Networking and Refreshments

6:30

Tutorial or Q&A Session

7:00

Announcements

7:15

Technical Presentation


Visual Studio 2008 Overview for Architects

Speaker: Doug Turnure

If your job as a Software Architect is to research and exploit technology to help achieve business results – then you need to take a look at what has just been released in Visual Studio 2008 and the .NET Framework 3.5. In this talk we will discuss several of the many new features you need to understand and explore to be able to fully leverage these new capabilities in your environment, including multi-targeting support, new features for SOA, and web enhancements. Finally, we will discuss the road ahead and preview some of the local architect, web design, and developer events that you can use to help further your understanding of Microsoft platform and development technologies.

About the speaker:  Doug Turnure is a Developer Evangelist with Microsoft Corporation, focusing on emerging technologies. He serves in the community as a developer, author, trainer, and occasional conference speaker. His specialties include .NET internals, memory management, and distributed communication, although he enjoys anything pertaining to .NET. Prior to joining Microsoft, he spent five years as an instructor and course author with DevelopMentor and Aggelos, Inc. Doug is based in Atlanta, GA.

Meeting Location and Directions

Microsoft Corporation
1125 Sanctuary Pkwy.
Suite 300
Atlanta, GA 30004
Directions to Microsoft

Anonymous Access in SharePoint – Shocking Secrets Revealed!

Reza Alirezaei has an excellent 3-part article on anonymous access in SharePoint that uses the example I created here but improves upon the concept in a number of important respects, not least of which includes packaging it as a feature.

He does a thorough job of explaining some of the implications of out-of-the-box anonymous access that I alluded to, but never got around to really explaining.

Since I hate to just link without adding anything, I’ll point out one quirk in anonymous access that he doesn’t mention. Turning on anonymous access in one zone has the unfortunate behavior of giving all authenticated users the same rights as an anonymous user on all of the zones in the web application.

I encountered this recently when I had one zone set up that did not allow anonymous access and the Restricted Read permission level. I extended the site to another zone and configured it for anonymous access to the entire site. The members on the original zone were then able to browse the list because the configuration gave them more rights than Restricted Read even though the zone they were using was not configured for anonymous access!

Based on my reading of the documentation it was by design. That said, it’s no secret that I find the design lacking and that is one more reason why I use FBA when I want anonymous access; uniform control of authorization via Permission Levels.

Ok, maybe not ‘shocking’ or ‘secrets’….

New eLumenotion SharePoint Skinner Setup

I just uploaded a new version of the installer. The program is the same and it will stay that way for a few more weeks at least. But, this version of the MSI should alleviate some of the issues people have reported with the Microsoft.mshtml assembly. The file is now installed locally instead of assuming it will be in the GAC. It turns out that machines without Visual Studio might not have the interop assembly and this caused a variety of errors that I could not reproduce because… I have Visual Studio.

Don’t you just love COM interop?

Visual Studio 2005 Extensions for WSS 1.1 Released

Well, no sooner do I write that I am not a big fan of VSeWSS that I discover 1.1 is released. I just downloaded it and ran through a few of the reasons why I didn’t like the previous version and why I thought 1.1 CTP showed promise and I have to say after a very cursory review that 1.1 might not suck. In fact, I think it looks pretty good!

It remains to be seen whether I will ditch my personal VS template and wspbuilder in favor of the extensions or if I will find them to be complimentary, but I must say that on the surface VSeWSS 1.1 looks very good indeed! And, if nothing else, the team that makes it has made huge strides in the last few months. Kudos!

You can get the extensions here.

Things I Always Do to web.config When Developing and Debugging in SharePoint

First off, if you are debugging a feature receiver or any other type of assembly installed in the GAC, read this post.

Beyond that, I always make the following changes to web.config:

Whenever you see "An unexpected error has occurred," you are looking at a custom error screen. If you want to see the real error, find <customErrors
mode="On" />
and change it to <customErrors
mode="Off" />
to see the standard ASP.Net error page.

I also like to see the call stack and trace information. Find <SafeMode
MaxControls="200"
CallStack="false"
DirectFileDependencies="10"
TotalFileDependencies="50"
AllowPageLevelTrace="false">
and change it to <SafeMode
MaxControls="200"
CallStack="true"
DirectFileDependencies="10"
TotalFileDependencies="50"
AllowPageLevelTrace="true">

Finally, I like to enable generation of debug symbols for just in time compilation in the rare case I need it. Find <compilation
batch="false"
debug="false">
and change it to <compilation
batch="false"
debug="true">
.

None of these configuration choices are appropriate for a production environment, but they all make development much easier. Seeing the actual error and call stack has saved many of the few hairs I have left on my head. "An unexpected error has occurred" is no help to a developer!

Author: Doug Ware

My Basic SharePoint Developement VM

I get a lot of questions about my VM configuration and I think I might as well post it here.

First off, although I appreciate that Virtual PC and Server are free, I use VMWare Workstation. You can evaluate or buy it here: http://www.vmware.com/products/ws/. If I had to sum up why VMWare works better for me than the Microsoft offerings in one word, I’d say, ‘snapshots’.

When developing in SharePoint, it is all too easy to inadvertently mess up the server. One thing I do all the time when I am in a hurry is delete my Shared Services Provider instead of my intended Web application (I swear I’ve done it 1000 times). Snapshots make restoring my development environment to a known good configuration fast and easy.

So, what is installed on my VM?

First off, I run Windows 2003 Standard + MOSS whatever version. This depends on the project and ranges from WSS 3.0 SP1 to MOSS Enterprise SP1.

Beyond that I recommend:

  • Visual Studio Professional. I still run 2005 SP1, but that’s only because I haven’t got round to installing 2008.
  • WSS 3.0 SDK. It’s available here.
  • MOSS SDK (if the project is MOSS). It’s available here.
  • Of course I always install my own eLumenotion SharePoint Skinner available here.
  • WSPBuilder is a must. You can get it here. If you are creating DDF files and manifest.xml files by hand, you are working way too hard!
  • The same goes for U2U’s CAML Query Builder. Hat’s off! This is a great time saver and you can find it here.
  • You know you’ll need Office 2007!
  • Even if you don’t need all of Office 2007, you will need Microsoft Office SharePoint Designer 2007.
  • Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation) if you need to develop workflows, and you know you do!
  • Internet Explorer Developer Toolbar, is a must when working with styles and other detail work.
  • Finally, I usually need Visual Studio Tools for Office 2005 SE. You can get it here.

I am not a big fan of Visual Studio Extensions for Windows SharePoint Services, but the 1.1 CTP does show promise.

Edit: Not long after putting up this post they released Visual Studio Extensions for Windows SharePoint Services 1.1 which looks like a big improvement. You can get it here.

Author: Doug Ware