none
Lookup Column from Calendar - Appointment Series RRS feed

  • Question

  • Hi,

    In addition to my question about pre-filtered lookup colums here < Link to thread > I have another problem.

    Do you know if and how it is possible to get all instances from a appointment series within a lookup column of the "start date" column from a calendar app? 

    Right now I just see the first element of the series and not the following ones...

    Thanks in adavance!

    Best regards
    Florian

    Friday, August 17, 2018 9:19 AM

All replies

  • Hi Florian,

    What do you mean about "Get all instances from a appointment series within a lookup column of the "start date" column from a calendar app"?

    Do you want to get the all the Recurring Events within a lookup column of the "Start Date" column?

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, August 20, 2018 9:57 AM
    Moderator
  • Hi Florian,

    What do you mean about "Get all instances from a appointment series within a lookup column of the "start date" column from a calendar app"?

    Do you want to get the all the Recurring Events within a lookup column of the "Start Date" column?

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Yes, that's exactly what I want.
    My goal is to see all the events of an appointment series within a lookup column that refers to the "Start Date" column of my calendar.

    Monday, August 20, 2018 11:35 AM
  • Hi,

    Unfortunately, the OOTB lookup column can't achieve it. By default the lookup column only get the first event of recurring events.

    As a workaround, we can use JSOM or SPService to get all recurring events.

    https://sympmarc.com/2015/07/07/retrieving-expanded-calendar-events-with-rest-vs-soap/

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, August 21, 2018 9:43 AM
    Moderator
  • That's not a problem as I'm using the code from <here> within my edit and view-forms.
    So we could add some more code to show all recurring events here too.

    The example you mentioned works with four calendars... which is quite complicated. I don't know how I could adapt this code to my environment...

    Best regards

    Florian

    Tuesday, August 21, 2018 2:32 PM
  • Hi,

    Please check the code below.

    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "TeamCal",
        CAMLViewFields: "<ViewFields>" +
                "<FieldRef Name='Title' />" +
                "<FieldRef Name='EventDate' />" +
                "<FieldRef Name='EndDate' />" +
                "<FieldRef Name='Location' />" +
                "<FieldRef Name='Description' />" +
                "<FieldRef Name='fRecurrence' />" +
                "<FieldRef Name='RecurrenceData' />" +
                "<FieldRef Name='fAllDayEvent' />" +
            "</ViewFields>",
        CAMLQuery: "<Query>" +
                "<Where>" +
                    "<DateRangesOverlap>" +
                        "<FieldRef Name='EventDate' />" +
                        "<FieldRef Name='EndDate' />" +
                        "<FieldRef Name='RecurrenceID' />" +
                        "<Value Type='DateTime'>" +
                            "<Month />" +
                        "</Value>" +
                    "</DateRangesOverlap>" +
                "</Where>" +
                "<OrderBy>" +
                    "<FieldRef Name='EventDate' />" +
                "</OrderBy>" +
            "</Query>",
        CAMLQueryOptions: "<QueryOptions>" +
                "<RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>" +
                "<ExpandRecurrence>TRUE</ExpandRecurrence>" +
            "</QueryOptions>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
    
                var $node = $(this);
                var eventTitle = $node.attr("ows_Title");
                console.log(eventTitle);
    
            });
        }
    })

    More information:

    https://stackoverflow.com/questions/45175942/retrieve-the-events-from-a-sharepoint-calendar-using-rest-api

    https://blog.hubfly.com/solutions/how-to-get-sharepoint-event-recurrence-data-using-rest-api

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, August 22, 2018 8:50 AM
    Moderator
  • Hello Dennis,

    it's been a while but now is the time to implement this script.

    Unfortunately I have to mix JavaScript and CAML as it seems... but I can't get it to work.

    What I want to achieve:

    I have to connect two apps with eachother.
    1. Calendar App
    2. Tasklist App

    In my Tasklist I need a Multi-Lookup field called "Gremium" which pulls the elements out of the calendar app.
    These calendar elements have to be pre-filtered by date to keep the lookup list small. I've achieved this with the help in this forum and I'm using this code in my "Newform.aspx" form:

    $(function () {
    	var fieldName="Gremium";
    	removeSelectOptions(fieldName);
    	$("input[id^='"+fieldName+"'][id$='_RemoveButton']").click(function(){
    		removeSelectOptions(fieldName);
    	});
    });
    function removeSelectOptions(fieldName){
    	$("select[id^='"+fieldName+"'][id$='_SelectCandidate'] option").each(function(){
    		//test date format dd-mm-yyyy
    		var option=$(this).text().split(" ")[0].split("-");
    		var startTime=new Date(option[0]+"-"+option[1]+"-"+option[2]);
    		var sDate=new Date();
    		sDate.setDate(sDate.getDate() -8);
    		var eDate=new Date();
    		eDate.setDate(eDate.getDate() + 30);		 
    		if(startTime<sDate||startTime>eDate){
    			$(this).remove();
    		}
    	});
    }

    The filtering works as designed.

    But if there are reacurring events / appointment series in my calendar, I'm loosing these events in my lookup.

    Can you please help me to update my working script with the ability to get all reacurring events / appointment series?

    Thanks in advance!

    Friday, August 9, 2019 12:06 PM
  • @Dennis Guo: could you please help me?
    Wednesday, September 18, 2019 12:42 PM