1

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?

2 Answers 2

2

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.

2
  • Thanks. It worked but I can't access DocumentID with it (I enabled DocumentID feature on Site collection for all Form libraries). Any thoughts how to make it work? I tried both <FieldRef ID="{3b63724f-3418-461f-868b-7706f69b029c}" Type="Text" /> and <FieldRef ID="{ae3e2a36-125d-45d3-9051-744b513536a6}" Nullable="True" Type="Text" /> Commented Aug 5, 2013 at 13:05
  • I found it, I extracted the GUID of Document ID using this script. <FieldRef ID="{3b63724f-3418-461f-868b-7706f69b029c}" Nullable="True" Type="Text" /> worked for me! Thanks again. Commented Aug 5, 2013 at 14:07
0

@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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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