Question

I am fetching items from all Form libraries in a site collection and displaying name, Document Id (service is enabled in site collection features) and name of the person who submitted the form:

Form Name | ID | Submitter Name

Now, I want to prepend the ID value with Library name, like Student Form - <document id>.. where "Student Form" is the form library name.

In ItemStyle.xsl, is there a way to access library-level metadata ? Or if it is just confine to item level data (as it sounds), what are the other methods to achieve that?

Was it helpful?

Solution

You need to edit the guts of the CQWP and use the ViewFieldsOverride setting to introduce the ListProperty in the view fields. If you need the Site name, also include ProjectProperty. You can then use ListProperty.Title and ProjectProperty.Title in the XSL.

There is a little tutorial here: http://sharepoint-tweaking.blogspot.co.nz/2008/04/displaying-listname-and-sitename-when.html and the Microsoft take below, with detailed GUID information following the quote:

Using the ViewFieldsOverride property is more challenging because it requires that you include all of the default fields plus the fields you want to add. However, if you want to add the title of a site or list to the output, it is the only way to accomplish this. If you want to add your own fields via ViewFieldsOverride, you can start by adding the following and simply appending your fields. The following represents all of the fields that are included natively by CQWP.

source: http://msdn.microsoft.com/en-us/library/ff380147(v=office.12).aspx

Although both links refer to 2007, it works just as fine in 2010 in my environment.

OTHER TIPS

@FileRef will get you the path of the form and you would then need to process that - maybe with substring-before() and substring-after() to get just the name of the library.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top