1

I am quite new to this so please bear with me. This has been driving me crazy all morning. I have been trying to create template for the CQWP that will display the calendar how I want it to show on the home page. I would like the event title to show on the left and the date of the event to show on the right (I also want it show 'All Day Event' under the events that are all day events, however I am trying to get it to pull the date first and then work on that part). However, for some strange reason SharePoint REFUSES to pull the contents of the @EventDate, @AllDayEvent and @EndDate.

I added this code to the CQWP see if I could at least pull the dates, but it doesn't work:

<property name="CommonViewFields" type="string">EventDate,DateTime;EndDate,DateTime</property>

This is the code I am using in the template:

        <td><xsl:value-of select="@Title"/></td>
        <td><xsl:value-of select="@EventDate"/> </td>

For some strange reason that would display this (just examples):

Christmas

Boxing Day

Instead of:

Christmas 12/25/2017 12:00:00

Boxing Day 12/26/2017 12:00:00

Can someone shed some light on this?

0

You need to export the content query webpart as below:

enter image description here

Open the exported file in a text editor. Find and replace Commonviewfields with the below line:

<property name="CommonViewFields" type="string">EventDate,DateTime;EndDate,DateTime</property>

Save the .webpart file. Edit the sharepoint page and upload the webpart. Add the webpart again on the page. After that modify the itemstyle.xsl and then these fields will be rendered on the page.

In the itemstyle, you can refer it now as below:

<td>
  <xsl:value-of select="@EventDate" disable-output-escaping="yes"/>  
</td>
<td>
    <xsl:value-of select="@EndDate" disable-output-escaping="yes"/>  
</td>
  • That is what I was doing all the time, however it would work when it wants to. I find SharePoint to be very temperamental. One minute that works and then the other minute it doesn't. As of right now it is working, however I don't know if it will be working tomorrow :(. – KayleeMaddison Feb 20 '17 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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