Question

I've setup a DataFormWebPart which aggregates tasks from subsites. The user doesn't only want to view the tasks, there should be an option to edit / open them as well. So I need a way to at least construct a hyperlink to the task.

The incoming data from my sharepoint datasource features fields like FileRef, FileDirRef, ID and such.

Combining these makes it possible to construct something like: /sites/test/4/Lists/Tasks/../../_layouts/listform.aspx?PageType=4&ListId=627D073D-30F2-480F-AE84-E04115B7A955&ID=2

Using the XSL / XML fields like this: /{substring-after(@FileDirRef, '#')}/../../_layouts/listform.aspx?PageType=4&ListId={@ListId}&ID={@ID}

But in my humble opinion that sucks. It assumes the task list is always 2 levels deep from it's parent web (hence the ../../), which it might not be. So I'm looking for a better way to do it. I can't just call listform.aspx on the current site; since I'm rolling up data from subsites.

I checked the ddwrt namespace, but there doesn't seem to be anything helpful there. Who has got a nice solution for this (don't assume I'm the first one trying this).

To clarify some more. I want to display a webpart which:

  • Rolls up tasks from all subsites
  • Displays the tasks, their statuses, etc.
  • Displays the name of the web their on
  • Contains a link to the tasks display and/or edit form
Was it helpful?

Solution 2

This is what you'll need using ID's: CopyUtil.aspx (what's in a name, right?)

http://weblogs.asp.net/jan/archive/2008/02/26/copyutil-aspx-a-little-sharepoint-gem.aspx

OTHER TIPS

You shouldn't need to use the /../../ method if you are directing to a _layouts page. You could simply do it as (not fully tested, going from memory):

<a href="http://your.spdomain.com/{@FileDirRef.urlencodeasurl}/_layouts/listform.aspx?PageType=4&ListId={@ListId}&ID={@ID}">text</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top