How do you specify the source list when doing a CAML query that covers more than one list? Using a tool like U2U CAML Query Tool to write your queries doesn’t specify any field that references the source list.
To reference the list URL you need to use the FileDirRef field. Here’s some example code which includes logic that strips out the URL from the string that’s returned as it’s a Lookup field type:
query.ViewFields = @”<FieldRef Name=’FileDirRef’ Nullable=’TRUE’ />”;
urlValue = row["FileDirRef"].ToString().Substring(row["FileDirRef"].ToString().IndexOf(“#”) + 1);
Advertisement
June 9, 2009 at 10:37
Hi there,
I think this info could be just what I am after, but I need to use this in a slightly different context. I’m using a new ItemStyle XSLT in conjunction with a Content Query Web Part to produce a site wide rollup of tasks with links to their corresponding view form.
Any idea how I apply your IndexOf to my XSL? I currently get the ID and a # prepended to my URL!
``
produces:
`www.server.co.uk/5;#site/Lists/Tasks/DispForm.aspx?ID=5`
Any light you could shed here would be much appreciated.
Many thanks
Ben
June 9, 2009 at 10:41
Last part of that comment got mangled!
XSL:
Produces the url shown above and needs to be modified using something like your IndexOf ?
Many thanks
June 9, 2009 at 10:44
Really sorry – am having fun with posting code excerpts.
<a href="/{@FileDirRef}/DispForm.aspx?ID={@ID}">Thanks once more,
Ben