Scenario:
If some one ask me my favorite topic, its CAML , so much can be done with CAML.
I wanted to display document title using a custom field.
Solution:
Field tag support Display pattern.
Code:
<Field ReadOnly="TRUE" Type="Computed" Name="LinkedToTitle"Article:CAML Viewer
DisplayName="Document Title" DisplayNameSrcField="Title"
AuthoringInfo="(linked to document)">
<FieldRefs>
<FieldRef Name="Title"/>
<FieldRef Name="FileRef"/>
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[<A HREF="]]></HTML>
<HttpHost URLEncodeAsURL="TRUE"/>
<LookupColumn Name="FileRef" URLEncodeAsURL="TRUE"/>
<HTML><![CDATA[">]]></HTML>
<Switch>
<Expr>
<Column Name="Title"/>
</Expr>
<Case Value="">
<UrlBaseName HTMLEncode="TRUE">
<LookupColumn Name="FileRef"/>
</UrlBaseName>
</Case>
<Default>
<Column Name="Title" HTMLEncode="TRUE"/>
</Default>
</Switch>
<HTML><![CDATA[</A>]]></HTML>
</DisplayPattern>
</Field>
3 comments:
I am trying to figure out how to use this. I got it packaged up into a feature... however it doesn't show up as a custom column. Any tips?
Couldn't make this work in SP2010, any idea?
GBelzile.. i need to try for SP2010. I dont see any reason it will not work in SP2010.. but will post update soon
Post a Comment