Home » Sharepoint

Filter Content Query Web Part by a custom column

I am new to Sharepoint.  Here is the problem I am having.  I have added a custom column to Announcements called Availability (Drop Down; values are Public and Private).  On the landing page for sharepoint, I want the Content Query Web Part to filter announcements by Public.  Only public should display on the home page where as, on the sub sub site level, it will display both.  On the CQWP, on the home page, the Availbility column does not display.  I have tried exporting the web part and adding it as a filter, etc., but this does not seem to work.  Can someone give me some direction?  Thanks.

4 Answers Found


Answer 1


If I were you I'd follow this tutorial:
Paying close attention to step 9.  What this will do is show you all the fields that are coming from the CQWP.  When you get down to step 17 you can add your custom field.  Just make sure that you call the field by the correct name (I get caught out by this a lot!)


Answer 2

Hi code_guy,

Before you add a custom column to Announcements list, you need to add the custom column “Availability” to site column. Please delete the custom column in your announcement list and follow the steps below:

1.Click “Site Actions” à “Site settings” à “Modify all the site settings”à “Site columns”

2.Click “Create” and create a choice column called “Availability”

3.Go to Announcements list and click “List settings” à “Add from existing columns” to add this custom column

4.Add the Content Query Web Part on the landing page and click “Modify shared web part”

5.Under “Query”, click “Show items from the following list” and choose “Announcements”

6.Under “list type”, choose “Announcements” and “All content types” under “Content Type”

7.Under “Additional Filters”, Now you can choose “Availability” “is equal to” “public” and click “OK”

Let me know the result, thanks.

Lu Zou


Answer 3

Hi Luzou - Actually am facing same problem ,but here i need to show announcements for a week compared to today,I can get calculated field which gets week days data but i can filter it with today the webpart is not taking any date functions for today ,please help me.


Answer 4

Hi Sartha,


Steps to add the custom choice column as filter in custom query webpart:

1. export the webpart after selecting library on which you want to apply the filter.

2. open exported webpart with SPD.

3. search for< CommonViewFields> property in it and add the column name there on which you want to filter.  ******

4. now search for <property name="AdditionalFilterFields" type="string" /> and edit it as <property name="AdditionalFilterFields" type="string" >Your Column name here </property>

5. save the webpart and import it in the page and apply, the column will now available in the filter.


******Steps to find the column name

1. site action > view all site content > select your library

2. Select setting>list setting all the columns of list are available to you in columns area.

3. hover mouse over the field, in status bar you can view some thing as below


the fieldname bold above is your required column name.


If works please marked as answer



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure