We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting properties of ReferenceAttachment on a MapiAttachment object

Hi,

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:

TIA.

Hello @Srinidhi,

Please, share your code sample for adding ReferenceAttachment.

Thank you.

var msg = // Some MapiMessage object;
msg.Attachments.Add(“test-name”, new byte[]{});
attach = msg.Attachments.last();

attach.SetProperty(
KnownPropertyList.AttachContentId,
refAttachment.ContentId
);
attach.SetProperty(
KnownPropertyList.ContentType,
refAttachment.ContentType
);
attach.SetProperty(
KnownPropertyList.AttachContentLocation,
refAttachment.ContentLocation
);
attach.SetProperty(
KnownPropertyList.LastModificationTime,
refAttachment.LastModifiedTime
);
attach.SetProperty(
KnownPropertyList.AttachLongPathname,
refAttachment.AttachLongPathName
);
/*
Need to add remaining properties here.
*/

@Srinidhi,

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);

Hi @margarita.samodurova,

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.

Sure, thanks for logging the issue.
Was the issue reproducible on your end?

@Srinidhi,

Yes, the problem has been reproduced. The above properties are not set for MapiAttachment.
Thank you.

Thanks for the confirmation @margarita.samodurova.
Is there a timeline to get this fixed and released?

@Srinidhi,

We’ll do our best to fix it by Release 23.4 (at the end of April).

Thank you.