.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Why do we need Common view fields in content query web part?

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :SharePoint
I am a bit confused on the purpose of "CommonViewFields" in CQWP. Almost all the write-ups on the web says that if we need a custom column to be available in the web part's XSL, we need to export the webpart file, add the columns to "CommonViewFields", import the web part to the site. However I noticed that, when I create a custom style template in my "ItemStyle.xsl" and simply add a line like <xsl:value-of select="@MyCustomColmn"/>, then "MyCustomColumn" appears automatically under "Fields to display" in the tool pane as a text box prompt, when I edit the web part and select my style template. I can then simply fill-in my column display name under "MyCustomColumn" and the web part works perfectly fine. (There is NO NEED to export the web part, edit the ".webpart" file and add "commonviewfields" etc..etc..etc) If this works, then what is the real need for "commonviewfields" ? Can someone shed light on this? I am totally confused.. (SharePoint 2010)          

View Complete Post

More Related Resource Links

Editing the list and view of a content query web part


I have added a content query to my site which is querying a master contact list.

Once I have added the web part I then want to customised how it is displayed, i.e. first name, company name etc.

I am not getting a list menu in the ribbon when I check the box next to my content query web part heading.

Can anyone help.

Content Query Web Part missing in SharePoint 2010

If you don't see content query web part listed in the web parts list, this is because you have not enabled "Search Server Web Parts" feature in site collection features. Enable this feature and content query web part will show in the list of web parts.

Customizing the Content Query Web Part in SharePoint Server 2007

Walk through how to customize the Content Query Web Part in SharePoint Server 2007 to query content across multiple sites in a site collection and display the results in any way that XSL can support. Learn how to get similar results when customizing the CQWP does not meet your needs.

Why is the Content by Query Web Part CommonViewFields attribute not working as expected?

I am using the Content by Query Web Part to show data from a Custom List.  I have already added to the XSL "ItemStyle" sheet so that I can pick the correct Item Style.  That has worked fine - I have been able to show whatever fields I would like and apply any CSS Styles I would like to them.  The issue I am having is in formatting the field correctly.  I have two different fields in my current example that need to be formatted: [1] I want to show an Image, but right now it shows the URL  [2] I want to show Rich Text, but right now it shows all the HTML Code as Plain Text.  I have looked at many articles online, and they all tell me to change the following in the WEBPART file from: <property name="CommonViewFields" type="string" /> to: <property name="CommonViewFields" type="string">Thumbnail, Image;Teaser, RichHTML;</property> What I am doing wrong?  The Web Part still runs, but it does not format the fields any differently.  Thanks for the help!

Content Query Web Part (CQWP) fails to show picture items from a document/picture library in an anon

I have a Picture Library and am trying to use the CQWP to display a list of items in the library.  The web part shows the items fine in authenticated mode, but it fails to show the items to anonymous users. The error log message is: Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.PreProcessForDocumentIconAndOnClickAttribute()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) I'm running SP 2010.  I've tried various scenarios including: 1. Using the default publishing template. 2. Using the blank site template with publishing and lock down features enabled. 3. Us

Content Query Web Part, QueryOverride and sorting by site

Hello, I want to display documents from various sub-sites in my portal. These documents must be grouped by site and only documents created in the last 7 days should appear in the CQWP. The first difficulty I encountered was that I cannot apply a filter like " date created< today - 7" in the tool pane of CQWP. So I searched the web and found that I can create a custom query by exporting the web part and changing the QueryOverride property. Thing is that you cannot specify a CAML group clause in the QueryOverride property. It is just not supported. It seems though (thanks to this post: http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/92e335ad-48f6-4572-a314-752c8b41ef8f) that if you specify a "order by" clause for the field you want to group by, then you can use this field in the group by section of the CQWP tool pane. Thus, I need to sort my results by site (because I want to group by site afterwards). But how do I do that? After another long research, I found out (http://msdn.microsoft.com/en-us/library/ff380147%28office.12%29.aspx#odcsp2007CustomizeCWQP_CustomizingUsingtUIwebpartFile) that I have to specify the ViewFieldsOverride property in order to include the original site that my document comes from. And in the property I have to include the following property: <ProjectProperty Name="Title"/>. But still I ca

Content Query Web Part Error

Hi,I get the following error when i try to add a ContentByQuery.webpart using SharePoint Server 2007:   "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator."   I've seen a lot of people having this problem when they aren't on an admin account, but I am, and this error happens before I can do any configuration at all to the webpart.   The webpart didn't show up in the webpart list at first, so I added it from the webparts gallery. The actual name of the part is Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.Is this the wrong kind of webpart or what seems to be the problem? I don't have much experience in Sharepoint since before, as you might can tell.Help would be VERY appreciated, thanks in advance.

Content Query Web Part Styling and Columns with Underscores



I'm having a problem with using a column which has an underscore in a custom styled Content Query Web Part. To keep it simple the column name is Mobile_Content, with an underscore. This is causing the issue as columns without underscore work fine. My CommonView Fields property looks like this in the .webpart file:



property name="CommonViewFields"

Paging Content Query Web Part Results


I am running SharePoint 2010 Enterprise in a Standalone installation on a development computer attempting to figure out a way to display press releases 10 per page with as many pages as needed to cover the results.  Considering I'm dealing with at least 2000 press releases, I can't have the web part load all the press releases and use javascript to display 10 results at a time.  As such I've attempted to use this: http://blog.mastykarz.nl/sharepoint-2010-content-query-web-part-paging/ however I've been unsuccessful. 

While I successfully added and deployed the solution to my development environment, enabled the feature on the site collection and added the web part, I cannot style the end results to actually show the paging.  I receive a "The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced. " error whenever I attempt to define the ItemStyle XSL Style Sheet (/Style Library/XSL Style Sheets/ImtechContentQueryMain.xsl) within the area the webpart takes up (i.e. it doesn't completely break the page, I get the same error if I define any xsl style sheet there so the .xsl isn't broken, maybe the webpart? maybe my link is wrong?  I used this page:

Content query web part error



I got the following error when i am displaying a list

Cannot save all of the property settings for this Web Part. There is a problem with one or more of the field values below.

Customising XSLT for Content Query Web part


We are using Report Library in SharePoint 2010. We need to display all the columns in the Report Library in this site collection as well as subsites as one list.

We are able to fetch only one column by adding the column name to custom properties column but we are not able to fetch all columns.


<property name="DataColumnRenames" type="string">KB_x0020_Title,Title;Product,Description</property>

<property name="CommonViewFields" type="string">KB_x0020_Title,Text;Product,Text;</property>

Any guidance on how to fetch all columns is appreciated.

Issues after customizing Content Query Web Part


I have used CQWP in my SHarepoint 2010 application where i have done following steps..

1.Add CQWP

2.Provide query to use content

3.Exported the CQWP

4. Change the properties in .webpart file (itemXSL link, mainXSL link, XSL) to refer to my cutomized ContentQueryMain.XSL and ItemStyle. XSL, these 2 XSL's are stored in new folder in Style library

5.After the changes when i import the web part i am not able to open the properties when CQWP is applied in my UI (on clicking EditWebpart)

Kindly provide me some ideas so that i can resolve this problem..!!

Content Query Web Part troubleshooting


I am trying to use the Content Query Web Part, but it is not working properly.  On the Page where the Web Part lives, the content under the title reads...

"Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator."

When I click through to "Modify Shared Web Part," I get what looks like a stack dump (to my uneducated eye).

"Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Could not load XSL file. The system cannot find the file specified. (Exception from HRESULT: 0x80070002) 

   at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.GetXslFile(String templateFileUrl) 
   at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.PopulateDropDown(DropDownList ddl, String selectedValue, String xslUrl, String resourcePrefix) 
   at Microsoft.SharePoint.Publishing.WebControls.CmsDataFormWebPart.PopulateItemDropDown(DropDownList ddl, Str

Inconvenient SharePoint 2010 Content Query Web Part and Anonymous Access


Morning every one

I am hoping some one has found a work around regarding this.

I am using a JQuery random 'quote' generator (http://nextconnect.blogspot.com/2009/12/jquery-random-quote-viewer.html) in my site.I have enabled full anonymous access. My issue is that it still prompts you for the login in order to see the quote generator. I have tried the "ViewFormPagesLockDown" fix but it isn't even activated on my site. And now I am at a complete loss. I did some googling (Read 5 hours) and it seems that in Sharepoint 2010 doesn't have a work around for this and I am really hoping I am wrong.


Any ideas?


Have a great friday :)


Customizing Content Query Web Part (SP-2007)


Hi , i tried following to customize the CQWP as


connect the CQWP and configure according with my new "Template".

Add Column as 

<property name="CommonViewFields" type="string">Title, Text; Description, Note;</property>

 every thing is file but when i want to show this in another page again i have to do this again (Export and Import add "CommonViewFields".

 My Question is that is there any other method so that i don't have to add the "CommonViewFields" only have to change the XSL Template ....


Thanks and Regards Er.Pradipta Nayak

Selecting Result from Content Query Wb Part gets Webpage cannot be found Error

I have MOSS 2007 running on Windows Server 2008.

I have added a custom List to a MOSS 2007 site sollection. The List works fine.

I have added a new webpage to the site collection Home page that includes a Content Query Web Part. When the Content Query WP is configured it returns items from the custom List as expected. But when I select one of the result items returned by the Content Query WP, the Browser says "The webpage cannot be found."

Why doesn't the Content Query WP result navigate to a page that displays the List item selected from the results list?

I have 2 items returned in the CQWP results list and both generate the same error when selected.

If I go to the custom List, the items display OK when selected.

The URLs generating the error looks like:

Content Query Web Part Sharepoint 2010 AND Customize the data presentation


In fields to display you have a Title field. We will like to show two columns (Section Name and Status) in the title field, but only the fist one is displayed in the result.We use this syntax:

Column [Group];Column [Group]

When I use this formula

Section Name [Agresso R&D Base Columns] ; Status [Agresso R&D Base Columns ]

in the title field, the Section Name is displayed, and no Status, When I use this formula

Status [Agresso R&D Base Columns ]; Section Name [Agresso R&D Base Columns] ;

in the title field the Status field is displayed, and no section name. Is this a bug? or is it an other way to show both columns in the title field?


Fields to display Depending on the scope of your query, you can select one or more site or list columns whose values you want to show in the display slots for this style. To specify a column from a particular group, type the name of the group in square brackets after the column name, for example, Column [Group]. Be sure to separate each column you enter with a semi-colon.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend