Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a custom job that creates a view. In my custom view I want to display the column with the "linked to item type".

Please guide..

Thanks in advance

share|improve this question
add comment

1 Answer

When you add the FieldRef inside the ViewFields add an Attribute LinkToItem="TRUE"

<ViewFields>
 <FieldRef Name="DocIcon"/>
 <FieldRef Name="Filename"/>
 <FieldRef Name="Modified" LinkToItem="TRUE"/>
 <FieldRef Name="Editor"/>
</ViewFields>

If you're creating the view programatically then unfortunately there is no way to set this attribute through the SPViewFieldsCollection returned by SPView.ViewFields.

So you have to:

  1. do all of your setup in code
  2. call SPView.GetViewXml
  3. do string manipulation to add the attribute
  4. call SPView.SetViewXml
share|improve this answer
    
Thanks @Per Jakobsen for ur answer. But I am not getting where should I write this code. I am creating the view by C# code. Can you please tell me where should I include this in my code. –  Mansi Desai Mar 27 '12 at 4:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.