Create ICS Link

Forums Dynamic Forms for SharePoint Create ICS Link

This topic contains 3 replies, has 2 voices, and was last updated by  Alexander Bautz 2 weeks, 5 days ago.

  • Author
    Posts
  • #18261

    Kim West
    Participant

    Hi Alexander,
    I am trying to send an email with an ICS link to an item in a recurring calendar series. I realize the ID needs to be ID with EventDate in ISO format, but I haven’t been able to get it to come in with that format. Is there some way of getting the correct ID? It should look like this: 10.0.2017-12-26T17:30:00Z where the series ID is 10.

    Thank you for such an awesome product!
    Kim

  • #18322

    Alexander Bautz
    Keymaster

    Hi,
    Sorry for the late reply. I’ve not used recurring calendar events myself, but from what I can see, the ID parameter is just like you describe when you view a recurring event item. This means you can pull it in like this in the email:

    {ID}

    or if you plan to use some code in custom js you can get it like this:

    var theID = GetUrlKeyValue("ID");

    Alexander

  • #18338

    Kim West
    Participant

    Hi Alexander,

    Thank you for taking the time to respond, it is much appreciated!

    Yes, it seems like it should be that straight forward, however, I think you can see from the attached screen prints, that when I open the form, it doesn’t display the occurrence ID, it shows only the series ID. That’s why it is giving me a problem. I didn’t try the var yet, but I suspect it will return the same ID. I will give it a shot.

    I am using this formula which correctly creates a link to a calendar item, however I keep getting the whole series ID:

    /sites/mysite/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List={ListID}&CacheControl=1&ID={ID}&Using=event.ics

    What is frustrating is that if I open the form by default, SharePoint has a custom command to export that item to a file, so it will do it in the background, but I can’t seem to automate this. If you have any other suggestions, please let me know.

    Thanks!

  • #18343

    Alexander Bautz
    Keymaster

    Unfortunately it doesn’t look like the event.ics call actually detects / exports the recurrence information at all. Unfortunately this means (as far as I know) that you must build some custom code to do this.

    Unfortunately I cannot find time to do build this for you, but you should be able to build a custom function to call from a button in the DFFS form that exports a file with this information.

    Here is something to start with. Put this in the Custom JS in your form – and create a button to call the function from a HTML section in one of the tabs.

    function downloadFile(){
        var element = document.createElement('a');
        var data = [];
        data.push("BEGIN:VCALENDAR");
        data.push("PRODID:-//Microsoft Corporation//SharePoint MIMEDIR//EN");
        data.push("VERSION:2.0");
        data.push("METHOD:PUBLISH");
        data.push("BEGIN:VEVENT");
        data.push("UID;TYPE=SharePoint:16.0.2017-11-02T15:00:00Z");
        data.push("DTSTART:20171102T150000Z");
        data.push("DTEND:20171102T160000Z");
        data.push("RRULE:FREQ=YEARLY;BYMONTH=1;BYMONTHDAY=1");
        data.push("LOCATION;ENCODING=8BIT;CHARSET=utf-8:");
        data.push("TRANSP:OPAQUE");
        data.push("SEQUENCE:1");
        data.push("DTSTAMP:20171002T134741Z");
        data.push("SUMMARY;ENCODING=8BIT;CHARSET=utf-8:Recurring test");
        data.push("DESCRIPTION;ENCODING=8BIT;CHARSET=utf-8:");
        data.push("vCLASS:PUBLIC");
        data.push("END:VEVENT");
        data.push("END:VCALENDAR");
        element.setAttribute('href', 'data:text/text;charset=utf-8,' + encodeURI(data.join("")));
        element.setAttribute('download', "calendar.ics");
        element.click();
    }

    Please note that all dates must be pulled from the current item and put in the correct place in the “data” above, and the RRULE must be built according to the one set in the list by running a query to get “fRecurrence” and “RecurrenceData” and formatting it in the correct format – see this page for more info on the SharePoint recurrence format: http://thehightechheels.blogspot.no/2012/12/sharepoint-evenet-recurrencedata-xml.html

    Alexander

You must be logged in to reply to this topic.