none
Getting an error 'CalendarNotify' as null or undefined in the code at SP.UI.ApplicationPages.CalendarNotify line in SharePoint 2013 after migration from 2010 RRS feed

  • Question

  • Hello,

    I am getting an error 'CalendarNotify' as null or undefined in the code at SP.UI.ApplicationPages.CalendarNotify in SharePoint 2013 after migration from SharePoint 2010.  The SharePoint calendar is customized to display the events with colors and other customizations. 

    It was developed in SharePoint 2010 using client side objects /jquery.  After migration to 2013 stopped working.

    The code looks like in the following url...

    http://www.westpoint.edu/news/SiteAssets/ColorCoding.txt

    Any help is greatly appreciated!!!

    Thanks in advance.


    Raj

    Friday, January 9, 2015 6:44 AM

All replies

  • Hi

    Please follow this link if you can create your JavaScript from scratch

    http://www.planetwilson.co.uk/sharepoint-2013-colour-calendar-v2/

    or

    Check this code

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">
    // load our function to the delayed load list
    _spBodyOnLoadFunctionNames.push('calendarEventLinkIntercept');
     
    // hook into the existing SharePoint calendar load function.
    function calendarEventLinkIntercept()
    {
    if (SP.UI.ApplicationPages.CalendarNotify.$4a)
    {
    var OldCalendarNotify = SP.UI.ApplicationPages.CalendarNotify.$4a;
    SP.UI.ApplicationPages.CalendarNotify.$4a = function ()
    {
    OldCalendarNotify();
    bindEventClickHandler();
    }
    }
    if (SP.UI.ApplicationPages.CalendarNotify.$4b)
    {
    var OldCalendarNotify = SP.UI.ApplicationPages.CalendarNotify.$4b;
    SP.UI.ApplicationPages.CalendarNotify.$4b = function ()
    {
    OldCalendarNotify();
    bindEventClickHandler();
     
    }
    }
    // future service pack change may go here!
    // if (SP.UI.ApplicationPages.CalendarNotify.???)
    }
     
    function bindEventClickHandler() {
    $('.ms-acal-mdiv a, .ms-acal-ddiv a, .ms-acal-sdiv a').click(function(){EditLink2(this,'WPQ2');return false;});
    $('a.ms-cal-nav').attr("href", "javascript:bindEventClickHandler(); void(0);");
    }
    </script>

    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.


    • Edited by Amit Kotha Friday, January 9, 2015 7:03 AM
    Friday, January 9, 2015 7:00 AM
  • Thank you Amit for your quick reply, but in my case I am getting 'CalendarNotify' property as null/undefined and when I look at scripts loaded for the page execution I could notice even SP.UI.ApplicationPages.Calendar.js got executed.

    I am not sure what am I missing :(


    Raj

    Friday, January 9, 2015 7:08 AM
  • Hi Raj

    Instead of using JavaScript we can use Calendar overlay functionality which can be used easily to display events in colors based on  any column.

    Follow this link for more information

    http://thinketg.com/sharepoint-color-coding-your-calendar-by-category-tutorial/

    Thanks

    Amit

    Friday, January 9, 2015 8:56 AM
  • Hi Amit, It was developed using client side with sp.ui.applicationpages, it was working fine before migrating to 2013 and after migration (which is done by some other team) stopped working.

    Along with colors its been customized to display icons and customized for other functionalities too.

    Does 2013 support these objects or any patches need to be installed?

    Thank you


    Raj

    Friday, January 9, 2015 9:37 AM
  • I've the same problem.

    I get SP.UI.ApplicationPages  --> undefined in SharePoint 2013  (while it was working fine in SP2010)

    anyone solved this issue?

    Monday, November 16, 2015 9:27 AM
  • I'm facing the same issue: SP.UI.ApplicationPages is undefined.

    Has anyone resolve this issue and would kindly share his/her solution?

    Friday, June 10, 2016 5:29 PM
  • Same here, any solutions?
    Tuesday, June 20, 2017 12:09 PM

  • Those who face similar issue after migrating to SP 2013. Below solution worked for me.

    Basically as CalendarNotify is deprecated in 2013, we need to find a way to bind custom events to calendar changes event(month view, day view etc).  

    Thanks for original references - https://www.codeproject.com/Tips/759006/Enhancing-SharePoint-Calendar-sp-ui-applicationpag

    
    
    //
    // SharePoint 2013 Calendar - Capturing Render & Resize events
    // 
    
    function onCalendarGridsRendered(){
        setTimeout(function () { 
            //Add your functionality here
        }, 100);
    }
    
    function onCalendarResized(){
        setTimeout(function () { 
            //Add your functionality here
        }, 100);
    }
    
    SP.SOD.executeOrDelayUntilScriptLoaded(function () {
    
        //Week or Day Calendar View
        SP.UI.ApplicationPages.DetailCalendarView.prototype.renderGrids_Old = 
            SP.UI.ApplicationPages.DetailCalendarView.prototype.renderGrids;
        SP.UI.ApplicationPages.DetailCalendarView.prototype.renderGrids = 
            function SP_UI_ApplicationPages_DetailCalendarView$renderGrids($p0) {
            this.renderGrids_Old($p0);
    
            onCalendarGridsRendered();
        };
        
        //Month Calendar View
        SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids_Old = 
            SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids;
        SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids = 
            function SP_UI_ApplicationPages_SummaryCalendarView$renderGrids($p0) {
            this.renderGrids_Old($p0);
    
            onCalendarGridsRendered();
        };
    
        //Resize Calendar
        SP.UI.ApplicationPages.CalendarStateHandler.prototype.parentResized_Old = 
            SP.UI.ApplicationPages.CalendarStateHandler.prototype.parentResized;
        SP.UI.ApplicationPages.CalendarStateHandler.prototype.parentResized = 
            function SP_UI_ApplicationPages_CalendarStateHandler$parentResized() {
            this.parentResized_Old();
    
            onCalendarResized();
        };
    }, "SP.UI.ApplicationPages.Calendar.js");


    If this helps Please mark it answer or Vote As Helpful.

    Thanks
    Siddharth Vaghasia

    • Edited by Siddharth_Vaghasia Tuesday, September 12, 2017 6:58 AM edited answer
    • Proposed as answer by M_Menon Tuesday, May 8, 2018 11:14 AM
    Tuesday, September 12, 2017 6:54 AM