Created
April 15, 2025 11:31
-
-
Save aspose-com-gists/f46c6ab786eb5c9bf009c29d9625b555 to your computer and use it in GitHub Desktop.
Managing Reference Attachments in MSG Files Using C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var options = new ReferenceAttachmentOptions( | |
"https://drive.google.com/file/d/1HJ-M3F2qq1oRrTZ2GZhUdErJNy2CT3DF/", // Attachment URL | |
"https://drive.google.com/drive/my-drive", // Provider link | |
"GoogleDrive" // Provider type | |
); | |
// Add reference attachment | |
msg.Attachments.Add("Document.pdf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var msg = MapiMessage.Load(@"message.msg"); | |
foreach (var attachment in msg.Attachments) | |
{ | |
if (attachment.IsReference) | |
{ | |
// Process reference attachment | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var msg = MapiMessage.Load(@"message.msg"); | |
foreach (var attachment in msg.Attachments) | |
{ | |
if (attachment.IsReference) | |
{ | |
var originalUrl = attachment.GetProperty(KnownPropertyList.AttachmentOriginalUrl).GetString(); | |
var providerType = attachment.GetProperty(KnownPropertyList.AttachmentProviderType).GetString(); | |
var longPathname = attachment.GetProperty(KnownPropertyList.AttachLongPathname).GetString(); | |
var attachMethod = attachment.GetProperty(KnownPropertyList.AttachMethod).GetLong(); | |
Console.WriteLine($"Original URL: {originalUrl}"); | |
Console.WriteLine($"Provider Type: {providerType}"); | |
Console.WriteLine($"Long Pathname: {longPathname}"); | |
Console.WriteLine($"Attach Method: {attachMethod}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment