Using Content Query to Show This Week's Events (e.g. Monday to Friday)
Dear AllI have a SharePoint calendar list that contains lots of different items/events. There is a field called Event Category which defines the type of event that each item is. One of the event categories is called Theme of the Week. The Theme of the Week events all have a start date (set as the beginning of the week) and an end date (set at the end of the week). They are also All Day events.I am trying to use the Content Query web part to display this week's theme from the calendar list. However, I can't filter on the Content Query using Where Start Date >= [Today] And End Date <= [Today]+7 because if the current day is Tuesday, it will not show the Theme of the Week that started on Monday.Is there any way I can show items from a start date to an end date?Many thanks for your helpDaniel
April 16th, 2010 6:52pm

Daniel,Let me know if this works:To show tasks due this week, create the following 2 calculated columns:Week start (Monday)=[due date]-(WEEKDAY([due date],2)-1)Week end (Friday)=[due date]+(5–WEEKDAY([due date],2))Create a view where:Week start is less than or equal to [Today]ANDWeek end is greater than or equal to [Today] source: Sharepoint Calculated Column – Tasks Due This Week Kanwal SharePoint Buzz
Free Windows Admin Tool Kit Click here and download it now
April 16th, 2010 6:59pm

Many thanks for your reply Kanwal. I'm afraid I didn't have any success with that. It said "Syntax error" on the Week End (Friday) one. I was using the Start Time in both of the calculated fields instead of Due Date (in your example).Daniel
April 17th, 2010 12:44am

Hi Daniel, I just tested Kanwal’s suggestion, it works perfectly on my side. Could you please double check your code? By the way, Kanwal’s suggestion is to use Views to filter the data but not using Content Query web part, and I think it could achieve your goal too. If you continues got the error, could you please let me know the detailed your calendar schema and steps to reproduce your issue? Thanks! Lambert Qin TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Sincerely, Lambert Qin Posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
April 19th, 2010 5:36am

Yup, i tested this as well and works just fine. If you can leverage views instead of a content query web part then why not. Extending this to a content query web part would not be a difficult. DJ let us know how it goes.Kanwal SharePoint Buzz
April 19th, 2010 10:07pm

Ah I'm sorry Kanwal -- I must not be understanding what I'm supposed to be doing. Unfortunately, I don't think I can use a View to do what I want because it is to appear within a different site completely. That's why I was thinking I'd have to use the Content Query instead. My calendar has a From Date and an To Date. The From date will be set to a day at the beginning of the week (eg Monday 19th April) and the To date will be set to the end (eg Friday 23rd April). I'm trying to get the Content Query to display the item where today's date falls between the To and From dates. I'm probably going bananas but the example you gave me above seems to apply if there is only one date ie a deadline. I couldn't see how I could make this work in my scenario. I'll have a sleep on it and it might all make sense in the morning :D Thanks to you both for your help! Daniel
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2010 1:12am

Hi Daniel, For your requirement, the two columns From Date and an To Date should be created as site columns in order to filter in content query web part. For detailed steps, see Create a site column (http://office.microsoft.com/en-us/sharepointserver/HA101777591033.aspx) After created the two site columns, please add them to the calendar list and fill the appropriate value. In the content query web part, you could add two filter conditions: From Date is less than or equal to [Today] and To Date is greater than or equal to [Today]. After done this, you should see the content query web part display the item where today's date falls between the To and From dates. Hope the information can be helpful. Lambert Qin TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Sincerely, Lambert Qin Posting is provided "AS IS" with no warranties, and confers no rights.
April 20th, 2010 5:16am

Hi Lambert I feel very stupid! I looked at using the 'Is Less Than or Equal' to and the 'Is Greater Than or Equal To' but convinced myself that wouldn't work. I apologise for my stupidity and thank you very much for your help as always! Daniel
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2010 11:11am

Hi Daniel, It is good to know your problem was resolved! Everyone make mistakes, usually the simple ones. Feel free and enjoy asking question in forums! Have a nice day!Sincerely, Lambert Qin Posting is provided "AS IS" with no warranties, and confers no rights.
April 20th, 2010 12:09pm

Hi Lambert I feel very stupid! I looked at using the 'Is Less Than or Equal' to and the 'Is Greater Than or Equal To' but convinced myself that wouldn't work. I apologise for my stupidity and thank you very much for your help as always! Daniel All is well! I'm just glad you got it working. :) Don't forget to share what you learn and give back by answering other posters question in the Forums. Who knows, it might be one of my questions :)Kanwal SharePoint Buzz
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2010 5:45pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics