How can I use an ICS file for multiple calendar deletes? - icalendar

I have a working ICS file that creates Outlook entries containing multiple vevent sections. New entries work fine.
How can I use a single ICS file with multiple vevents for deleting multiple entries without any user prompts? The best I have so far is the 1st vevent prompts for calendar removal of the 1st vevent, and all others are ignored in the file. This question is for O365 specifically.
The UID attributes match, the sequence is bumped by 1 on the deletion file for both vevents & the dtstamp attribute is updated to a later timestamp on both vevents in the file
The ICS file can have >100 vevent entries that are emailed as an attachment & they can be changed or deleted in bulk also in a single ICS file. Adding works. Deleting has not. They'll drag & drop the attached ICS file just like they do when the new entries are added.
(been pulling my hair out with multiple deletions in 1 file!! )
Some ICS delete snippets:
BEGIN:VCALENDAR
VERSION:2.0
ORGANIZER:someemailaddress#thecompany.com
METHOD:CANCEL
...
BEGIN:VEVENT
...
STATUS:CANCELLED
...
SEQUENCE:1 (the creating sequence is 0)
...
END:VEVENT
BEGIN:VEVENT
ORGANIZER:someemailaddress#thecompany.com
STATUS:CANCELLED
...
SEQUENCE:1 (the creating sequence is 0)
...
END:VEVENT
END:VCALENDAR

https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/7befe35d-0652-447f-a780-d5fd5b879d38 states "In the case where the METHOD property is set to 'REQUEST', 'REPLY', or 'CANCEL', the VCALENDAR component MUST define exactly one appointment"
Cancellations are limited to 1 vevent in the vcalendar section, and only 1 vcalendar section per ICS file.
I'm seriously thinking I'm just stuck! (it's an app redesign now to figure out a "plan B"

Related

Automatically download emails from Outlook with SAS or Outlook rule

I am trying to create a program to automatically download the attached files that are sent to us from a certain email and then transform the delimiter with SAS, of those csv that are attached to us and pass those csv through a flow that I have already created.
I have managed to create a program that treats the csv as I want and the delimiter that I want, the problem is that when it comes to automating the download of files from Outlook it does not work.
What I have done is create a rule with the following VB code that I found on the internet:
Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Users\ES010246\Desktop"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub
I have changed the path to my personal path where i want the files are downloaded.
website: https://es.extendoffice.com/documents/outlook/3747-outlook
The problem is that this code does not work for me, it does absolutely nothing for me and no matter how much I search the internet, only this code appears.
Is there any other way to do with SAS what I want? What is it to automatically download 8 csv files sent to me by Outlook, or has someone experienced the same thing as me with VBA?
I have followed all the steps about 7 times so I think the error is not in copying the code or selecting certain options wrong, in fact I had copied and pasted the code and later I modified the path where I wanted those to be saved. files but it doesn't work, does anyone know why?
I will be tremendously grateful, thank you very much for everything!
First of all, you need to make sure the file name and path doesn't include forbidden symbols.
The VBA macro used for a rule in Outlook is absolutely valid except that a mail item may contain the attached files with the same name, so a file saved to the disk may be overwritten (saved with the same name). That's why I'd suggest generating a file name with your own unique IDs making sure that DisplayName property is not empty and has a valid name what can be used for file names (exclude forbidden symbols).
Also you may consider handling the NewMailEx event of the Application class which is fired when a new message arrives in the Inbox and before client rule processing occurs. Use the Entry ID returned in the EntryIDCollection string to call the NameSpace.GetItemFromID method and process the item. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem.
The Items.ItemAdd event can be helpful when items are moved to a folder (from Inbox). This event does not run when a large number of items are added to the folder at once.

What are the minimum requirements for an ICS file?

ICS files can have a lot of different elements and parameters. What is the minimum information needed for an ICS file?
According to the RFC5545 icalendar specification:
The icalendar object must have a start and end https://datatracker.ietf.org/doc/html/rfc5545#section-3.4
For the calendar properties at the start of the file, see what 'must' and what 'can' be specified: https://datatracker.ietf.org/doc/html/rfc5545#section-3.7 EG PRODID & VERSION are must be there. So this may be the absolute minimum:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
END:VCALENDAR
I thought that recently a VTIMEZONE component was made required, howrever I'm not finding where it says that: https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.5
Then one could have an ics file empty of components, but lets assume you at least want one component present and lets assume you want a VEVENT:
For VEVENTS, see all that say "The following are REQUIRED," : https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.1
sometimes what is required depends on other circumstances. According to this spec version one can get away without a DTEND and DURATION. dtstamp & uid are required. DTSTART is REQUIRED if the component appears in an iCalendar object that doesn't specify the "METHOD" property. The SUMMARY appears to be optional!
Of course receiving applications may have their own idea about what to do with an Event that doesn't at least have a 'SUMMARY'.
So in summary the simplest may be:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:19970610T172345Z-AF23B2#example.com
DTSTAMP:19970610T172345Z
DTSTART:19970714T170000Z
END:VEVENT
END:VCALENDAR

How can an ICS file be written for a recurring event?

I want to create an ICS file that describes a recurring event, an event that takes place every Monday from 13:00 to 14:00 UTC for all of 2016. The ICS file should be importable by Google Calendar. I have found it difficult to find and understand details online about how such a file could be constructed. What I have currently is a way of creating a file that contains a list of individual events, but I want to have a rule for the events defined in the file instead. I have something like the following right now:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SERN//INDICO//EN
BEGIN:VEVENT
SUMMARY:Software Meeting
DTSTART;VALUE=DATE-TIME:20160818T150000Z
DTEND;VALUE=DATE-TIME:20160818T160000Z
DTSTAMP;VALUE=DATE-TIME:20160912T165700Z
UID:indico-event-563636#sern.ch
DESCRIPTION:https://indico.sern.ch/event/999999/
LOCATION:42-3-002 (SERN)
URL:https://indico.sern.ch/event/999999/
END:VEVENT
BEGIN:VEVENT
SUMMARY:Software Meeting
DTSTART;VALUE=DATE-TIME:20160825T150000Z
DTEND;VALUE=DATE-TIME:20160825T160000Z
DTSTAMP;VALUE=DATE-TIME:20160912T165700Z
UID:indico-event-565483#sern.ch
DESCRIPTION:https://indico.sern.ch/event/999999/
LOCATION:42-3-002 (SERN)
URL:https://indico.sern.ch/event/999999/
END:VEVENT
END:VCALENDAR
EDIT: Following the solution provided by zcontent, I wrote the following ICS file that appears to work successfully:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SERN//INDICO//EN
BEGIN:VEVENT
SUMMARY:Software Meeting
TZID:Europe/Zurich
DTSTART:20150202T170000
DTEND:20150202T180000
DTSTAMP:20150202T170000
RRULE:FREQ=WEEKLY;UNTIL=20380119T000000
UID:indico-event-565483#sern.ch
DESCRIPTION:https://indico.sern.ch/event/999999/
LOCATION:42-3-002 (SERN)
URL:https://indico.sern.ch/event/999999/
END:VEVENT
END:VCALENDAR
You will need to add an RRULE property to the event. For a repeating Monday event for 2016, you will need to have lines like this in your event:
DTSTART:20160104T130000Z
DTEND:20160104T140000Z
RRULE:FREQ=WEEKLY;UNTIL=20170101T000000Z
You can find the details about the RRULE syntax here:
http://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html
You may also find it useful to validate your icalendar feed during testing to ensure Google Calendar won't have an issue with it. Here is a useful validation tool:
http://icalendar.org/validator.html
Disclaimer: I think the icalendar validator tool is the best on the internet, but I also wrote it :-)

Automatically Export iCalendar to .ics

I need to automatically export an iCalendar calendar from iCal (obviously on a Mac) to the .ics files. I know I can manually do this in iCal by File->Export. I am pulling data from a shared calendar to be analyzed in MATLAB. I'll then want to use cron to pull the data frequently to be analyzed.
Alternatively, if someone knows where the calendar data is stored locally, then I guess I should be able to parse that file for the events/data.
There exists probably no matlab implementation, at least matlab file exchange lists nothing. To get the calendar data into Matlab I would use a Java Library like iCal4j. You can call java libraries directly in m code.
There are also possibilities to access C, C++, dll and .Net in Matlab. To my opinion the java bridge is the simplest to use, that's why I suggested a java solution.
The data directory is ~/Library/Calendars/[account]/[calendar]
The name of each subdirectory is the UID. Each subdirectory contains a file "info.plist":
account:
...
<key>Key</key>
<string>[UID]</string>
<key>Login</key>
<string>[account, i.e. mail address]</string>
calendar:
...
<key>Key</key>
<string>[UID]</string>
<key>Title</key>
<string>[Name of Calendar]</string>
Events are stored in "Events" subdirectory (1 .ics file for each event)

Grouping multiple events in a single ics file (icalendar stream)

I want to group multiple events in a single ICS file(iCalendar stream) according to the RFC. This can be done but I have no idea how. Can anyone help me or give me an example ?
Here is what rfc says:
However, multiple iCalendar objects can be sequentially grouped
together in an iCalendar stream. The first line and last line of the
iCalendar object MUST contain a pair of iCalendar object delimiter
strings. The syntax for an iCalendar stream is as follows:
icalstream = 1*icalobject
icalobject = "BEGIN" ":" "VCALENDAR" CRLF
icalbody
"END" ":" "VCALENDAR" CRLF
here is a simple example of an icalendar file with two events.
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//bobbin v0.1//NONSGML iCal Writer//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:20100701T080000Z
DTEND:20100701T110000Z
DTSTAMP:20091130T213238Z
UID:1285935469767a7c7c1a9b3f0df8003a#yoursever.com
CREATED:20091130T213238Z
DESCRIPTION:Example event 1
LAST-MODIFIED:20091130T213238Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Example event 1
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART:20100701T120000Z
DTEND:20100701T130000Z
DTSTAMP:20091130T213238Z
UID:1285935469767a7c7c1a9b3f0df8003b#yoursever.com
CREATED:20091130T213238Z
DESCRIPTION:Example event 2
LAST-MODIFIED:20091130T213238Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Example event 2
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
Copy this into a file and save it as events.ics and it should open in most icalendar compatible applications e.g. Outlook 2007, Sunbird, iCal. For more complicated examples you could try creating events in Google calendars and exporting the calendars to view the results or downloading preexisting calendars from somewhere like icalshare.com. The file format is similar to e-mail encoding in that it must be folded. Wikipedia has a pretty good article on ICalendar and if you Google "icalendar validator" you there are several services that will let you validate your files. Oh and if you get frustrated with it, you're not alone http://www.google.co.uk/support/forum/p/Calendar/thread?tid=366b19a87d1304ec&hl=en although it is a good spec imho, its implementations are very, er, different.
A little more detail on how you want to use it would help others help you.