次の方法で共有


"Standard View, with Expanded Recurring Events" is missing in the custom calendar created from the custom calendar list definition. Bend it through custom ToolBar !!

I have came across another interesting issue with the custom calendar list definition last week.

As the SharePoint doesn’t consider your custom list definition as the “Events” type it doesn’t give you the option to create “Standard View, with Expanded Recurring Events" while creating the view for your custom calendar.

Again the SharePoint renders the option to create view based on the “List Type” and it renders the “Standard View, with Expanded Recurring Events" if the List template type is “106” but the template type of your list definition will be unique and not the “106” so the calendar created from your custom calendar list definition will not provide the option to create “Standard View, with Expanded Recurring Events".

This restriction is done in the “ViewType.aspx” application page under the layouts folder and you need to make changes in such a way that your custom calendar list type should be taken into consideration to render the option to create view with recurring events. Following is the content of the “ViewType.aspx” page and the changes to render the view for your custom list template is highlighted. Actually the view types are beautifully rendered in the OOB based on the list template type. The custom calendar list definition will be treated as a custom list and not as a calendar list so we need to make changes in several places as shown below : Replace the Feature GUID with the GUID of your Custom calendar list definition feature.

(Note : I have used the “TemplateFeatureID” property and rendering the view for the my custom calendar list template also. I am looking for some optimized way to achieve this. Because now you need to add one entry for every custom calendar list template you have)

<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.ViewTypesPage" MasterPageFile="~/_layouts/application.master" %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>

<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="Meetings" Namespace="Microsoft.SharePoint.Meetings" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<script language="C#" runat="server">

SPSite spServer;

SPWeb spWeb;

SPList spList;

bool fHideStandardViewOption;

bool fHideGridViewOption;

bool fHideCalendarViewOption;

bool fHideRecursiveViewOption;

bool fHideDiscussionViewsOption;

bool fHideRichDbViewOption;

bool fHideGanttViewOption;

bool fHideCalendarViewForNonCalendarOption;

bool fColumnPosition;

string RecursiveViewTypeText;

string RecursiveViewTypeDescription;

string urlViewNew;

protected override void OnLoad(EventArgs e)

{

      base.OnLoad(e);

      spWeb = SPControl.GetContextWeb(Context);

      Microsoft.SharePoint.ApplicationPages.ListPageBase.ThrowIfNoListQueryString();

      spList = spWeb.Lists.GetList(new Guid(Request.QueryString.GetValues("List")[0]), true);

      PageTarget = spList;

      urlViewNew = "ViewNew.aspx?List=" +

            SPHttpUtility.UrlKeyValueEncode(Request.QueryString["List"]);

      string sourceParameter = Request.QueryString["Source"];

      if (!String.IsNullOrEmpty(sourceParameter))

      {

            urlViewNew += "&Source=" +

                  SPHttpUtility.HtmlUrlAttributeEncode(

                        SPHttpUtility.UrlKeyValueEncode(sourceParameter));

      }

      fHideGridViewOption = ListViewWebPart.RestrictedTemplateType(spList)

                                          || !spList.DoesUserHavePermissions(SPBasePermissions.UseClientIntegration);

    fHideStandardViewOption = (spList.BaseTemplate == SPListTemplateType.DiscussionBoard ||

                             spList.BaseTemplate == SPListTemplateType.Events);

      fHideDiscussionViewsOption = (spList.BaseTemplate != SPListTemplateType.DiscussionBoard);

    fHideCalendarViewOption = (spList.BaseTemplate != SPListTemplateType.Events);

      fHideCalendarViewForNonCalendarOption = (spList.BaseTemplate == SPListTemplateType.UserInformation);

      fHideRichDbViewOption = (spList.BaseTemplate == SPListTemplateType.UserInformation)

                                          || !spList.DoesUserHavePermissions(SPBasePermissions.UseClientIntegration);

      fHideGanttViewOption = (spList.BaseTemplate == SPListTemplateType.UserInformation);

      fColumnPosition=true;

}

private void FlipColumn()

{

      if (fColumnPosition)

            Response.Write("</table></td><td width=50%><table>");

      else

            Response.Write("</table></td></tr><tr><td wdith=50%><table>");

      fColumnPosition = (fColumnPosition) ? false : true;

}

</script>

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">

      <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_pagetitle%>" EncodeMethod='HtmlEncode'/>

</asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

      <script>

      var navBarHelpOverrideKey = "SelectViewType";

      </script>

      <script language="javascript">

            var _spUseDefaultFocus = true;

            function _spBodyOnLoad()

            {

      if (browseris.ie5up && browseris.win32)

      {

      try

      {

      var ExpDatabase = null;

      var url = location.href;

      ExpDatabase = new ActiveXObject("SharePoint.ExportDatabase");

      if (ExpDatabase && ExpDatabase.IsDBProgramInstalled())

      {

                  idAccViewRow.style.display = "inline";

                  idAccViewTitle.innerText = ExpDatabase.LinkTitle;

                  idAccViewCmt.innerText = ExpDatabase.LinkDescription;

                  if (url.toLowerCase().substr(0, 8) != 'https://')

                  {

                        document.all.idAccViewImg.src = ExpDatabase.LinkImageSrc;

                  }

                  document.all.idAccViewImg.alt = ExpDatabase.LinkDescription;

                  ExpDatabase = null;

      return;

      }

      }

      catch(e)

      {}

      }

            }

      </script>

</asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">

      <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_pagetitle%>" EncodeMethod='HtmlEncode'/>: <A ID="viewedit1" HREF=<%SPHttpUtility.AddQuote(SPHttpUtility.UrlPathEncode(spList.DefaultViewUrl,true),Response.Output);%>><%SPHttpUtility.HtmlEncode(spList.Title,Response.Output);%></A>

</asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"/>

<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">

      <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_pagedescription%>" EncodeMethod='HtmlEncode'/>

</asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

            <table border="0" cellpadding="0" cellspacing="0" width="100%" style="font: small">

      <!-- Or choose a format -->

                        <tr><td width=100% colspan=2 valign=top>

                        <table width=100% border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td colspan=2 class="ms-linksectionheader" style="padding: 4px;" valign="top">

                                    <H3 class="ms-standardheader">

                                    <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_chooseformat%>" EncodeMethod='HtmlEncode'/>

                                    </H3>

                              </td></tr>

                              <tr><td><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></td></tr>

                        </table>

                        </td></tr>

</table>

<table>

 <tr>

  <td width=50%>

   <table>

      <!-- HTML View-->

<%

    if (!fHideStandardViewOption && spList.TemplateFeatureId != new Guid("FA77E3F5-6223-4de1-B25E-64659533F87A"))

      {

%>

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>' ID='onetCategoryHTMLimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_idViewType2%>" src="/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>' ID='onetCategoryHTML'>

                  <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_idViewType1%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_idViewType2%>" EncodeMethod='HtmlEncode'/>

      <br>&nbsp;

                  </td></tr>

<%

      FlipColumn();

      }

%>

      <!-- Discussion Board Views-->

<%

      if (!fHideDiscussionViewsOption)

      {

%>

            <!-- Subject View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=3' ID='onetCategoryHTMLimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_subjectviewdesc%>" src="/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=3' ID='onetCategoryHTML'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_subjectview%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_subjectviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

            <% FlipColumn(); %>

            <!-- Threaded View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=1' ID='onetCategoryHTMLimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_threadedviewdesc%>" src="/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=1' ID='onetCategoryHTML'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_threadedview%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_threadedviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

            <% FlipColumn(); %>

            <!-- Flat View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=2' ID='onetCategoryHTMLimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_flatviewdesc%>" src="/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=2' ID='onetCategoryHTML'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_flatview%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_flatviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

<%

            FlipColumn();

      }

%>

<%

    if (!fHideCalendarViewOption || spList.TemplateFeatureId == new Guid("FA77E3F5-6223-4de1-B25E-64659533F87A"))

      {

%>

      <!-- ALLITEMS View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=1' ID='onetCategoryHTMLimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_idViewType2%>" src="/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=1' ID='onetCategoryHTML'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_idViewType1%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_idViewType2%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

      <% FlipColumn(); %>

      <!-- RECURRENCE View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&RecurrenceRowset=True&BaseViewID=3' ID='onetCategoryHTMLimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_recviewdesc%>" src="/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&RecurrenceRowset=True&BaseViewID=3' ID='onetCategoryHTML'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_idViewType7%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_recviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

      <% FlipColumn(); %>

      <!-- CALENDAR View for Calendar List-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Calendar=True&BaseViewID=2' ID='onetCategoryCalendarimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_calviewdesc%>" src="/_layouts/images/calview.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Calendar=True&BaseViewID=2' ID='onetCategoryCalendar'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_calview%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_calviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

                 

      <% FlipColumn(); %>

<%

      }

%>

<%

      if (!fHideGridViewOption)

      {

%>

      <!-- Grid View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Grid=True' ID='onetCategoryGirdimg' tabindex=-1>

                                    <img runat="server" border="0" alt= "<%$Resources:wss,viewtype_datasheetviewdesc%>" src="/_layouts/images/grid.gif" />

                                    </a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Grid=True' ID='onetCategoryGrid'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_datasheetview%>" EncodeMethod='HtmlEncode'/>

                        </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_datasheetviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

      <% FlipColumn(); %>

<%

      }

%>

   <!-- Calendar View-->

 <%

     if (!fHideStandardViewOption && !fHideCalendarViewForNonCalendarOption && spList.TemplateFeatureId != new Guid("FA77E3F5-6223-4de1-B25E-64659533F87A"))

      {

%>

      <!-- Calendar View for other lists except Calendar List-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Calendar=True' ID='onetCategoryCalendarimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_calviewdesc%>" src="/_layouts/images/calview.gif">

                                    </img></a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Calendar=True' ID='onetCategoryCalendar'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_calview%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_calviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

                  <!--<tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                        <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&RecurrenceRowset=True&BaseViewID=3' ID='A1' tabindex=-1>

                                    <img id="Img1" runat="server" border="0" alt="<%$Resources:wss,viewtype_recviewdesc%>" src="https://blogs.msdn.com/_layouts/images/ituser.gif" mce_src="https://blogs.msdn.com/_layouts/images/ituser.gif" />

                                    </a>

                              </td><td>&nbsp;</td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="Td1">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&RecurrenceRowset=True&BaseViewID=3' ID='A2'>

                              <SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="<%$Resources:wss,viewtype_idViewType7%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral ID="EncodedLiteral2" runat="server" text="<%$Resources:wss,viewtype_recviewdesc%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>-->

      <% FlipColumn(); %>

<%

      }

%>

<%

      if (!fHideGanttViewOption)

      {

%>

      <!-- Gantt View-->

                        <tr><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td>

                                    <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Gantt=True' ID='onetCategoryGanttimg' tabindex=-1>

                                    <img runat="server" border="0" alt="<%$Resources:wss,viewtype_ganttviewdescription%>" src="/_layouts/images/ganttview.gif">

                                    </img></a>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&Gantt=True' ID='onetCategoryGantt'>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_ganttview%>" EncodeMethod='HtmlEncode'/>

                              </a><br>

                              <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_ganttviewdescription%>" EncodeMethod='HtmlEncode'/>

                        <br>&nbsp;

                  </td></tr>

            <% FlipColumn(); %>

<%

      }

%>

<%

      if (!fHideRichDbViewOption && spList.DefaultView != null)

      {

%>

      <!-- Rich DB View-->

                        <tr ID="idAccViewRow" style="display: none"><td valign=top width="1%">

                        <table border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td>

                              <A HREF="javascript:" onclick= <% SPHttpUtility.NoEncode("\"javaScript:ExportToDatabase('" + SPHttpUtility.EcmaScriptStringLiteralEncode(spWeb.Url) + "/_vti_bin/owssvr.dll', '" + spList.ID.ToString("B").ToUpperInvariant() + "', '" + spList.DefaultView.ID.ToString("B").ToUpperInvariant() + "', 'true');javascript:return false;\"",Response.Output); %> tabindex=-1>

                                    <img ID="idAccViewImg" src="/_layouts/images/grid.gif" border="0">

                                    </img></A>

                              </td><td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td></tr>

                        </table>

                        </td>

                        <td class="ms-vb" width="99%" valign="top" ID="_spFocusHere">

                              <A ID="idAccViewTitle" HREF="javascript:" onclick= <% SPHttpUtility.NoEncode("\"javaScript:ExportToDatabase('" + SPHttpUtility.EcmaScriptStringLiteralEncode(spWeb.Url) + "/_vti_bin/owssvr.dll', '" + spList.ID.ToString("B").ToUpperInvariant() + "', '" + spList.DefaultView.ID.ToString("B").ToUpperInvariant() + "', 'true');javascript:return false;\"",Response.Output); %> >

                              </A><br>

                              <span ID="idAccViewCmt"></span>

                        <br>&nbsp;

                  </td></tr>

<%

      }

%>

            </table>

            </td>

            </tr>

</table>

      <!-- Create From Existing View -->

                  <table width="100%" border=0>

                        <tr><td width=100% colspan=2 valign=top>

                        <INPUT name="List" type="hidden" value=<%SPHttpUtility.UrlKeyValueEncode(Request.QueryString["List"], Response.Output);%>>

                        <table width=100% border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td colspan=2 class="ms-linksectionheader" style="padding: 4px;" valign="top">

                              <H3 class="ms-standardheader">

                                    <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_startfromexisting%>" EncodeMethod='HtmlEncode'/>

                              </H3>

                              </td></tr>

                        </table>

                        <table style="margin: 2px 5px 0px 5px;" cellspacing=0 cellpadding=0>

<%

                                          foreach (SPView view in spList.Views)

                                          {

                                                if (view.Hidden || view.EditorModified || view.ReadOnlyView || String.IsNullOrEmpty(view.Title))

                        continue;

%>

                                                <tr>

                                                <td valign="top" class="ms-descriptiontext" style="padding-top:5px;">

                                                <IMG src="/_layouts/images/setrect.gif" width=5px height=5px alt=''>&nbsp;

                                                </td>

                                                <td width=100% class="ms-descriptiontext" style="padding-top:7px;padding-left: 3px;">

                                                      <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&View=<%SPHttpUtility.UrlKeyValueEncode(view.ID.ToString(), Response.Output);%>'> <% SPHttpUtility.HtmlEncode(view.Title,Response.Output); %> </a>

                                                </td>

                                                </tr>

<%

                                          }

%>

                        </table>

                        <br>

                        </td>

                        </tr>

                  </table>

      <!-- Create From View Template -->

<%

      System.Collections.Generic.ICollection<SPView> uninstantiatedViews = GetUncustomizedViewsWhichAreNotInstantiated(spList);

      if (uninstantiatedViews.Count > 0)

      {

%>

                  <table width="100%">

                        <tr><td width=100% colspan=2 valign=top>

                        <INPUT name="List" type="hidden" value=<%SPHttpUtility.UrlKeyValueEncode(Request.QueryString["List"], Response.Output);%>>

                        <table width=100% border=0 cellspacing=0 cellpadding=0 style="padding-top:2px">

                              <tr><td colspan=2 class="ms-linksectionheader" style="padding: 4px;" valign="top">

      <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,viewtype_startfromtemplate%>" EncodeMethod='HtmlEncode'/>

                              </td></tr>

                        </table>

                        <table style="margin: 2px 5px 0px 5px;" cellspacing=0 cellpadding=0>

<%

                                          System.Collections.Generic.ICollection<SPView> uncustomizedViews = GetUncustomizedViews(spList);

                                          foreach (SPView view in uninstantiatedViews)

                                          {

%>

                                                <tr>

                                                <td valign="top" class="ms-descriptiontext" style="padding-top:5px;">

                                                <IMG src="/_layouts/images/setrect.gif" width=5px height=5px alt=''>&nbsp;

                                                </td>

                                                <td width=100% class="ms-descriptiontext" style="padding-top:7px;padding-left: 3px;">

                                                      <a href='<%SPHttpUtility.NoEncode(urlViewNew, Response.Output);%>&BaseViewID=<%SPHttpUtility.UrlKeyValueEncode(view.BaseViewID, Response.Output);%>'> <% SPHttpUtility.HtmlEncode(view.Title,Response.Output); %> </a>

                                                </td>

                                                </tr>

<%

                                          }

%>

                        </table>

                        </td>

                        </tr>

                  </table>

<%

      }

%>

</asp:Content>

Save the changes and you can find that the standard view with recurring events option is rendered in your custom calendar created from the custom calendar list definition. So bending the SharePoint without bending the rules starts here J … Yes you cannot make changes to the OOB “ViewType.aspx” page directly as it is not supported…

So take a copy of the OOB “ViewType.aspx” page and make the above shown changes and save it in the same “Layouts” folder say as “CustomViewType.aspx” page. Koool !! We have successfully created the “CustomviewType.aspx” page… But creating the view in the SharePoint calendars will not navigate you to the “CustomViewType.aspx” and by default they will navigate you to OOB “ViewType.aspx” page.

Following are three places where you need to do customization so that you can use the “CustomViewType.aspx” to create the view for the calendar created from your custom calendar list definition:

1.    “Create View” menu item of the “Settings Menu” in the calendar toolbar.

2.    “Create View” menu item of the “ListView Selector” in the calendar toolbar.

3.    “Create View” link of the “ListEdit.aspx” application page. We cannot make changes to the OOB “ListEdit.aspx” page so take a copy of the “ListEdit.aspx” and make the changes to navigate to the “CustomViewType.aspx” page and save it as say “CustomListEdit.aspx” page. So again the customization lies in customizing the “List Settings” menu item in the Settings Menu to navigate to the “CustomListEdit.aspx” page.

Customizing the “Settings Menu” in the calendar View toolbar to change the Navigation of “Create View” and “List Settings” menu item :

1.    To change the Navigate URL of the “Create View” menu item of the “Settings Menu” we need to override the “SetMenuItemProperties” method of the Microsoft.SharePoint.WebControls.SettingsMenu Type. Create your own “SettingsMenu” web control and override the “SetMenuItemProperties” as shown below. The below highlighted snippets shows the changes to navigate to the custom page for “Create View” and “List Settings” menu item.

public class SettingsMenuCalendar:SettingsMenu

    {

        protected override void SetMenuItemProperties()

        {

          

            string str;

            base.MenuTemplateControl.LargeIconMode = true;

           // SPHttpUtility.UrlKeyValueEncode(base.RenderContext.RootFolderUrl);

            string str2 = "&Source=" + SPHttpUtility.UrlKeyValueEncode(SPHttpUtility.UrlPathEncode(SPUtility.GetFullUrl(this.Web.Site, HttpContext.Current.Request.RawUrl), true));

            MenuItemTemplate menuItem = base.GetMenuItem("AddColumn");

            if (menuItem != null)

            {

                str = WebLayoutsPath + "fldNew.aspx?List=" + SPHttpUtility.UrlKeyValueEncode(this.List.ID.ToString("B")) + str2;

                menuItem.ClientOnClickNavigateUrl = str;

            }

            menuItem = base.GetMenuItem("AddQuestions");

            if (menuItem != null)

            {

                str = WebLayoutsPath + "qstNew.aspx?List=" + SPHttpUtility.UrlKeyValueEncode(this.List.ID.ToString("B")) + str2;

                menuItem.ClientOnClickNavigateUrl = str;

            }

            menuItem = base.GetMenuItem("AddView");

            if (menuItem != null)

         {

                str = WebLayoutsPath + "CustomViewType.aspx?List=" + SPHttpUtility.UrlKeyValueEncode(this.List.ID.ToString("B")) + str2;

                menuItem.ClientOnClickNavigateUrl = str;

            }

            menuItem = base.GetMenuItem("ListSettings");

            if (menuItem != null)

            {

                if (this.List.BaseType != SPBaseType.Survey)

                {

                    str = WebLayoutsPath + "Customlistedit.aspx?List=" + SPHttpUtility.UrlKeyValueEncode(this.List.ID.ToString("B"));

                }

                else

                {

                    str = WebLayoutsPath + "survedit.aspx?List=" + SPHttpUtility.UrlKeyValueEncode(this.List.ID.ToString("B"));

                }

                menuItem.ClientOnClickNavigateUrl = str;

                menuItem.Text = SPUtility.FormatStringWithListType(SPResource.GetString("ToolBarMenuItemSettings", new object[0]), this.List, false);

                if (string.IsNullOrEmpty(menuItem.Description))

  {

                    menuItem.Description = SPUtility.FormatStringWithListType(SPResource.GetString("ToolBarMenuItemSettingsDescription", new object[0]), this.List, true);

                }

            }

            base.MenuControl.ID = "ListSettingsMenu";

            base.MenuControl.UseShortId = true;

        }

// WebLayoutsPath is used in the above method to get the site relative “Layouts” path correctly

        internal string WebLayoutsPath

        {

            get

            {

   string parentWebUrl = this.List.ParentWebUrl;

                if (!parentWebUrl.EndsWith("/"))

                {

                    parentWebUrl = parentWebUrl + "/";

                }

                return (parentWebUrl + "_layouts/");

    }

        }

 

    }

2.    Build the DLL. We will see later that how we can render the custom “SettingsMenu” web control instead of OOB control to the calendar list toolbar.

Customizing the “ListView Selector” in the calendar view toolbar:

1.    To change the Navigate URL of the “Create View” menu item of the “ListView Selector Menu” we need to override the “DefaultTemplateName” property of the Microsoft.SharePoint.WebControls.ListViewSelector Type. Create your own “ListViewSelector” web control and override the “DefaultTemplateName” as shown below.

public class CustomListViewSelector : ListViewSelector

    {

        protected override string DefaultTemplateName

        {

            get

            {

                return "CustomViewSelector";

            }

        }

    }

2.    The above mentioned code just changes the name of the rendering template name but the control which renders the View Selector in the toolbar is the Microsoft.SharePoint.WebControls.ViewSelectorMenu. We need to override the “SetMenuItemProperties” method of the “ViewSelectorMenu” type as shown below to change the navigation of “Create view” menu item.

public class CustomViewSelectormenu : ViewSelectorMenu

    {

        protected override void SetMenuItemProperties()

  {

            //base.SetMenuItemProperties();

           

            string str;

            base.MenuTemplateControl.LargeIconMode = true;

            // SPHttpUtility.UrlKeyValueEncode(base.RenderContext.RootFolderUrl);

            string str2 = "&Source=" + SPHttpUtility.UrlKeyValueEncode(SPHttpUtility.UrlPathEncode(SPUtility.GetFullUrl(this.Web.Site, HttpContext.Current.Request.RawUrl), true));

            MenuItemTemplate menuItem = base.GetMenuItem("CreateView");

            if (menuItem != null)

            {

                str = WebLayoutsPath + "CustomViewType.aspx?List=" + SPHttpUtility.UrlKeyValueEncode(this.List.ID.ToString("B")) + str2;

                menuItem.ClientOnClickNavigateUrl = str;

              

            }

        }

  internal string WebLayoutsPath

        {

            get

            {

                string parentWebUrl = this.List.ParentWebUrl;

                if (!parentWebUrl.EndsWith("/"))

                {

                    parentWebUrl = parentWebUrl + "/";

                }

                return (parentWebUrl + "_layouts/");

            }

        }

    }

3.    Build the DLL and place it in the GAC. You can keep all the above shown classes in the same project or in different, for example here I have written all the classes in the same assembly.

Now we will have a look on how to render the custom web controls which we created instead of the OOB web controls to the Custom calendar list template.

Creating Custom “defaulttemplates.ascx” to render the Custom SettingsMenu and the ViewSelectorMenu

1.    Create a user control in the Control Templates folder and add the custom rendering template to render your custom control as follows. You can take a look on this blog post on customizing the List Toolbar template:

a.    In the custom defaulttemplates.ascx control add all the reference to the required DLL’s including your custom DLL created for the custom “SettingsMenu” and the custom “ViewSelectorMenu”

<%@ Control Language="C#" AutoEventWireup="false" %>

<%@Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>

<%@Register TagPrefix="CustomSettingsMenu" Assembly="CustomSettingsMenu, Version=1.0.0.0, Culture=neutral, PublicKeyToken=031d0c8d7c05496f" namespace="CustomSettingsMenu"%>

<%@Register TagPrefix="SPHttpUtility" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.Utilities"%>

<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="~/_controltemplates/ToolBar.ascx" %>

<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="~/_controltemplates/ToolBarButton.ascx" %>

b.    The Following rendering template is to render the “CustomViewSelector” template which holds the Custom “ViewSelectorMenu”.

<SharePoint:RenderingTemplate ID="CustomViewSelector" runat="server">

      <Template>

            <table border="0" cellpadding="0" cellspacing="0" style='margin-right: 4px'>

            <tr>

            <td nowrap class="ms-listheaderlabel"><SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="<%$Resources:wss,view_selector_view%>" EncodeMethod='HtmlEncode'/>&nbsp;</td>

            <td nowrap class="ms-viewselector" id="onetViewSelector" onmouseover="this.className='ms-viewselectorhover'" onmouseout="this.className='ms-viewselector'" runat="server">

                        <CustomSettingsMenu:CustomViewSelectorMenu MenuAlignment="Right" AlignToParent="true" runat="server" id="ViewSelectorMenu1" />

                  </td>

            </tr>

            </table>

      </Template>

</SharePoint:RenderingTemplate>

c.    The following rendering template is to render the Custom “SettingsMenu” and the Custom “ListViewSelector” toolbar. This template will be used by the each views of the custom calendar list definition to render the toolbar.

<SharePoint:RenderingTemplate ID="CalendarViewToolbar" runat="server">

      <Template>

            <wssuc:ToolBar CssClass="ms-menutoolbar" EnableViewState="false" id="toolBarTbl" ButtonSeparator="<img src='/_layouts/images/blank.gif' alt=''>" RightButtonSeparator="&nbsp;&nbsp;" runat="server">

                  <Template_Buttons>

                        <SharePoint:NewMenu ID="NewMenu1" AccessKey="<%$Resources:wss,tb_NewMenu_AK%>" runat="server" />

                        <SharePoint:ActionsMenu ID="ActionsMenu1" AccessKey="<%$Resources:wss,tb_ActionsMenu_AK%>" runat="server" TemplateName="ToolbarActionsMenu" />

                        <CustomSettingsMenu:SettingsMenuCalendar ID="SettingsMenu1" AccessKey="<%$Resources:wss,tb_SettingsMenu_AK%>" runat="server" />

                  </Template_Buttons>

                  <Template_RightButtons>

                        <SharePoint:PagingButton ID="PagingButton1" runat="server"/>

                        <CustomSettingsMenu:CustomListViewSelector ID="ListViewSelector1" runat="server"/>

                       

                  </Template_RightButtons>

            </wssuc:ToolBar>

      </Template>

</SharePoint:RenderingTemplate>

d.    The final step is to change the “Schema.xml” of the custom calendar list definition to use the above mentioned “CalendarViewToolbar” template to render the view toolbar. Open the schema.xml file of the custom calendar list definition and set the “ToolbarTemplate” property of every view as shown below. Following is the example snippet for the “All Events” view make this change to every view in the schema.

<View BaseViewID="1" Type="HTML" ToolbarTemplate="CalendarViewToolbar" WebPartZoneID="Main" DisplayName="$Resources:core,userinfo_schema_alleventsview;" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/events.png" Url="AllItems.aspx" DefaultBaseView="TRUE">

That’s all …… with all these changes you have successfully implemented the Standard view with Recurring events to your custom calendar list definition in the supported way by overriding the “SettingsMenu” and the “ViewSelectorMenu” in the supported way. I have attached all the required files and the DLL’s required to implement this requirement.

After all the changes in place make sure that you do an IISRESET J

 

                               

                                                                                                           Happy Customizing