MOSS: Site Column: LinkedTitleDocNoMenu
MOSS 2007 (and I believe SharePoint 2003 as well) has a number of built-in site columns for linking to the item or document in a list/document library, while displaying either the Name or the Title, with or without the Edit context menu.
Unfortunately, the exact combination that I needed is not provided: Display the Title field of a DocumentLibrary item, with a link to the document (not item property page), and do not display the context menu.
The CAML I came up with is listed below for future reference - it borrows heavily from LinkedFileNameNoMenu:
<Field ID="{4EB765CD-0750-46fc-9058-CFBAC553F82F}" Name="LinkTitleDocNoMenu" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitleDocNoMenu" Group="AIS" ReadOnly="TRUE" Type="Computed" DisplayName="$Resources:core,Title;" DisplayNameSrcField="Title" Filterable="FALSE" AuthoringInfo="$Resources:core,linked_to_document;"> <FieldRefs> <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title"/> <FieldRef ID="{687c7f94-686a-42d3-9b67-2782eac4b4f8}" Name="FileLeafRef"/> <FieldRef ID="{30bb605f-5bae-48fe-b4e3-1f81d9772af9}" Name="FSObjType"/> <FieldRef ID="{94f89715-e097-4e8b-ba79-ea02aa8b7adb}" Name="FileRef"/> <FieldRef ID="{39360f11-34cf-4356-9945-25c44e68dade}" Name="File_x0020_Type"/> <FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId"/> </FieldRefs> <DisplayPattern> <IfEqual> <Expr1> <LookupColumn Name="FSObjType"/> </Expr1> <Expr2>1</Expr2> <Then> <FieldSwitch> <Expr> <GetVar Name="RecursiveView"/> </Expr> <Case Value="1"> <LookupColumn Name="FileLeafRef" HTMLEncode="TRUE"/> </Case> <Default> <SetVar Name="UnencodedFilterLink"> <SetVar Name="RootFolder"> <HTML>/</HTML> <LookupColumn Name="FileRef"/> </SetVar> <SetVar Name="FolderCTID"> <FieldSwitch> <Expr> <ListProperty Select="EnableContentTypes"/> </Expr> <Case Value="1"> <Column Name="ContentTypeId"/> </Case> </FieldSwitch> </SetVar> <FilterLink Default="" Paged="FALSE"/> </SetVar> <HTML><![CDATA[<A onfocus="OnLink(this)" HREF="]]></HTML> <GetVar Name="UnencodedFilterLink" HTMLEncode="TRUE"/> <HTML><![CDATA[" onclick="javascript:EnterFolder(']]></HTML> <ScriptQuote NotAddingQuote="TRUE"> <GetVar Name="UnencodedFilterLink"/> </ScriptQuote> <HTML><![CDATA[');javascript:return false;">]]></HTML> <Column Name="Title" HTMLEncode="TRUE"/> <HTML><![CDATA[</A>]]></HTML> </Default> </FieldSwitch> </Then> <Else> <HTML><![CDATA[<A onfocus="OnLink(this)" HREF="]]></HTML> <Field Name="EncodedAbsUrl"/> <HTML><![CDATA[" onclick="DispDocItemEx(this,']]></HTML> <ServerProperty Select="HtmlTransform"/> <HTML><![CDATA[',']]></HTML> <ServerProperty Select="HtmlTrAcceptType"> <Column Name="File_x0020_Type"/> </ServerProperty> <HTML><![CDATA[',']]></HTML> <ServerProperty Select="HtmlTrHandleUrl"> <Column Name="File_x0020_Type"/> </ServerProperty> <HTML><![CDATA[',']]></HTML> <ServerProperty Select="HtmlTrProgId"> <Column Name="File_x0020_Type"/> </ServerProperty> <HTML><![CDATA[')">]]></HTML> <Column Name="Title" HTMLEncode="TRUE"/> <HTML><![CDATA[</A>]]></HTML> <IfNew> <HTML><![CDATA[<IMG SRC="/_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/images/new.gif" alt="]]></HTML> <HTML>$Resources:core,new_gif_alttext</HTML> <HTML><![CDATA[">]]></HTML> </IfNew> </Else> </IfEqual> </DisplayPattern> </Field>
YMMV, no support is offered...
Labels: howto, moss, programming, sharepoint
0 Comments:
Post a Comment
<< Home