Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
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" /> –  vulcan raven Aug 5 '13 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. –  vulcan raven Aug 5 '13 at 14:07

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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