I’m trying to add a ReferenceAttachment to a MapiMessage object. I do not see any properties corresponding to a ReferenceAttachment in MapiPropertyTag or KnownPropertyList.
Could you please let me know how I can set
AttachmentOriginalUrl,
ProviderType,
ProviderEndpointUrl,
AttachmentThumbnailUrl,
AttachmentPreviewUrl,
PermissionType,
OriginalPermissionType,
AttachmentIsFolder
on a MapiAttachment.
For reference:
Microsoft implementation of ReferenceAttachment:
Unfortunately, we didn’t find any documentation describing these properties. But we created a test message with Reference Attachment in Outlook, and checked it. Here is the code to set these properties:
var attachmentOriginalUrlPropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentOriginalUrl", PropertyDataType.String,
KnownPropertySets.Attachment);
var attachmentProviderEndpointUrlPropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentProviderEndpointUrl", PropertyDataType.String,
KnownPropertySets.Attachment);
var attachmentProviderTypePropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentProviderType", PropertyDataType.String,
KnownPropertySets.Attachment);
var attachmentPermissionTypePropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentPermissionType", PropertyDataType.Integer32,
KnownPropertySets.Attachment);
var attachmentThumbnailUrlPropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentThumbnailUrl", PropertyDataType.String,
KnownPropertySets.Attachment);
var attachmentPreviewUrlPropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentPreviewUrl", PropertyDataType.String,
KnownPropertySets.Attachment);
var attachmentOriginalPermissionTypePropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentOriginalPermissionType", PropertyDataType.Integer32,
KnownPropertySets.Attachment);
var attachmentIsFolderPropertyDescriptor =
new PidNamePropertyDescriptor("AttachmentIsFolder", PropertyDataType.Boolean,
KnownPropertySets.Attachment);
attachment.SetProperty(attachmentOriginalUrlPropertyDescriptor, "https://testorg-my.sharepoint.com/personal/testorg_onmicrosoft_com/Documents/pic.jpg");
attachment.SetProperty(attachmentProviderTypePropertyDescriptor, "OneDrivePro");
attachment.SetProperty(attachmentPermissionTypePropertyDescriptor, 4);
attachment.SetProperty(attachmentOriginalPermissionTypePropertyDescriptor, 0);
attachment.SetProperty(attachmentIsFolderPropertyDescriptor, false);
I tried this, but the attachment does not show up on the outlook client. I am able to print out the proeprties on my command line using aspose mapi attachment object. But the attachment itself is not displayed in the outlook client.
Is there any other property that needs to be set for a reference attachment which is added as a mapi attachment?
NOTE: I am first creating the map attachment and then setting the properties as follows:
var mapiMessage = <some mapi message object>;
mapiMessage.Attachments.Add("fileName", new byte[]{});
// Set the properties as mentioned in your response.
But the outlook client is not showing the attachment.
@Srinidhi
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): EMAILNET-41011
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Create a simple project that does the following: creates or loads a MapiMessage, adds a reference attachment to it using our code sample from the release notes, finally, saves the MapiMessage to a file. Send this project to us for investigation.