Article Categories
Archives
Post Categories
  Jump to Information for:
Search:  

With Microsoft Office SharePoint Server (MOSS) 2007 and Windows SharePoint Services (WSS) 3.0, we can use the Content Query Web Part (CQW or CQWP) to display SharePoint content from another source on a SharePoint page. This web part is rather nifty and one of my new favorite things about MOSS 2007.  At first glance you tend to pass it by, then when you see what it can do, it is pretty cool.  Imagine if you will, creating a list in SharePoint 2003 and then adding it as a web part to your WSS home page or SPS portal area.  You are then limited to controlling the view through the Web Part Tool Pane by hiding or showing various columns.   With the CQWP, you can now control how that content is displayed. You can wrap HTML code and styles to format the display nearly however you wish.  Here is a quick example of a CQWP used on the ShareSquared.com site:

Sample CQWP

The data that is used here is stored in a Pages library for a News site, which of course is just a list. Through Item Styles used by the CQWP, I can control the display of the data nearly any way I wish.

Creating the Custom Item Style

First, hands down this is a fantastic blog post to read on the subject: Configuring and Customizing the Content Query Web Part on the ECM Blog.   That post is what I followed to create custom Item Styles.  This article is just to help fill in the blanks on how to use this process for your own site.

I am going to breeze through some of the steps that are documented on the ECM blog, and go into others in more detail that are not documented in that post. 

Add a CQWP To The Site

  1. Add a Content Query Web Part to a page in the site. By default the CQWP will display all of the pages in the site.
  2. Now choose to Modify the Shared Web Part and in the Web Part Tool Pane, expand Query and change the Source settings to the site or list where you want to query the data from. 

    Query settings in the Tool Pane

  3. Optionally update other settings to further refine the data view, such as Content Type and Filters. Select Apply.
  4. For more details, look and Steps 1 and 2 in the Configuring and Customizing the Content Query Web Part post.

Create the Custom Item Style

Now we have a rather boring view of some data. We use Item Styles to jazz up the formatting and selectively show various content, such as Title, Description and Body.  There are already several Item Styles available out-of-the-box, but in my opinion, they have limited use. Go ahead and play around with what is available, there maybe something there that is perfect for your needs and it helps you to see what you can do with an Item Style.  In the Tool Pane, expand Presentation and experiment with the drop down options under Styles. Select Apply to see the changes.

Before we style any content, we need to have the web part pull in the content we want to display. Some content is already pulled in by default, such as Title.  For anything else that is not pulled by default, we need to tell the web part to get those fields. But how do we know which fields are already being pulled in?  It is a bit of a chicken and the egg ordeal, so here are my suggested steps for working all of this information out:

Heads up!  Here is where we deviate from the Configuring and Customizing the Content Query Web Part post.

  1. Open the site in SharePoint Designer (SPD). Navigate to Style Library, then XSL Style Sheets. Open ITEMSTYLE.XSL.  Now doing this will customize (uhghost) the file! But we can always reset this back to the Site Definition and restore it to it's original state.  Be sure to check out the file via SPD or the Site Content and Structure screen in the site.
  2. Take a minute to look at the file.  Every time you see "<xsl:template..." that is the start of a new Item Style.  There is one for each of the out-of-the-box Item Styles that show up in the Styles drop down in the Web Part Tool Pane.  For every custom Item Style that is needed, a new xsl:template block will have to be created.
  3. Scroll down to the bottom of the file. Copy the last xsl:template code block and paste it above the closing xsl:stylesheet tag.
  4. Change the name and match properties in the Template tag to a unique name of your choice:

    <xsl:template name="MyCustomStyle" match="Row[@Style='MyCustomStyle']" mode="itemstyle">
  5. Next we will add a little snippet of code within the Template tags that will render the names of the fields that are being passed.  Note that this code will be temporary! We don't want to leave this in the finished Item Style.

    <xsl:template name="MyCustomStyle" match="Row[@Style='MyCustomStyle']" mode="itemstyle">
    <xsl:for-each select="@*">
        P:<xsl:value-of select="name()" />
    </xsl:for-each>
  6. Save the file.  Return to the site (in the browser) and refresh the page.  Open the Web Part Tool Pane for the CQWP and expand Presentation, then under Styles change the Item Style to the new custom style in the drop down.  Select Apply.
  7. The CQWP will now list out all of the fields that are being passed.

    CQWP Passed Fields

    After each P: is the internal column name for each field that is being passed.  These internal column names are what is referenced later in the code to display the data.  For example:

    <div class="description">
        <xsl:value-of select="@Description" />
    </div>


    Description is the internal column name that is being wrapped and styled with a DIV tag and is the content that will display on the page.  So we can look at the names displayed in the CQWP and see what data is already available for our use.  For example, in this particular case we have Title, Author, Publishing Rollup Image and Publishing Date (PubDate).

Find the Additional Data

Our first goal was to determine what content is already being pulled into the web part.  Now that we have done that, next we need to tell the web part to pull the other data we need. To do this we will need to get the internal column names for the necessary column(s) from the Content Type that is being used for the list.

  1. In the site, open Site Settings, then select Site Content Types.  Locate the Content Type that the list is using.  For example:
    • If you are querying a site and showing pages, look under Page Layout Content Types.
    • If you are querying a list, look under List Content Types.
  2. Select the Content Type name to view the Columns. Locate the column that needs to display in the custom item style. Locate the internal column name one of two ways:
    1. Way One: Click the column name.  In the Change Site Content Type Column screen, hover over the Edit site column in new window link and note the URL that appears in the Status Bar.  The internal column name appears after Field=. It also appears on the Site Content Type screen we just came from in the Status Bar, it is just inline with a lot of other characters. Often the string is too long in the Status Bar to display the Field property.

      Internal column name

    2. Way Two: Right click the link and select Properties.

      Content Type Columns

      The URL listed in the General tab has the info we need, just hidden below the viewable area.  Select the URL with your cursor, hit Ctrl + A to select the full URL, the copy and paste the URL into Notepad.

      Copy the URL

      In the pasted URL in Notepad, locate Field=.  The name that follows in the internal column name.

      Internal Column Name

Now that we have our internal column name, we can return to the instructions in the Configuring and Customizing the Content Query Web Part post and proceed with their Step 3.

Modify the CQWP to Include Additional Data

  1. In your site, in the CQWP, select Export from the web part's Edit menu. Save the .WEBPART file locally.
  2. Open the .WEBPART file in Notepad and search for "CommonViewFields". Replace the Property tag line of code with the code listed below, using your internal column name and the corresponding field type. It is very important that the field type listed is the correct type for the the data. If the field type is wrong, it won't break the site, but the Item Style won't display the content. Available values are:
    • Text
    • Note
    • Number
    • Currency
    • Integer
    • Boolean
    • DateTime
    • Threading
    • Lookup
    • Choice
    • URL
    • Counter
    • DisplayOnly (DisplayOnly field type has no storage of its own)


    • And I have either used or seen these used, but have not seen them documented anywhere:
    • RichHTML
    • Image

    Some field types are easy to figure out.  If we are calling a date, use DateTime. For Title use Text, for body content use RichHTML. String together multiple entries with a semicolon between each pair: Name, RichHTML; Name2, Text.

    <property name="CommonViewFields" type="string">InternalColumnNameGoesHere, FieldType</property>

    For example: <property name="CommonViewFields" type="string">Comments, Note</property>

    At the end of this article I cover how to find out the field type.

  3. Save the file and import it back into the site. (Add a Web Part - Import - select the .WEBPART file - Upload - Drag and drop the web part onto the page).

Now we have two CQWPs on the page.  We can remove the original one. We should also see the newly added internal column name(s) appear in the list of fields.  Yay!!  18 steps later and now we are ready to style!!  No, really, this process moves pretty fast.  Now it is time to return to the XSL file and start making things pretty.

Style the Data in the Item Style

  1. Return to SharePoint Designer and your custom template in ITEMSTYLE.XSL.
  2. For every internal column name that has been included in the web part and needs to display in the Item Style, add it to the template using the xsl:value tag:

    <xsl:value-of select="@InternalColumnNameGoesHere" />

    For example: <xsl:value-of select="@Comments" />

  3. Wrap HTML around the tag to format the data. 
    Please note!!
    When the page renders the CQWP, the site grabs the Item Style for each line of data.  So we can't add a table and expect that each line of data will be in a row.  Instead we get a full table for each line of data.  Keep this in mind as you style the HTML around the data.
  4. Save the file, go to the site and refresh the page.  The new styled content will appear.
  5. To remove markup tags, please refer to about the middle of Step 4 in the Configuring and Customizing the Content Query Web Part post.
  6. When done styling the Item Style, remove the code that lists the fields.
    <xsl:for-each select="@*">
        P:<xsl:value-of select="name()" />
    </xsl:for-each>

The Other Internal Column Names & Finding Field Types

If by some odd reason you were following along with this article and trying to do a CQWP Item Style on an events list, like I was, at the end of this you were probably scratching your head as to why no content would display on your site.  While writing this article I discovered that the internal column name listed in the Content Type isn't necessary the internal content name that should be used for Item Styles.  I am sure I will make some developer have a heart attack with my terminology or what have you, but after a lot of searching I tracked down the real internal column names in the SCHEMA.XML file for each feature (every list type is a Feature). Once I pulled the right internal column name in my .WEBPART file and in ITEMSTYLE.XSL, things worked like a charm.  Consequently, SCHEMA.XML also lists out the field types for each column.

  1. On the web server, open the SCHEMA.XML file for the Feature. The Features are located in the Feature directory:
    Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\(Feature Name)
  2. Locate the SCHEMA.XML file.  It will be in one of the two subdirectories in the Feature.  Open the file in Notepad.
  3. Locate the FIELDS element.  Within Fields are all of the FIELD elements used in the Feature.  Each one lists the column Type (field type) and Name (internal column name).

    Schema file
  4. Use this column type and name in the .WEBPART file and in the ITEMSTYLE.XSL file.

To wrap up my commentary with the Events list, I changed "Comments" to "Description" and the CQWP successfully displayed the content in the CQWP.

Custom Item Style Samples

Here are some samples you can check out to see how it all comes together:

Code: Download
Screenshot: Sample Item Style
Code: Download
Screenshot: Sample Item Style 
posted on Wednesday, November 29, 2006 8:30 AM
Comments
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Duncan
    Posted @ 11/30/2006 10:54 AM
    Do you know how to get a Multiple Lookup column through the ItemStyle.xsl? I have tried using the "Lookup" field type, the "LookupMulti" field type and the "MultiChoice" field type, but nothing ever comes through.
    Thanks for any assistance.
    Duncan
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Heather
    Posted @ 1/3/2007 12:19 PM
    Prashant - If this can be done, I would assume it will require heavy use of XML. Unfortunately I am not an XML developer and just know some basics. I would try the newsgroups: http://heathersolomon.com/blog/articles/resources.aspx#News
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Serman
    Posted @ 1/23/2007 9:54 PM
    How did you find the CQWP under WSS 3.0? I can't ... :(
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Prashant
    Posted @ 12/20/2006 12:50 AM
    Hii,
    I am developing an application in which i have created around 30 form libraries but for the end users i dont want to show these libraries. I just want to show them all the documents present in those form libraries depending upon the item level permission.
    To achieve this i am implementing content query webpart and everything goes fine, but the problem is that i want to create UI of the content query webpart same as of my form library, i mean to say there should be colum headers with sorting and filtering functionality in the webpart for different fields present in the form library.
    I will appreciate any kind of comments or help on this problems.
    Thanks in advance.

    Prashant.
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Dirk
    Posted @ 1/4/2007 3:37 AM
    Hi Heather,

    do you know if it is possible to filter a CQWP by using the "Current User Filter" web part. So make a connection between a CQWP and a filter web part?

    Thnx!

    Dirk
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Byron
    Posted @ 1/6/2007 8:34 AM
    Hello Heather-

    I have a question similar to Dirk's question. I am attempting to connect a BDC List WP to a CQWP so that when I choose an item in my BDC List WP, it passes this to the CQWP which retrieves only those documents associated with that chosen BDC item - a reference to which is stored in a custom column in the document library I have my CQWP pointing to. I know this sort of connectivity already exists between a BDC List WP and the BDC Data Item and BDC Related List web parts, so I was thinking that it might already possible somehow by properly configuring the out-of-the-box web parts. Any thoughts you might have on this would be greatly appreciated. Thanks in advance.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Nigel
    Posted @ 1/22/2007 10:53 AM
    Hi Heather.

    I am new to sharepoint. Is CQWP really available in WSS 3.0? I can't find it anywhere... The closest thing I can find is the Content Editor Webpart.

    Thanks in advance.
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Heather
    Posted @ 1/22/2007 2:27 PM
    Nigel- Yes the CQWP is available in WSS 3.0. You will have to add it to your page through the Add a Web Part options.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Steve Stratoti
    Posted @ 3/1/2007 1:11 PM
    You have to check this out. It's a utility that will display all of the lists on your server, as well as their internal names and properties.

    It took a bit of digging. The search on wssdemo kept asking for a user/pass but I finally found the tech article and download link.

    http://www.wssdemo.com/blog/Lists/Posts/Post.aspx?List=d5813c18%2D934f%2D4fd6%2D9068%2D5cdd59ce56ba&ID=116

    I can't wait to install it!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Mindy Kelly
    Posted @ 3/6/2007 2:49 PM
    You are my hero! Thank you!

    Have you figured out how to get the "Name (linked to document with edit menu)" field into a CQWP?

    Thanks,
    Mindy
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Nick
    Posted @ 3/14/2007 8:29 AM
    Heather - Are you sure the CQWP is available is WSS 3.0?

    I don't see it in my installation and it isn't mentioned in the WSS SDK (although it is in the MOSS SDK).
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Jeremy W
    Posted @ 3/15/2007 9:14 PM
    I am trying to roll-up announcements from all sites in the collection. I am filtering only content type of "Public Announcement" and I can get it to work, but I am trying to get the announcements to start and stop at specific times and dates. I am trying to use the QueryOverride with CAML. I have the fields set to date and time and I am using this CAML:

    <Where>
    <And>
    <Leq>
    <FieldRef Name="PublishingStartDate"/>
    <Value Type="DateTime"><Now/></Value>
    </Leq>
    <Geq>
    <FieldRed Name="Expires"/>
    <Value Type="DateType"><Now/></Value>
    </Geq>
    </And>
    </Where>

    I just can't get this to work. I have tried using the <Today/> value, but it seems to ignore the time. Like I said, I want to schedule items to appear on the front page at specific times and dates.

    Any help would be appreciated!

    ~Jeremy
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Edward Lee
    Posted @ 3/18/2007 7:42 PM
    After step 9, I get this error in all the webparts on the page:

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

    Any thoughts what I might be doing wrong?

    Thanks.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Nick
    Posted @ 3/22/2007 5:22 AM
    Hi Heather,

    Are you sure the CQWP is available in WSS 3.0? I can't seem to find it in my installation and it isn't mentioned anywhere in the SDK (although it is in the MOSS SDK).

    Thanks,
    Nick

  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Steve Stratoti
    Posted @ 3/30/2007 12:55 AM
    As a tip, if you're going to use multiple properties in CommonViewFields - make sure there aren't any spaces, and that there is no ; at the end.

    example :

    Body,Note;ArticleStartDate,DateTime

    I couldn't get it to work otherwise. Happy coding!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Steve Stratoti
    Posted @ 3/30/2007 1:32 AM
    I am encountering a problem with the ArticleStartDate property, and was wondering if you had any ideas.

    I've migrated all of the news postings of the past year from our previous CMS. I added in the Article Date field, and then populated it with the article release date (the date the news is to be made public).

    It works fine in the list, and I'm able to filter by it in the view. But when I pull this property out via the Content Query WP, the ArticleStartDate property seems to contain the date I posted the article itself?

    If I sort by it in the CQWP, they all contain the date I imported the item. This date appears when I print it to the page via the itemstyle.XSL

    Any thoughts? Maybe it's pulling the XML property from the Publishing schema instead - which would give the item creation date? I'm stumped.

    Should I just recreate the list as a non announcements content type - and add in the columns manually?

    Thanks!
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Steve Stratoti
    Posted @ 3/31/2007 2:09 PM
    Forget my earlier link. It's to a sharepoint 2003 utility Wont import to 2007.

    Check this out though. Excellent!

    http://www.theegroup.net/Document%20Library/Forms/AllItems.aspx

    Its a sharepoint 2007 XML viewer! One of the menus isn't really obvious - so be sure to right click on the XML itself and you can save it to your computer - easier to search through it that way.

    I also figure out my problem I posted about earlier - someone else had posted to the list so I was mistaken. Everything works beautifully!

    I was wondering if there was any way to add in the "Add new announcement" link at the bottom of the CQWP? I'm trying to edit the exported WP itself - but I'm just coming up errors.
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    dan @ hba
    Posted @ 4/10/2007 10:43 PM
    I am attempting to use the CQWP to display documents with an Approval Status of In Progress for the Approval Workflow. Any suggestions on how to do this?
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    nxliu
    Posted @ 4/16/2007 6:50 AM
    I am using simplified chinese version of MOSS2007, when i create a custom column by simplified chinese character, the url link shows like following:

    Field=%E6%88%98%E5%BD%B9%E5%90%8D

    which i think is escapted, if there is way other than column property that i can get the true internal column name? i looked into sql server database but found no table related to column definition

    thanks for any suggestion!

    nxliu
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Advanced Customization
    Posted @ 4/16/2007 12:01 PM
    I have been trying and trying to get the CQWP to fit my various needs and have never been able to get it to do so. I have gotten the non recursive part to work. But I want to limit the scope query to just 10 specific libraries, and not the whole site with lists and all. Is there a way to say I only want these 10 lists? I have tried to do just doc libraries but that is incomplete.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Advanced Customization
    Posted @ 4/16/2007 8:07 PM
    OK I got the query to work right by adding in the list filter. Now it displays right but, when I RSS enable it. The feed does not work. I dont get an error or anything
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    nxliu
    Posted @ 4/19/2007 9:34 PM
    My current workaround: create the column by english name, then the internal column name is same with the name created, then change the display name to chinese name

    nxliu
  • # Content Query Web Part in WSS 3.0
    Mohammad Abdulfatah
    Posted @ 5/6/2007 4:24 PM
    @Heather:

    Thank you for the detailed information, especially the list of field types.

    @Nick:
    This is probably too late, and not very useful, but if I rememer correctly, the Content Query Web Part _was_ a part of WSS 3.0 Beta, and it's no longer in the RTM. Such a pity really, because it would have been extrememly useful.

    Of course, I would love for someone to tell me that I'm wrong, and that the CQWP is still in WSS 3.0.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Matthew
    Posted @ 5/17/2007 6:13 AM
    The XSL snip is missing the closing </template> tag.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Jessie
    Posted @ 5/17/2007 4:34 PM
    Hi Heather,

    I read your article on customizing the custom query web part. I have a unique question that I have spent time googling for quite some time now but haven't found any thing discussing this.

    My question is when you set the height and width to pixels, this displays the horizontal and vertical scrollbars. The request I am trying to satisfy is getting the right vertical scrollbar to display by setting respective height property, however, regardless of what pixels you use to set the width, I cannot seem to hide the horizontal scrollbar. Basically, I am trying to create a scrollable article list with only the right scrollbar and not the horizontal scrollbar at bottom and haven't been able to find a solution to resolve this. Any insight you can provide would be appreciated.

    Jessie
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Michael Herman (Parallelspace)
    Posted @ 5/20/2007 6:37 PM
    Heather, the Content Query web part is definitely not part of my default WSS 3.0 installation.

    Michael.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    saritha
    Posted @ 5/29/2007 2:06 AM
    hi can u tell me how to apply content search for audience based when particular user loggs in and he is targeted by audience he shuld be seeing documents related to that audience not othere than that how to do that
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    James
    Posted @ 5/29/2007 5:04 PM
    Hi Heather,

    Just thought I'd throw this out there to see if you or anyone else has encountered this. I am able to following your instructions and get results pretty much as expected. The only problem I've had is when trying to filter by a custom field. I can get the field and its data to show up in the web part with no filters, but if I use the AdditionalFilterFields property to add the custom field to the drop-down, the results to do not return if I enter a value I know is there.

    Have you or anyone else experienced this? I've put this on the MS Sharepoint Forum, but to no avail yet.

    TIA
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    NathanO
    Posted @ 5/30/2007 12:05 PM
    The Content Query web part is part of MOSS 2007, not part of WSS 3.0.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Caroline
    Posted @ 5/31/2007 9:14 AM
    This article was very helpfull! Thank you!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Su
    Posted @ 6/2/2007 2:23 AM
    I have always gotton the error messages for anonymous access for content query web part and summary link web part.

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

    What could be wrong? Appreciate your help urgently!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Jim
    Posted @ 6/4/2007 3:53 AM
    Hello Heather,

    I am using WSS 3.0 and have the same problem as Nick

    >Nick
    >Posted @ 3/14/2007 8:29 AM
    and
    >Posted @ 3/22/2007 5:22 AM
    >Heather - Are you sure the CQWP is available is WSS 3.0?

    When I try to add a web part and look in my list of web parts available, there is no Content Query Web Part there.

    Do I need to import it from somewhere first?

    Thanks,

    Jim
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Shimon
    Posted @ 6/4/2007 4:17 AM
    Hi,

    I'm trying to use CQWP to present announcements on the page.
    Do anybody know howcome i can render the Body content of this list as it is (in my case HTML data) and to display it used predefined formatting.

    Appreciate any response.
    Shimon
  •  How to print just the web part content (any web part)
    CNB
    Posted @ 6/7/2007 3:51 PM
    Hello Heather,

    I am new to Sharepoint and I was wondering if there was a way to print the content of a web part.

    For instance, let' s assume that i am adding a rich text content web part to my page. Can I print just the content of my web part using a sharepoint out of the box tool?

    I tried javascript in the web part but this still prints the whole page with the navigation and all....
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Michael Hofer
    Posted @ 6/12/2007 7:13 AM
    Hi Heather, thank you very much for your great arcticles, they really save a lot of time!

    One thing that I've found out and think it is very important (just copy my own blog post with reference to your post):

    !!! Never use any spaces or even special characters when creating any fields in SharePoint !!!

    Maybe I’m not that good in it, but I haven’t found how to specify these field names as attribute names later in the XSLT transformations and wasted a lot of time. But then I checked how Microsoft handles fields like “Created by” and the like and – oh wonder – they named their fields “CreatedBy” and later changed the name to “Created By”.
    So the trick is to do the following:
    - Start to create new field (custom field in a list, site column etc.)
    - Choose a one-word name such as “PONumber” and save the new field
    - Open the field in edit mode again, change the name from “PONumber” to “Purchase Order Number” and save it again.

    The internal name used in the webpart definition file as well as in the ItemStyle.xsl is no “PONumber” and you don’t have to deal with complicated esacpings.

    Bye, Michael
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    AC [MVP MOSS]
    Posted @ 6/12/2007 2:39 PM
    The CQWP is only available in MOSS when you have the Publishing features activated. It's one of three WP's that are specific to Publishing/WCM sites... the others being Summary Links & Table of Contents.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Rob
    Posted @ 6/14/2007 11:32 PM
    To remove the markup tags from being displayed there is no need to call the function as per the link you provide, just change your xsl:value tag from:

    <xsl:value-of select="@InternalColumnNameGoesHere" />

    to

    <xsl:value-of select="@InternalColumnNameGoesHere" disable-output-escaping="yes"/>

  • # re: Customizing the Content Query Web Part and Custom Item Styles
    nxliu
    Posted @ 6/15/2007 2:50 AM
    i have successfully created my custom itemsytle template to show additional fields, but after configure my site to anonymous access, only title field is displayed when access in anonymous user, access with system user is OK, am i missed anything?

    the CQWP is configured to query only one content type, this content type is defined in site definition and created at root web(or site collection), the CQWP is placed in a layout page and used in subsite(web)
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Tim
    Posted @ 6/15/2007 6:25 AM
    Hi there,

    first of all thanks for the great post above - helped me a lot. I'm still a beginner when it comes to sharepoint customizing so I hope you can help me with these bunch of questions :)

    i created a template in the itemstyle.xsl to display the latest announcements. I added the title, the date and the author to the output.

    So, my first question is (maybe the easier one): what has to be changed within the attached lines of code(or elsewhere) to display a 24h-format of the time ?

    <xsl:variable name="Created">
    <xsl:value-of select="ddwrt:FormatDateTime(string(@Created) ,1033 ,'dd-MM-yyyy hh:mm')" />
    </xsl:variable>

    ...

    My second question is probably tougher: i wanted to display with the CQWP the latest documents of a scope. no problem bout that.
    The Problem comes up when I wanted to display the name! of the document in the webpart - not the title. All i could find was the "FileRef"-Field, which displays the whole path of the document.
    I also discovered "FileleafRef" for the name of the document but couldn't make it to display it in the webpart.
    Is there maybe a possibility with substring in combination of FileRef ? or how else can i display the name of the document ?

    ...

    Finally, my last questions is what did i wrong in the following code? why does my CQWP do not show the first 200 chars of the content of my announcements and just the "..." ? must be a stupid mistakes by myself but couldn't find it!

    <div class="description">
    <span style="padding-left: 0px; font-size: smaller; text-decoration: none;">
    Modified by <xsl:value-of select="$Author" /> at <xsl:value-of select="$Created"/> O'Clock
    </span>
    <div>

    <xsl:value-of select="substring(@PublishingPageContent, 0, 200)" disable-output-escaping="yes"/>
    ...(more)
    </div>
    </div>

    i also add the following lines in the .webpart-file:

    <property name="CommonViewFields" type="string">ExternalUrl,URL;PublishingPageImage,Image;PublishingPageContent,Note;</property>

    I am appreciate for any hints.

    Thanks,
    Tim
    (Hope i english isn't too bad)
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Chris Whitaker
    Posted @ 6/20/2007 5:42 PM
    Michael,

    I would say there is a problem with your installation. The content query web part is definitely part of the software and it would be listed with all of the other web parts.

  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Ishai Sagi [MVP]
    Posted @ 6/20/2007 11:20 PM
    Heather - please tell the world about my enhanced content query webpart, which now has properties that expose the Common View Fields to the user in the web interface, so there is no longer need to export-import.
    See:
    Adding custom fields to the Enhanced Content Quey Web Part (Beta 1.2)
    http://www.sharepoint-tips.com/2007/06/adding-custom-fields-to-enhanced.html
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Shridhaar
    Posted @ 6/27/2007 6:37 AM
    Nice article, thanks.
    How do we query image fields from publishing content ? Any sample would help.
    Thanks,
    Sridhar
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Rob
    Posted @ 7/2/2007 9:52 AM
    NXLIU - Perhaps you didn't publish itemstyle.xsl after you were done modifying it?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Daniel
    Posted @ 7/4/2007 2:15 AM
    Hi Heather,
    Am I able to fix the css to the article page and not allow the content styles to overwrite it?

    For example, you write an article page, and everything you write in the text box has been fixed with your css and any changes to your text will not affect the css.

    Regards
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    J Siegmund
    Posted @ 7/12/2007 9:22 AM
    Hi,

    I'm trying to use the Content Query Web Part to display the messages from several discussion bords. All works well, but in the XSL I would like to be able to display the discussion in case of a reaction. It seems the returned data isn't carrying that information and I have no idea how to add it. Is there a way to get both discussion and listname to display in the query results somehow?

    Thanks,

    Jasper
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Sahal
    Posted @ 7/14/2007 11:49 PM
    Hello Heather,

    Special thanks to you and to everyone to share this valuable information...

    I have a case and I do not know if it face any of you.

    When I use the CQWP to query\list all documents inside specific folder in specific Document Library, It does not work.

    The error is: "Cannot save the property settings for this Web Part. The list name is not valid. The list name should refer to a list within the specified site: /listname/"

    Any idea how I can modify the CQWP to list the content of a folder inside Document Library ?

    Any help would be greatly appreciated...
  •  re:James Posted @ 5/29/2007 5:04 PM
    MyrO
    Posted @ 7/17/2007 6:57 AM
    @James
    Posted @ 5/29/2007 5:04 PM
    Hi Heather,

    Just thought I'd throw this out there to see if you or anyone else has encountered this. I am able to following your instructions and get results pretty much as expected. The only problem I've had is when trying to filter by a custom field. I can get the field and its data to show up in the web part with no filters, but if I use the AdditionalFilterFields property to add the custom field to the drop-down, the results to do not return if I enter a value I know is there.

    Have you or anyone else experienced this? I've put this on the MS Sharepoint Forum, but to no avail yet.
    --------------------------------------------------------------------------

    i had the same problem:
    i tried to filter a custom field, using this content query web part..

    i solved this problem creating a web part that gets my items using SPQuery and building a caml query. overriding Render method i can display all my items, including those that comes from the custom field.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Tim
    Posted @ 7/17/2007 2:27 PM
    It seems that everytime I make a change to the XSL (e.g. ItemStyle.xsl) to experiment with formatting, I have to do an IISRESET.

    That is crazy. It adds about a 1min delay everytime I make a change.

    So adding anything more than a simple field replacement is pointless in SharePoint then.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    JWM
    Posted @ 7/19/2007 1:56 PM
    I know that the Content Query Web Part comes with out of the box MOSS, but we have WSS 3.0 and need something that will do the same things that the CQWP will do. Is there any way to install this web part on WSS 3.0? Alternately, do you know of any WSS 3.0 compatible web part that is able to do the same things as the CQWP. Specifically, we need to be able to merge 2 lists into one based on matching one column in one list with the same column in another (one list has employee paired with supervisor, the other employee with jobs, and we need a quick way to compile and keep updated supervisor with jobs with employee for email reminder purposes). Thanks!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    kayloe
    Posted @ 7/19/2007 10:10 PM
    I'm having an issue with displaying the PublishingPageContent column in the CQWP after I have set up a custom publishing page layout. There is nothing to suggest that the publishing pages have been set up incorrectly, but I suspect the issue arises with the column type. I have tried RichHTML, FullHTML and HTML as an attribute but with no success - can anyone suggest another solution?

    BTW: great article. Very useful information.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Dragan Radovic
    Posted @ 7/26/2007 3:49 PM
    nxliu & all:

    The Tutorial is missing the step to Publish the ItemStyles.xsl file once checked in to make it available to other users (including anonymous users).

    Although this may be an obvious step to you experienced developers, it took a few hours off the life of one develeper.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Pham Tuan Anh (VietNam)
    Posted @ 8/5/2007 3:22 PM
    I used Publishing feature on MOSS and i want to get Publishing page from Pages Doc Where PubDate (or Check out date) less than current page. I used a ContentByQueryWebpart to get it. I tried

    protected DataTable Process(DataTable data)
    {

    DateTime PubDate = DateTime.Now;
    string strPubDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(PubDate);

    CrossListQueryInfo crossListInfo = new CrossListQueryInfo();
    crossListInfo.ViewFields = "<FieldRef Name=\"Title\" Nullable=\"True\" Type=\"Text\"/><FieldRef Name=\"FileRef\"/>";
    //"<FieldRef Name=\"PubDate\" Nullable=\"True\"/>";
    crossListInfo.Query = "<Where>" +
    "<And>" +
    "<And>" +
    "<Eq><FieldRef Name=\"File_x0020_Type\" Nullable=\"True\" /><Value Type=\"Text\">aspx</Value></Eq>" +
    "<Lt><FieldRef Name=\"PubDate\" /><Value Type=\"DateTime\">" + strPubDate+ "</Value></Lt>" +
    "</And>" +
    "<Eq><FieldRef Name=\"ContentType\" Nullable=\"True\"/><Value Type=\"String\">Article Page</Value></Eq>" +
    "</And>" +
    "</Where>";
    //"<OrderBy><FieldRef Name=\"Created\" Type=\"DateTime\" Ascending=\"False\"/></OrderBy>";
    crossListInfo.RowLimit = 15;
    crossListInfo.Webs = "<Webs Scope=\"Recursive\" />";
    crossListInfo.Lists = "<Lists ServerTemplate=\"850\" >";
    crossListInfo.WebUrl = "/";

    CrossListQueryCache xlqCache = new CrossListQueryCache(crossListInfo);
    data = xlqCache.GetSiteData(SPContext.Current.Site);

    return data;
    }

    It didn't work, no data return

    Please help me
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Rich Rockwell
    Posted @ 8/8/2007 4:46 PM
    There was a post on 3/6/2007 asking if you have figured out how to get the "Name (linked to document with edit menu)" field into a CQWP.

    I am also looking for a way to do that. Does anyone know how to do that?

    Thanks
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Grant Swan
    Posted @ 8/10/2007 3:45 AM
    Nice article; one of the few articles i've managed to find on this subject.

    I'm new to Sharepoint and the whole customizing of web parts but have a question on this.

    I'd like to use the content query web part on my home site to display the latest news articles. I have managed to do this using the out of the box templates but want something a little smarter. I'd really like to display the articles in a table structure so that i can have articles in two columns i.e.

    <article 1> <article 2>
    <article 3> etc.......

    I have to admit i'm struggling with how to go about achieving this; i'd appreciate any advice or help you could provide.

    Many thanks in advance,

    Grant
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Joker
    Posted @ 8/15/2007 1:20 AM
    Hi Heather,
    how can I create a content query web part that queries multiple types of lists? For example, I want to create a "News and Information" CQWP where items from both a Pages Library and a Document Library are returned. But when I start defining a CQWP, I am only presented with one choice for a list type.
    Is something like this possible in CQWP?
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Tom Parker
    Posted @ 8/17/2007 1:30 PM
    This has been a great addition to the original article you link to. Excellent job! Made things much clearer to me.

    Some weirdness, though... made all my mods and everything is checked in and approved, yada, yada, yada... but, the mod only works when I'm logged out or editing the page. When I'm logged in and of edit mode, it doesn't display the picture or the body text with "...(more)". Doing the same thing for anyone who is logged in whether they have editing rights or not. Any tips would be appreciated.

    Also, I tried to do something similar to link to an existing list of external URLs... but, can't find the field that makes up the title of the URL field. It simply displays the word "Blank". And, it links to the list item instead of the URL. Any thoughts?

    Many, many thanks!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Paul Matthews
    Posted @ 8/28/2007 11:19 AM
    First of all, thank you for your article, it helped me understand ECM blog better.

    My question is I can find most of the columns I require to create my CQWP, but if I was creating a CQWP that mimicked the Document Library columns, I'm unable to find the Type (icon linked to document) column. This would just be perfect item to show in my CQWP but I have no idea how to find the column name.

    Also in my document library (which contains podcasts), I've created a column called Content Description. I've used your "...(more)" example to cut down the Content Description inside the CQWP, but (and I understand how) when you click on more it loads up the MP3. What would you recommend I do, so that when I click on the more link, it displays the extra information that's been trimmed? Surely I won't hard code the URL in the XSLT?

    Many Thanks
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Lesley Campbell
    Posted @ 9/10/2007 7:45 AM
    I have the same problem as JWM. I need this functionality but don't have MOSS. Any ideas if you can help?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Steve Walsh
    Posted @ 9/13/2007 5:19 PM
    Excellent article! Was looking for this... I was able to do just about everything I wanted with this.. Except for one thing... I cannot change the style of the link... I opened CONTROLS.CSS and fro mtheir found the item, link-item, etc css styles... I can change the size of the text... I can change the padding... But when I try to change the link color, I cannot. It defaults to the blue color... There has got to be another css style I am missing, but unsure which.. .Anyone know what I am missing? I am using these:

    .item {
    margin-bottom:6px;
    margin-top:6px;
    margin-left:4px;
    margin-right:0px;
    clear:both;
    }
    .centered {
    text-align:center;
    }
    .link-item, .link-item a, .link-item a:link{
    font-family:tahoma;
    font-size:8pt;
    color: #003399;
    text-decoration:none;
    }
    .link-item a:visited, .link-item a:active{
    color: #4167AF;
    text-decoration:none;
    }
    .link-item a:hover{
    color: #000000;
    text-decoration:underline;
    }
    .bullet{
    border-style: none;
    border-color: inherit;
    border-width: 0;
    vertical-align:top;
    background-image:url("/_layouts/images/lstbulet.gif");
    background-repeat:no-repeat;
    background-position:left;
    padding-left:10px;
    padding-right: 0px;
    }
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Iker
    Posted @ 9/17/2007 1:23 AM
    Im looking for any way of displaying Name (linked to document with edit menu) in the CQWP. but I did not found any way...

    Can any bosy help us?

    many thanks,
    Iker
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Lucas Persona
    Posted @ 9/18/2007 4:19 PM
    After reading this and a couple of other posts, my main objective was to 'wrap' all items from a list in a DIV tag, with minimal impact to ContentQueryMain.xml

    I've found something not posted in any of these blogs/posts/comments that may well indicate further developments on this area.

    Both Header and ItemStyle have a 'mode' attribute.

    ContentQueryMain call three templates types: CallHeaderTemplate, CallItemTemplate and CallFooterTemplate.
    The problem is that only the first too actually call something else, while the last one, just add a DIV tag for the footer.
    My change, that I believe will be implemented in next MOSS release, was to add to ContentQueryMain 'CallFooterTemplate' template:

    <xsl:apply-templates select="." mode="footer">
    </xsl:apply-templates>

    Then inside Header.xsl, you can create two GroupStyle templates using both modes 'header' and 'footer', where the tags for open/close tables, divs, and everything else can be placed.

    Works very good, with minimal changes to ContentQueryMain.xml, and using the same architecture that MS is using for Header and Item.

    Regards,
    Lucas Persona
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Marina Renee
    Posted @ 10/5/2007 2:36 PM
    I have "Summary Link Web Part" issues:

    On fairly frequent occaisions my users are greeted to the

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

    While other times everythingt works properly. Any ideas what is going on?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Jiangbo
    Posted @ 10/10/2007 3:37 PM
    I am trying to create a publishing site, which should be an aggregation page and a library of article pages. My problem is I could not locate my pages through CQWP. When I create a new article page, it was saved in the page libray by default. But after I set the query source as the list (page library), I could not find "page library" from the List Type drop-down menu. Therefore, the CQWP showed no item event I chose "all content types" for the content type. I had to move all pages to the document library and then CQWP worked well. How to solve the problem? Thanks!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Nancy
    Posted @ 10/10/2007 5:19 PM
    To Marina Renee and Su:

    RE: "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 had the same problem and it turned out to be a stylesheet I'd edited that was not checked in, so the admin login could see it, but no one else. Once I checked it in, all was well. Try that.

  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Chris van Hasselt
    Posted @ 10/13/2007 3:16 PM
    I was following your article on styles for Content Query
    The following raised a nit-picky question:
    ---------------------------------------
    Change the name and match properties in the Template tag to a unique name of your choice:

    <xsl:template name="MyCustomStyle" match="Row[@Style='MyCustomStyle']" mode="itemstyle">

    ------------------------------------
    What if you want your style name to have spaces, like "My Custom Style"? The default styles have names like "SmallText" or "LargeText" but you can select these from the UI dropdown as "Small Text" or "Large Text". How is that done?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Dave
    Posted @ 10/31/2007 1:44 PM
    I was struggling with figuring out how to filter a CQWP for a while and found a solution that's a little easier than the one below.

    Rather than creating your custom fields in the settings of the List you are querying, create a content type and create the fields in the content type. Then when creating your list, select existing fields rather than creating new ones. This way, they appear in the UI of the CQWP Filter. They are also available to any other list.

    D.

    -------------------------------------------------------
    Just thought I'd throw this out there to see if you or anyone else has encountered this. I am able to following your instructions and get results pretty much as expected. The only problem I've had is when trying to filter by a custom field. I can get the field and its data to show up in the web part with no filters, but if I use the AdditionalFilterFields property to add the custom field to the drop-down, the results to do not return if I enter a value I know is there.

    Have you or anyone else experienced this? I've put this on the MS Sharepoint Forum, but to no avail yet.
    --------------------------------------------------------------------------

    i had the same problem:
    i tried to filter a custom field, using this content query web part..

    i solved this problem creating a web part that gets my items using SPQuery and building a caml query. overriding Render method i can display all my items, including those that comes from the custom field.

    ----------------------------------------------------------------------------
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Remandlo
    Posted @ 11/1/2007 7:39 AM
    Thanx for this article. I have a Table Of Contents web part i my SharePoint site. I want to change the font color of the items listed in this web part. Can someone help?

    Remandlo
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Gil
    Posted @ 11/1/2007 3:32 PM
    Not sure if this is the rigt place to post it but I have a ui problem
    that might be related.

    I wish the standard list in wss would have been like in hotmail
    with checkboxes multiple selection that i could do simple stuff like delete/copy/move etc.

    Would that be a customization of cqw or I need to write my own webpart? I see though in ECM that Site Content and Structure has this functionality. I wish to use it in any simple wss list.

    What is your suggestion?

    Thanks.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    LPM
    Posted @ 11/2/2007 2:58 PM
    I have set up a page that contains two web parts - one is a product list, the other is a grouped view (default collapsed) of a library that also includes a product column. I have established a web connection between the two web parts, so that when a user selects one of the values in the product list, the library is filtered to display only items with product = that value. All appears functional at first glance - selecting a product decreases the number of items in each grouping (shown in parentheses). However, when the user expands the grouping to display the documents, all documents appear - even though the number in parentheses remains the same (the lower, filtered number). Furthermore, if I edit the view so that the groups default to expanded, the filter works perfectly. It seems to break only when the view is collapsed and the user clicks to expand it. Ideas?
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Chris Hart
    Posted @ 11/5/2007 11:00 AM
    Hi Heather,

    I need to display items from a picture gallery using a content query part, but I'm having trouble accessing the right data. Essentially, I would like to display the pictures in a library with as much functionality as possible from a web part page on a subsite of the main site that hosts the picture library.

    Firstly, I would like to get the thumbnail url for each item, as well as a link to the detail view for the item - unfortunately, the only useful information I seem to be able to get from the CQWP out of the box is the Title, FileRef and LinkUrl. I've looked through the schema for the picture library and found a bunch of "computed" columns for thumbnail and nothing obvious for getting the link to the item's detail view. I tried adding one of the computed columns to the webpart file but that didn't work for me. Is this at all possible in a CQWP, or am I going to have to do this in a custom webpart? Many thanks in advance :)
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Yannis
    Posted @ 11/7/2007 7:33 AM
    To Nancy:
    Many thanks for your solution to the 'Unable to display this Web Part' problem.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    james
    Posted @ 11/7/2007 11:22 AM
    I am not able to get the file size innername for the documnet library. I can see the x0020_ows_File_x005f_x0020_Size. But it doesn't return any value.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Allan
    Posted @ 11/8/2007 1:24 PM
    Hello

    I'm working on this site, and this things has been bugging me for days now.

    Its all working just fine and i'm getting data from 3 col. from my custom list. A singel line text "title" multiline "body" and a image "publishing...image something ;)

    My problem is (and ill try my best to explain)

    When the page is rendered, stuff like <br> is not making a break, but its visable so people can see it between the words. I know there are 3 options for me to choose in col. settings "simpel" RFT" and one more. If i choose simpel it looks good, but I can only write a boring text with a few spaces. If I try to chance to RFT its still simpel text, but it shows the <br> and "&bsp" or something like that, can't remeber the exact chars.

    Anyone got any idea how to make the CQWB show the text as html when i choose RTF(RFT) ;)

    is there some kinda template i can add to my code in itemstyles.xml, or code maybe?
  •  Alternating white and gray rows like ListViewWebPart
    Eric Hsieh
    Posted @ 11/8/2007 3:26 PM
    The ListViewWebPart has alternating white and gray rows. Anyone have code to make the CQWP do the same?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Allan
    Posted @ 11/9/2007 1:26 AM
    anyone knows how to change the output from a body col.

    This is how it should be
    --------------------
    tekst til nyhed 2


    HEJ
    ---------------------

    This is how it looks like
    ---------------------
    <div>tekst til nyhed 2&nbsp;<br>&nbsp; <br><br>HEJ <br></div>
    ---------------------

    I know i can choose normal text over RTF, but i want to be able to see it in html.

    Anyone got a solution to this?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Bonnie
    Posted @ 11/28/2007 10:10 PM
    Awesome, Dave - thanks for the info.

    I tried your suggestion and it fixed my filter problem without code!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Matthew.Vore
    Posted @ 12/3/2007 10:33 AM
    We are working on a news/press releases section of our website and I am using the Content Query Webpart quite heavily for pulling information. For instance I have created a page called Archive 2006 that has a CQWP that pulls all news releases from jan 01 - dec 31 2006. I told the web part to group them by category and it is working fine and dandy. The problem is the header for the groupings does not match our style. I know that the style it is using is groupheader item medium which is located in header.xsl(Where i may make a custom header style that does it by month rather than category). The problem i'm trying to address here is I want to change the "groupheader item small" style to something of my liking. I have tried replacing it wtih my own custom style located in my stylesheet for my masterpage/page layout, but its not reading the information for some reason. Any help would be greatly apprecaited






    This is located in header.xsl, I want my own custom div here!
    <xsl:template name="DefaultHeader" match="*" mode="header">
    <div class="wc_groupheader_item_ medium">
    <xsl:call-template name="OuterTemplate.GetGroupName">
    <xsl:with-param name="GroupName" select="@*[name()=$Group]"/>
    <xsl:with-param name="GroupType" select="$GroupType"/>
    </xsl:call-template>
    </div>




  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Ray
    Posted @ 12/8/2007 4:56 AM
    Hi,

    I need to populate the filter value of the CQWP automatically, that is when a page, created depending on a specific page template containing the CQWP, the CQWP filter value gets populated with the page name or title automatically, is this feasible?
  • # re: Customizing the Content Query Web Part and Custom Item Styles
    Paul Galvin
    Posted @ 12/9/2007 7:48 PM
    I've written a blog article that describes how to generate the result in a <table> / grid format here: http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!491.entry
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Cecilia
    Posted @ 1/8/2008 4:33 AM
    Advanced Customization

    "OK I got the query to work right by adding in the list filter. Now it displays right but, when I RSS enable it. The feed does not work. I dont get an error or anything"

    I have the same problem, did you ever figure it out? I can't find an answer on your problem among the posts.
    If you know, please post it! Thanks!
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Mike
    Posted @ 1/8/2008 2:18 PM
    Hi,
    I was able to follow Heather's CQWP customization and further enhancing it using Paul's grid table format, but was having issues displaying image field type. It only shows the URL of the image with a (,) at the end. e.g. (https://myweb.com/Marketing/images/icn-order.gif, )

    <property name="CommonViewFields" type="string" >Title, Text;IcnOrder, Image</property>

    Any help will be much appreciated.

    Mike
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    MikeD
    Posted @ 1/8/2008 2:50 PM
    Great articles.
    I have followed Heather's customization of CQWP and enhancing it further with Paul's table grid format.

    I'm having issues displaying image field type. It only appears as the link with a (,) comma at the end. e.g. http://web/marketing/images/icn-order,

    Any help will be appreciated.
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Mike
    Posted @ 1/8/2008 3:29 PM
    Great articles.

    I have followed Heather's customization of CQWP and enhancing it further with Paul's table grid format.
    I'm having issues displaying image field type. The image appears as url with a comma at the end instead of the image itself.
    e.g. http://web/marketing/images/icn-order,
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    dick penny
    Posted @ 1/8/2008 6:45 PM
    I've carefully tried to customize the CQWP using the 3 steps here and in many blogs. Step 1, where you modify the itemstyle to display available columns, fails. On the site, the CQWP just display a message, "unable to display this web part...."

    What to do? How to even begin?
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    MikeD
    Posted @ 1/14/2008 8:23 AM
    I just resolved my issue earlier on how to display a custom image fields from a content viewer webpart using table/grid style.

    Regarding the issue I was having last time where it doesn't display the images from the grid view but instead displays the text (https://myweb.com/Marketing/images/icn-order.gif,). I manage to resolve it with the help of SharePoint Designer by creating a custom view and selecting the custom columns that I want to display. I found out that the images column type are shown as URL(comma) (e.g. https://myweb.com/Marketing/images/icn-order.gif,). The current format is Text, so I have to change it to Picture from the Common xsl:value-of Tasks -> Format as PICTURE. This change the display to the custom images that I wanted to show. I copied the code to show the image ( <img border="0" src="{substring-before(@IcnOrder, ', ')}" /> ) And in the ItemStyle.xsl file I have to change the @PICTURECOLUMNNAME to the code <img border="0" src="{substring-before(@IcnOrder, ', ')}" /> . Then save it. Now my table grid results to show the text as well as the custom image type columns.
  • # Content Query Web Part (CQWP) with Anonymous Access
    Mike Geyer
    Posted @ 1/20/2008 1:56 PM
    Heather, thanks for your very helpful blog.

    I was also running into the problems the CQWP (with CopyUtil.aspx) and anonymous users. I created a quick blog entry that describes how to create your own Item Style for linking to blog entries (notice, the example is 'hard coded' for links to blog posts):

    Content Query Web Part (CQWP) with Anonymous Access
    http://blogs.edork.com/MikeGeyer/Lists/Posts/Post.aspx?ID=20

    I hope this helps and thanks again for your blog.

    - Mike
  •  re: Customizing the Content Query Web Part and Custom Item Styles
    Alan Wooley
    Posted @ 1/23/2008 12:39 AM
    Heather,
    Great POST!!! I am doing a rollup based on the Posts list of a Blog site in the same collection, but I can't seem to get the body to display. Following all the steps that you mentioned here along with the steps from the URL that you reference, I am able to get a nice rollout t