Geeks With Blogs

Tangible Thoughts SharePoint, MOSS? and all the other questions

Yes its true, take a look at any of the default WebParts or ListViews in SharePoint and you can learn a thing or 2.

For instance recently I wanted to find all the related items in an issues List.

I was stumped until I took a look at the CAML in the default Issue Item Edit form, which goes something like this

   

<Where>

<And>

<Eq>

<FieldRef Name="IsCurrent"/>

<Value Type="Boolean">1</Value></Eq>

<And>

<Neq>

<FieldRef Name="IssueID"/>

<Value Type="Integer">

<GetVar Name="IssueID"/>

</Value>

</Neq>

<Eq>

<FieldRef Name="RelatedID"/>

<Value Type="Guid">

<GetVar Name="RelatedID"/>

</Value>

</Eq>

</And>

</And>

</Where>

Translation in English: Find all issue items that are ‘current’, and where the Issue ID does not match the current Issue ID, and where there RelatedID is the same as the current items RelatedID. Quite simple actually, but can take you hours/days hunting through the API to try to find something that can do this for you.

Based on the above if you want to find the entire history of an Issue item its

<Where>       
        <FieldRef   Name="IssueID"/>       
        <Value   Type="Integer">       
               <GetVar   Name="IssueID"/>       
        </Value>       
</Where>   

Note to all, if you want to duplicate a default SharePoint view, take a look at its CAML.

Posted on Monday, January 10, 2005 12:08 PM Misc | Back to top


Comments on this post: You can learn a lot from just looking at CAML in the default views

# re: You can learn a lot from just looking at CAML in the default views
Requesting Gravatar...
Thanks for the tip, this worked out perfectly! As usual, the best help for SPS comes from blogs.
Left by Pierre on Jun 16, 2005 3:30 PM

Your comment:
 (will show your gravatar)


Copyright © Tariq | Powered by: GeeksWithBlogs.net