0 votes

Hi, I can't get the Calendar attachment from an Exchange/Office 365 IMAP account?

It seems like Mail.dll doesn't find the vCalendar attachment? My code works fine if its not an Exchange account.

Is this a known issue?

I create a calendar invite in Outlook using Exchange (Office 365) and then sends it to another Exchange account, and then I want my app to log in to that other account and get the calendar attachment, but it never finds it?

But it works if I send it to another mail server like the live.com mail and the log in there to get the calendar attachment with Mail.dll??

Thanks, Jonas

by (350 points)

1 Answer

0 votes

There are no known issues in Mail.dll

Please check IMail.Appointments collection, iCal appointments should be put there.

If your appointment is not there we need to see the email itself (as it is returned by the server): https://www.limilabs.com/blog/i-have-problems-parsing-the-message

But it works if I send it to another mail server like the live.com

There is a good chance that Office 365 is modifying your message somehow.

[Edit]

Following PowerShell script changes how Exchange is treating iCal appointments (see mediamastery comment below):

$Cred = Get-credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection
Set-ExecutionPolicy RemoteSigned
Import-PSSession $Session
Set-CASMailbox –identity name@domain.com –PopForceICalForCalendarRetrievalOption:$TRUE –ImapForceICalForCalendarRetrievalOption:$TRUE
by (300k points)
Now I do:

                    var eml = imap.GetMessageByUID(uid);
                    IMail email = new MailBuilder().CreateFromEml(eml);

                    foreach (Appointment appointment in email.Appointments)
                    ...
and email.Appointments return Count=0.

I send the appointment with another O365 Exchange account. But when I for example send from a Google Calendar it finds the appointment attachment?

Yes the email is there because I get the Unseen flag and I get the right email, but can it be that O365 removes the appointment or convert it somehow into an Exchange appointment so its not an attachment anymore?

Thanks, Jonas
Please show/look at the downloaded email content. Does it contain the appointment or not? Does it contain any attachments? If IMail.Appointments is empty most likely the appointment is missing.
Well when I send from Google Calendar I can see the attachment in the mail in Outlook. But when I send from another Exchange account it seems like it's converted somehow to a Appointment invitation email, it doesn't look like a normal e-mail.

Received: from DBXPR03MB448.eurprd03.prod.outlook.com (10.141.11.152) by
 AM3PR03MB436.eurprd03.prod.outlook.com (10.242.108.27) with Microsoft SMTP
 Server (TLS) id 15.1.31.17 via Mailbox Transport; Sun, 7 Dec 2014 20:14:30
 +0000
Received: from DB3PR03MB0681.eurprd03.prod.outlook.com (10.255.184.150) by
 DBXPR03MB448.eurprd03.prod.outlook.com (10.141.11.152) with Microsoft SMTP
 Server (TLS) id 15.1.26.15; Sun, 7 Dec 2014 20:14:29 +0000
Received: from DB3PR03MB0681.eurprd03.prod.outlook.com ([10.255.184.150]) by
 DB3PR03MB0681.eurprd03.prod.outlook.com ([10.255.184.150]) with mapi id
 15.01.0026.003; Sun, 7 Dec 2014 20:14:29 +0000
Content-Type: application/ms-tnef; name="winmail.dat"
Content-Transfer-Encoding: binary
From: Jonas Kjellin <jonas@conversationcloud.se>
To: Conversation Cloud <cc@conversationcloud.se>, "jonas@kjellin.com"
    <jonas@kjellin.com>
Subject: =?utf-8?B?U8O2bmRhZyBpZ2Vu?=
Thread-Topic: =?utf-8?B?U8O2bmRhZyBpZ2Vu?=
Thread-Index: AdASWl5OGzRNGPSrRrScoU99/S93FwAAAiBQ
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-Exchange-Calendar-Originator-Id: 5a966f64-1a8f-411c-aa9f-b400dd05cc88;/o=ExchangeLabs/ou=Exchange
 Administrative Group
 (FYDIBOHF23SPDLT)/cn=Recipients/cn=10b3d234c0f848248f9b1275c5766888-jonas
Date: Sun, 7 Dec 2014 20:14:28 +0000
Message-ID: <DB3PR03MB068193D3B8B5340EC9565BD3C7670@DB3PR03MB0681.eurprd03.prod.outlook.com>
Accept-Language: sv-SE, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator: <DB3PR03MB068193D3B8B5340EC9565BD3C7670@DB3PR03MB0681.eurprd03.prod.outlook.com>
MIME-Version: 1.0
X-MS-Exchange-Organization-MessageDirectionality: Originating
X-MS-Exchange-Organization-AuthSource: DB3PR03MB0681.eurprd03.prod.outlook.com
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 04
X-Originating-IP: [83.251.104.28]
X-MS-Exchange-Organization-Network-Message-Id: 4c0d98a8-01cd-47c2-7e86-08d1e0718a3f
Return-Path: jonas@conversationcloud.se
X-Microsoft-Antispam: UriScan:;
X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DBXPR03MB448;
X-MS-Exchange-Organization-AVStamp-Service: 1.0
X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(603002)(6)(7);SRVR:DBXPR03MB448;
X-Forefront-Antispam-Report: SFV:SKI;SFS:;DIR:INB;SFP:;SCL:-1;SRVR:DBXPR03MB448;H:DB3PR03MB0681.eurprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;
X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:DBXPR03MB448;
X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.8493311
Those are only email headers. It seems that indeed Office365 (Exchange) modified the message. Mail.dll can process winmail.dat files. I assume that the appointment is in the Attachments collection. Please zip the eml file and send it us. You can find the support email on the bottom of this page.
The email you send to us has Content-Type: text/html, so it is a different email, then the headers you shown above. It doesn't contain any icalendar data. Just HTML.

Furthermore it explains what to do to receive ical appointments:

"To receive meeting invitations as .iCalendar attachments instead of Outlook Web App links, go to https://outlook.office365.com/owa/conversationcloud.se/?path=/options/popandimap and select Send meeting invitations in iCalendar format."
Unfortunately this link doesn't work, or more specific, this setting doesn't exist in OWA anymore it seems. Although its probably correct that when sending from Exchange to Exchange Office 365 will not create a iCalendar attachment by default. It seems like the only way to set this setting is to use some PowerShell commands, or any other idea?

Thanks
Finally got it to work now, hade to change the setting with PowerShell, if someone else is interested, here are the commands:

$Cred = Get-credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection
Set-ExecutionPolicy RemoteSigned
Import-PSSession $Session
Set-CASMailbox –identity name@domain.com –PopForceICalForCalendarRetrievalOption:$TRUE –ImapForceICalForCalendarRetrievalOption:$TRUE
...