none
create an ical from a users exchange mailbox calendar with ews RRS feed

  • Question

  • Hello,

    is there a way to export (save) a users calendar as an ics file over ews?

    Regards

    Ioannis

    Friday, February 28, 2014 11:57 AM

Answers

  • Exchange will return a VCalendar version of the Appointment if you request the Mime Content eg

                FindItemsResults<Item> fiResults = null;
                ItemView ivItemView = new ItemView(1000);
                PropertySet psPropSet = new PropertySet(BasePropertySet.IdOnly);
                ivItemView.PropertySet = psPropSet;
                PropertySet mimePropSet = new PropertySet(BasePropertySet.IdOnly){ItemSchema.MimeContent,ItemSchema.Subject};
                do
                {
                    fiResults = service.FindItems(WellKnownFolderName.Calendar, ivItemView);
                    if (fiResults.Items.Count > 0) {
                        service.LoadPropertiesForItems(fiResults.Items, mimePropSet);
                        foreach (Item itItem in fiResults.Items) {
                            String FileName = "c:\\temp\\" + Guid.NewGuid().ToString() + ".ical";
                            MimeContent  mcMimeContent = null;
                            if (itItem.TryGetProperty(ItemSchema.MimeContent, out mcMimeContent))
                            {
                                File.WriteAllBytes(FileName, mcMimeContent.Content);
                            }
                        }
                    }
    
                } while (fiResults.MoreAvailable);

    I wouldn't however recommend you use this as a backup because it doesn't give you full fidelity on the appointment data eg things like attendees and other properties aren't included in you'll experience data loss.

    If you want to backup calendar appointments the best method is to use the New-MailboxExportRequest eg

    New-MailboxExportRequest -Mailbox Mailbox -IncludeFolders "#Calendar#"

    Cheers
    Glen

    Monday, March 3, 2014 5:50 AM

All replies

  • Please find below steps to export your outlook calendar.

    1. (This step is optional). By default, MessageSave exports Calendar items from your default mailbox or PST. If you would like to export a different Calendar folder, simply open that folder in Outlook first.
    2. Invoke the following menu command - "Tools -> MessageSave -> Apple Mac Export -> Export Calendar".
    3. That's it. MessageSave will export all your appointments into an iCalendar (.ics) file.

    Kindly mark this as answer if it fulfill your requirements. Thanks.


    Regards, Riaz Javed Butt Consultant Microsoft Professional Services MCITP, MCITP (Exchange), MCSE: Messaging, MCITP Office 365

    Friday, February 28, 2014 1:34 PM
  • Hello Riaz,

    thank you for you're reply.

    My question is if it is possible to create an ics file from a users calendar over the EWS API. Not through Outlook. I want to export all the User Calendars from our Organisation with impersonating.

    Is there a way to do this programaticaly?

    We have an Exchange Server 2010 with SP3.

    Regards

    Ioannis

    Friday, February 28, 2014 3:15 PM
  • Exchange will return a VCalendar version of the Appointment if you request the Mime Content eg

                FindItemsResults<Item> fiResults = null;
                ItemView ivItemView = new ItemView(1000);
                PropertySet psPropSet = new PropertySet(BasePropertySet.IdOnly);
                ivItemView.PropertySet = psPropSet;
                PropertySet mimePropSet = new PropertySet(BasePropertySet.IdOnly){ItemSchema.MimeContent,ItemSchema.Subject};
                do
                {
                    fiResults = service.FindItems(WellKnownFolderName.Calendar, ivItemView);
                    if (fiResults.Items.Count > 0) {
                        service.LoadPropertiesForItems(fiResults.Items, mimePropSet);
                        foreach (Item itItem in fiResults.Items) {
                            String FileName = "c:\\temp\\" + Guid.NewGuid().ToString() + ".ical";
                            MimeContent  mcMimeContent = null;
                            if (itItem.TryGetProperty(ItemSchema.MimeContent, out mcMimeContent))
                            {
                                File.WriteAllBytes(FileName, mcMimeContent.Content);
                            }
                        }
                    }
    
                } while (fiResults.MoreAvailable);

    I wouldn't however recommend you use this as a backup because it doesn't give you full fidelity on the appointment data eg things like attendees and other properties aren't included in you'll experience data loss.

    If you want to backup calendar appointments the best method is to use the New-MailboxExportRequest eg

    New-MailboxExportRequest -Mailbox Mailbox -IncludeFolders "#Calendar#"

    Cheers
    Glen

    Monday, March 3, 2014 5:50 AM