Discrepancy between attachment contentType and attachment names on different clients for item attachments - outlook-addin

When using the officejs api (v1.8), we're observing differences between item attachment metadata when using different clients when looking at the same email.
Outlook for Mac (v16.31 19111002)
- AttachmentDetails.name properties include the file suffix. E.g. (fileName).(eml, ics, vcf)
- AttachmentDetails.contentType returns correctly (message/rfc822, text/calendar, text/directory)
- AttachmentContent.format incorrectly returns .eml for all item attachment types
OWA (Chrome)
- AttachmentDetails.name properties does not include the file suffix
- AttachmentDetails.contentType incorrectly returns undefined
- AttachmentContent.format returns .(eml,iCalendar) as expected for all item attachment types
- This ONLY happens when viewing emails with item attachments sent from Outlook Desktop on Windows. Example build (1911 12228.20332)
What is the expected behavior when reading attachment metadata on different clients?
In addition as per this prior stackOverflow post, are there any plans to support getAttachmentContentAsync with contact item attachments?

Related

ItemId not valid after email sent

This SO question answers part of my question - when I save an email I can retrieve its ItemId but as soon as it's sent the ItemId is invalid and a request to to the Outlook rest api to retrieve the email returns a 404.
My question then is how do I subsequently identify the email I just sent if the ItemId is different?
You can stamp the message with your own custom property - it will be preserved when the message is moved to the Sent Items folder. You will be able to search on that property.

Exim - identify recipient BCC address

I'm using plus-addressing on Exim to create an automated system - I will process emails based on the local part of the address. So eg:
From: me#eximdomain.com
To: robot+project-4#eximdomain.com
This works well - I can process it based on the To address (specifically project-4). But ideally I want to be able to BCC an email to this address, eg:
From: me#eximdomain.com
To: somebody#otherdomain.com
Bcc: robot+project-4#eximdomain.com
When I am checking the mailbox for robot, I see the message, but nowhere in the header is the actual address that got it there, ie robot+project-4#eximdomain.com - so I cannot process it.
Obviously I do not want somebody#otherdomain.com to be aware of this address; but when robot#eximdomain.com receives it, I want to know that it was actually BCCd to robot+project-4#eximdomain.com (in some/any header).
Is there any way to do this?
Figured this out, if anyone comes across this: added this option to my local delivery transport (Dovecot LMTP in my case):
envelope_to_add = true
It then generates an Envelope-to header containing the incoming address.

Test Token for Outlook Add in - always returns null tags

I am trying to get test token validation working for an Outlook office add-in.
Decoded String:
VNNAnf36IrkyUVZlihQJNdUUZlYFEfJOeldWBtd3IM=
Encoded String:
%3Cr%3E%3Ct%20aid%3D%22WA900006056%22%20pid%3D%22bd1fedd2-ff5f-4b8e-ac48-c2b47ee0ce91%22%20oid%3D%223DBFC30C-DBE9-419E-A5FB-1DB48BEDEC1B%22%20did%3D%22xxxxxxx.onmicrosoft.com%22%20et%3D%22Trial%22%20ad%3D%222018-01-12T21%3A58%3A13Z%22%20sd%3D%222018-01-12T00%3A00%3A00Z%22%20te%3D%222018-06-30T02%3A49%3A34Z%22%20test%3D%221%22%20%2F%3E%3Cd%3EVNNAnf36IrkyUVZlihQJNdUUZlYFEfJOeldWBtd3IM%3D%3C%2Fd%3E%3C%2Fr%3E
No matter what and how I pass this to https://verificationservice.officeapps.live.com/ova/verificationagent.svc/rest/verify?token={token} it just does not return anything with any value populated.
It always return as below.
Response from Service
I am using the test token from this reference . https://learn.microsoft.com/en-us/office/dev/store/add-in-license-schema Is the documentation stale on the string format or am I missing anything? The documentation says 64 bit encoding is not required for Office Add-ins.
Can anyone give me a working test token for Outlook Add in.
The validation works if you include ts (even value 0). Taking your encoded token, decode it, and added "ts=0', and encode (using url encode). I get the following that validates:
https://verificationservice.officeapps.live.com/ova/verificationagent.svc/rest/verify?token=%3Cr%3E%3Ct+aid%3D%22WA900006056%22+pid%3D%22bd1fedd2-ff5f-4b8e-ac48-c2b47ee0ce91%22+oid%3D%223DBFC30C-DBE9-419E-A5FB-1DB48BEDEC1B%22+did%3D%22xxxxxxx.onmicrosoft.com%22+ts%3D%220%22+et%3D%22Trial%22+ad%3D%222018-01-12T21%3A58%3A13Z%22+sd%3D%222018-01-12T00%3A00%3A00Z%22+te%3D%222018-06-30T02%3A49%3A34Z%22+test%3D%221%22+%2F%3E%3Cd%3EVNNAnf36IrkyUVZlihQJNdUUZlYFEfJOeldWBtd3IM%3D%3C%2Fd%3E%3C%2Fr%3E
The documentation does indeed state that ts is not relevant for office addins and that needs an update. However, the above workaround (including ts) should unblock your testing
I updated the documentation at https://learn.microsoft.com/en-us/office/dev/store/add-in-license-schema and submitted a PR. The live topic will be updated soon. Thanks, lindalu-MSFT (lindalu#microsoft.com) Here is the correction:
ts Integer — representing the total number of users licensed to access this add-in, by this purchaser.
For add-ins that are site licensed, this value is 0.
This attribute applies to Office Add-ins. Include it in your code even if ts=0. (NOTE Previously, this topic incorrectly stated that ts does not apply to Office add-ins.)

Saving msg file attachment using EWS API

Hope someone can help. I am implementing a feature where you can choose an email attachment and save it within a database. The feature works fine with PDF etc but when it comes to MSG files it creates a ItemAttachment not a Fileattachment and does not give me the ability to get the content or content type.
I have found this post about saving messages as .eml but ideally as the email had an .msg attached this is what should be saved in the system. I have done some extensive searching but have come to a dead end.
I am using asp.net so answers in VB.net would be appreciated.
Thanks
EDIT: Sorry, I did not see you were using VB, for now I won't delete my post since it can still give you an idea of how to handle this, I know that when I struggled with this, my thought of process was just incorrect and the actual syntax was not a challenge.
I am fairly new to this website so excuse me if I am not formatting my answer correctly.
Assuming you already established your exchange connection, created a new ItemView, and retrieved all emails from your inbox, we will start off by creating a secondary list of emails, but we are only going to list the emails that contain an Item Attachment.
List<EmailMessage> emailsWithItemAttachment =
emails.Where(e => e.HasAttachments && e.Attachments[0] is ItemAttachment).ToList();
Now, we can loop only the emails with Item attachment(s)
foreach (EmailMessage emailMessage in emailsWithItemAttachment)
{
//Loads all emails with Item attachments as an item attachment
foreach (Attachment attachment in emailMessage.Attachments)
{
attachment.Load();
ItemAttachment itemAttachment = attachment as ItemAttachment;
if (itemAttachment == null) continue;
ItemAttachment itemattachment = attachment as ItemAttachment;
itemattachment.Load(new PropertySet(ItemSchema.Attachments));
//Loads the scanned Attachment as an Item Attachment
foreach (Attachment scannedAttachment in itemattachment.Item.Attachments)
{
scannedAttachment.Load();
//Loads all Item Attachments as File Attachments
FileAttachment fileAttachment = scannedAttachment as FileAttachment;
if (fileAttachment != null)
{
//All Done! Your attachment will be "fileAttachment", from here you can do whatever you want
}
}
}
}
I really hope this helps you, and again if anything is wrong about my answer please do not hesitate to edit and/or contact me!
When querying an ItemAttachment, add the MimeContentPropertyDefinition (sorry, don't remember the exact names and classes). Then your ItemAttachment will have that MimeContent property set - that's a text (MIME) that you can save to a file in UTF-8 encoding with .EML extension. MIME is a standard, so that .EML file can be opened by any mail client app.

Debugging K2 workflow - how to view data associated with error conditions?

I have a K2 Blackpearl workflow. In the workflow I populate a process data field with email addresses pulled from a SharePoint list. Using the Text - Join function with the SP List's SmartObject's GetList method for the values and a semi-colon for the separator.
In theory, this should produce a well-formatted string with multiple addresses for the "To" line of the E-mail event. However, I keep receiving a "The specified string is not in the form required for an e-mail address." at the point where the workflow should attempt to send an email.
I've tried using the string "john.doe#company.com;jane.dove#company.com;abc.def#company.com" directly and I've tried splitting the string on the semi-colons in the Activity's destination set. In the first case, there is one instance trying to send the email. In the second instance, the emails are resolved to users and though I select the "ActivityInstanceDestUserEmail" for the "To" line, I still get the error message.
We are using K2 Blackpearl 4.6 with a SharePoint 2010 farm configured strictly for Claims authentication. The users to which I wish to send the email have valid email addresses if resolved using the K2SPS provider, but when the emails are resolved into destination slots, they are resolved into accounts with the K2 provider. I'm guessing that this is the problem with my second method for sending the email. But the first, putting the whole string in the "To" line should have worked it is straight email addresses - no resolving to users is needed.
What am I doing wrong? Is there another way to accomplish this?
Changes in the configuration of our customer security provider, labelled "K2SPS" seem to have resolved the problem - at least for now.