2

I have created a custom SharePoint list definition. My template is a generic SPListItem. Each item has start and end values.

Now I have been given the requirement that I need to display the items in a calendar view. For this I have created following view for my list:

 <View BaseViewID="3" DisplayName="$Resources:Calendar;" Type="CALENDAR" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="MyCalendar.aspx" SetupPath="pages\viewpage.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <JSLink>
    </JSLink>
    <ViewFields>
      <FieldRef Format="TimeOnly" Name="ActivityStartTime"></FieldRef>
      <FieldRef Format="TimeOnly" Name="ActivityEndTime"></FieldRef>
      <FieldRef Name="ActivityProject"></FieldRef>
    </ViewFields>
    <Query>
      <OrderBy>
        <FieldRef Name="ActivityStartTime" Ascending="TRUE"></FieldRef>
        <FieldRef Name="ActivityEndTime" Ascending="TRUE"></FieldRef>
      </OrderBy>
    </Query>
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <JSLink />
  </View>

The only problem with this approach is, I cannot get the "New event" button to show up if I hover over a day cell in month view.

enter image description here

If I create a event list in Sharepoint I get expected results. But if I use my custom list with a calendar view it doesn't. Does anybody know what I'm missing here?

1 Answer 1

3

For anyone coming to this question, the solution was to put 106 in the type attribute in the list. This converted it from a generic list item list to a event list, which has this functionality OOTB.

2
  • 1
    Where do you modify the "type attribute" on the view aspx file?
    – Landfall
    Commented Jun 16, 2016 at 0:57
  • 1
    sorry for the late reply. the type attribute I was referring to can be set in the list definition (Elements.xml) and list instance (Elements.xml) files. Normally when you create a list through VS UI, it lets you choose the type of list so normally you wouldn't need to do this explicitly. Commented Feb 10, 2017 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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