我可以使用schema.xml创建日历视图并为日期映射自定义列吗? [英] Can i create a calendar view with schema.xml and map custom columns for the dates?

查看:106
本文介绍了我可以使用schema.xml创建日历视图并为日期映射自定义列吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi everyone!

我想为列表创建一个视图,并将该视图设置为Type Calendar.我还想将MyStartDate等自定义字段映射到EventDate,将MyEndDate等映射到EndDate

I want to create a view for my list, and set the view to be Type Calendar. I also want to map custom fields such as MyStartDate to EventDate and MyEndDate to EndDate

我该怎么办?

推荐答案

这是我的清单.

我们需要添加< Query>标记可为以下日期映射自定义列.

We need to add <Query> tag to map custom columns for the dates as below.

这是我的日历视图的完整代码.

Here is the full code of my calendar view.

<View Name="{2D0DD284-ADCE-4B36-A782-241A6085D74E}" MobileView="TRUE" Type="CALENDAR" Scope="Recursive" DisplayName="MyCalendarView" Url="Lists/CustomList5/MyCalendarView.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/generic.png?rev=23">
        <ViewFields>
          <FieldRef Name="MyStartDate"/>
          <FieldRef Name="EndDate"/>
          <FieldRef Name="Title"/>
        </ViewFields>
        <CalendarViewStyles>&lt;CalendarViewStyle  Title=&#39;Day&#39; Type=&#39;day&#39; Template=&#39;CalendarViewdayChrome&#39; Sequence=&#39;1&#39; Default=&#39;FALSE&#39; /&gt;&lt;CalendarViewStyle  Title=&#39;Week&#39; Type=&#39;week&#39; Template=&#39;CalendarViewweekChrome&#39; Sequence=&#39;2&#39; Default=&#39;FALSE&#39; /&gt;&lt;CalendarViewStyle  Title=&#39;Month&#39; Type=&#39;month&#39; Template=&#39;CalendarViewmonthChrome&#39; Sequence=&#39;3&#39; Default=&#39;TRUE&#39; /&gt;</CalendarViewStyles>
        <ViewData>
          <FieldRef Name="Title" Type="CalendarMonthTitle"/>
          <FieldRef Name="Title" Type="CalendarWeekTitle"/>
          <FieldRef Name="Title" Type="CalendarWeekLocation"/>
          <FieldRef Name="Title" Type="CalendarDayTitle"/>
          <FieldRef Name="Title" Type="CalendarDayLocation"/>
        </ViewData>
        <Query>
          <Where>
            <DateRangesOverlap>
              <FieldRef Name="MyStartDate"/>
              <FieldRef Name="EndDate"/>
              <Value Type="DateTime">
                <Month/>
              </Value>
            </DateRangesOverlap>
          </Where>
        </Query>
        <Aggregations Value="Off"/>
        <RowLimit>0</RowLimit>
        <Mobile MobileItemLimit="3"/>
        <XslLink Default="TRUE">main.xsl</XslLink>
        <JSLink>clienttemplates.js</JSLink>
        <Toolbar Type="Standard"/>
        <ParameterBindings>
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)"/>
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)"/>
        </ParameterBindings>
      </View>

一种方便的方法来实现它.我们可以在UI中创建此日历视图,然后导出列表XML文件,我们将获取您想要的完整代码.关于如何导出列表xml文件,您可以使用以下REST API URL:"http://您的 网站url/_vti_bin/owssvr.dll?Cmd = ExportList& List = {GUID _of_your_list}",例如,在我的环境中,URL是"http://sp/sites/DevSite/_vti_bin/owssvr.dll?Cmd=ExportList&List={2418a9d 1bef-4cca-968b-3b5e46be8b7a }"

A convenient way to achieve it. we can create this calendar view in UI, then export list XML file and we will get the full code you want. About how to export list xml file, you can use this REST API URL: "http://Your site url/_vti_bin/owssvr.dll?Cmd=ExportList&List={GUID_of_your_list}", for example, in my environment, the URL is "http://sp/sites/DevSite/_vti_bin/owssvr.dll?Cmd=ExportList&List={2418a9d3-1bef-4cca-968b-3b5e46be8b7a}"

结果截图:

最诚挚的问候,

刘李


这篇关于我可以使用schema.xml创建日历视图并为日期映射自定义列吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆