|
| virtual System::String | get_ItemId () |
| | The item id, uses with a server More...
|
| |
| virtual void | set_ItemId (System::String value) |
| | The item id, uses with a server More...
|
| |
| virtual bool | get_IsInline () |
| | Gets a value indicating whether the attachment is inline or regular. If inline returns true, otherwise false. More...
|
| |
| bool | get_IsReference () |
| | Gets a value indicating whether the attachment is stored as a reference rather than being embedded in the email. More...
|
| |
| System::String | get_Extension () |
| | Gets a filename extension that indicates the document type of an attachment. More...
|
| |
| System::SharedPtr< MapiPropertyStream > | get_PropertyStream () |
| | Gets the property stream. More...
|
| |
| System::SharedPtr< MapiPropertyCollection > | get_SubStorages () |
| | Gets the sub storages. More...
|
| |
| System::String | get_FileName () |
| | Gets an attachment's base filename and extension, excluding path. More...
|
| |
| System::String | get_LongFileName () |
| | Gets an attachment's long filename and extension, excluding path. More...
|
| |
| System::String | get_DisplayName () |
| | Gets the display name of the ole object in an attachment. More...
|
| |
| void | set_DisplayName (System::String value) |
| | Gets the display name of the ole object in an attachment. More...
|
| |
| System::String | get_MimeTag () |
| | Gets formatting information about a Multipurpose Internet Mail Extensions (MIME) attachment. More...
|
| |
| System::ArrayPtr< uint8_t > | get_BinaryData () |
| | Gets binary attachment data. More...
|
| |
| void | set_BinaryData (System::ArrayPtr< uint8_t > value) |
| | Sets binary attachment data. More...
|
| |
| System::SharedPtr< System::Object > | get_Content () |
| | Gets the content. More...
|
| |
| System::String | get_ContentId () |
| |
| System::SharedPtr< MapiObjectProperty > | get_ObjectData () |
| | Gets an attachment object typically accessed through the OLE IStorage interface. More...
|
| |
| System::SharedPtr< MapiPropertyCollection > | get_NamedProperties () |
| | Gets the named properties of message. More...
|
| |
| bool | get_Hidden () |
| |
| | MapiAttachment () |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::String itemId, System::String attachName, System::ArrayPtr< uint8_t > attachData, int32_t count) |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::String itemId, System::String attachName, System::ArrayPtr< uint8_t > attachData, System::String mediaType, int32_t count) |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::String attachName, System::ArrayPtr< uint8_t > attachData, int32_t count, OutlookMessageFormat format, bool preserveDates, int32_t codePage) |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::String attachName, System::SharedPtr< MapiMessageItemBase > attachMsg, int32_t count, OutlookMessageFormat format, bool preserveDates, int32_t codePage) |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::String attachName, System::String attachContentId, System::ArrayPtr< uint8_t > attachData, int32_t count, OutlookMessageFormat format, bool preserveDates) |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::String attachName, System::SharedPtr< MapiMessage > attachMsg, int32_t count, OutlookMessageFormat format, bool preserveDates) |
| | Initializes a new instance of the MapiAttachment class. More...
|
| |
| | MapiAttachment (System::SharedPtr< ReferenceAttachment > refAttach, int32_t codePage, int32_t count, OutlookMessageFormat format, bool preserveDates) |
| |
| void | SetNamedPropertyMapping (System::SharedPtr< MapiNamedPropertyMappingStorage > value) |
| | Sets the named property mapping. More...
|
| |
| void | SaveToTnef (System::String filename) |
| | Save attachment to tnef content. More...
|
| |
| void | SaveToTnef (System::SharedPtr< System::IO::Stream > stream) |
| | Save attachment to tnef content. More...
|
| |
| void | SaveToTnefInternal (System::SharedPtr< System::IO::Stream > stream) |
| |
| void | Save (System::String filename) |
| | Save attachment content. More...
|
| |
| void | Save (System::SharedPtr< System::IO::Stream > stream) |
| | Save attachment content. More...
|
| |
| void | SaveInternal (System::SharedPtr< System::IO::Stream > stream) |
| | Save attachment content. More...
|
| |
| void | SetProperty (System::SharedPtr< MapiProperty > value) override |
| | Sets the property. More...
|
| |
| void | RemoveProperty (int64_t tag) |
| | Provides correctly removing property from all collections. More...
|
| |
| System::SharedPtr< Nodes::IMapiNode > | CreateMapiNode (System::String key) override |
| | Creates the mapi node. More...
|
| |
| void | SetOwner (System::SharedPtr< MapiMessageItemBase > owner) |
| | Sets the owner. More...
|
| |
| int32_t | GetSize () |
| | Gets the size of the attachment. Contains the sum, in bytes, of the sizes of all properties on an attachment. The sum contained in PR_ATTACH_SIZE property includes the size of the PR_ATTACH_DATA_BIN or PR_ATTACH_DATA_OBJ property. More...
|
| |
| System::SharedPtr< MapiAttachment > | Clone () |
| |
| System::SharedPtr< System::IO::MemoryStream > | ToMemoryStream () |
| |
| System::SharedPtr< MapiMessage > | ToMapiMessage () |
| |
| System::SharedPtr< MapiProperty > | GetProperty (System::SharedPtr< PropertyDescriptor > pd) override |
| | Gets MAPI property by property descriptor. More...
|
| |
| bool | TryGetNamedProperty (System::SharedPtr< MapiProperty > mapiProperty, System::SharedPtr< MapiNamedProperty > &mapiNamedProperty) override |
| | If MapiNamedPropertyMappingStorage is available, initializes and returns MapiNamedProperty, otherwise null. More...
|
| |
| void | SetProperty (System::SharedPtr< PropertyDescriptor > pd, System::SharedPtr< System::Object > value) override |
| | Sets MAPI property. More...
|
| |
| virtual System::SharedPtr< MapiPropertyCollection > | get_Properties () |
| | Gets the collection of properties. More...
|
| |
| virtual int32_t | get_CodePage () |
| | Gets the code page. More...
|
| |
| System::SharedPtr< System::Text::Encoding > | get_CurrentEncoding () |
| |
| | MapiPropertyContainer () |
| | Initializes a new instance of the MapiPropertyContainer class. More...
|
| |
| | MapiPropertyContainer (System::SharedPtr< MapiPropertyCollection > properties) |
| | Initializes a new instance of the MapiPropertyContainer class. More...
|
| |
| System::SharedPtr< MapiPropertyCollection > | GetSubStorages () |
| |
| System::String | TryGetPropertyString (int64_t tag, int32_t codepage) |
| | Try to get a property data as string with specified tag and code page. More...
|
| |
| System::ArrayPtr< uint8_t > | TryGetPropertyData (int64_t tag) |
| | Try to get the property data with specified tag key. More...
|
| |
| System::String | TryGetPropertyString (int64_t tag) |
| | Try to get a property data as string with specified tag. More...
|
| |
| System::String | GetPropertyString (int64_t tag, int32_t codepage) |
| | Gets the string value of the property specified by tag. More...
|
| |
| System::String | GetPropertyString (int64_t tag) |
| | Gets the string value of the property specified by tag. More...
|
| |
| System::ArrayPtr< uint8_t > | GetPropertyBytes (int64_t tag) |
| | Gets the string value of the property specified by tag. More...
|
| |
| System::Nullable< int32_t > | GetPropertyInt32 (int64_t tag) |
| | Gets the int32 value of the property specified by tag. More...
|
| |
| System::Nullable< int64_t > | GetPropertyLong (int64_t tag) |
| | Gets the value of the property specified by tag as Long (int64) type. More...
|
| |
| System::Nullable< int16_t > | GetPropertyShort (int64_t tag) |
| | Gets the value of the property specified by tag as Short type. More...
|
| |
| System::Nullable< bool > | GetPropertyBoolean (int64_t tag) |
| | Gets the value of the property specified by tag as Boolean type. More...
|
| |
| System::Nullable< System::DateTime > | GetPropertyDateTime (int64_t key) |
| | Gets the value of the property specified by tag as DateTime type. More...
|
| |
| bool | IsStoreUnicodeOk () |
| | Determines if string properties are Unicode encoded or not. More...
|
| |
| bool | TryGetPropertyString (int64_t tag, System::String &value, int32_t codepage) |
| | Gets the value of the specified property as String type. A return value indicates whether the operation succeeded. More...
|
| |
| bool | TryGetPropertyString (int64_t tag, System::String &value) |
| | Gets the value of the specified property as String type. A return value indicates whether the operation succeeded. More...
|
| |
| bool | TryGetPropertyDateTime (int64_t tag, System::DateTime &value) |
| | Gets the value of the specified property as DateTime type. A return value indicates whether the operation succeeded. More...
|
| |
| bool | TryGetPropertyLong (int64_t tag, int64_t &value) |
| | Gets the value of the specified property as Long type. A return value indicates whether the operation succeeded. More...
|
| |
| bool | TryGetPropertyInt32 (int64_t tag, int32_t &value) |
| | Gets the value of the specified property as Int32 type. A return value indicates whether the operation succeeded. More...
|
| |
| void | SetProperty (int64_t tag, System::ArrayPtr< uint8_t > data) |
| | Set the property. More...
|
| |
| void | SetProperty (int64_t tag, System::String value, OutlookMessageFormat format) |
| | Set the string property. More...
|
| |
| void | SetProperty (int64_t tag, System::String value, bool isUnicode) |
| | Set the string property. More...
|
| |
| void | SetProperty (int64_t tag, System::String value, System::SharedPtr< System::Text::Encoding > nonUnicodeEncoding) |
| | Set the string property. More...
|
| |
| void | SetProperty (int64_t tag, System::String value) |
| | Set the string property with CurrentEncoding More...
|
| |
| void | SetProperty (int64_t tag, System::DateTime dateTime) |
| | Set the datetime property. More...
|
| |
| void | SetPropertyLong (int64_t tag, int64_t value) |
| | Set the long property. More...
|
| |
Represents a message attachment.
This class encapsulates an attachment, providing methods to access and manipulate its properties.
This code example loads a message from a file and iterates over each attachment. If an attachment is inline, it prints its display name. If not, it checks if the attachment is an embedded message. If so, it saves the attachment to a memory stream. If not, it saves to a specified path.
[C#]
var msg = MapiMessage.Load("source.msg");
foreach (var mapiAttachment in msg.Attachments)
{
if (mapiAttachment.IsInline)
{
Console.WriteLine($"Inline: {mapiAttachment.DisplayName}");
}
else
{
if (mapiAttachment.ObjectData != null && mapiAttachment.ObjectData.IsOutlookMessage)
{
using (MemoryStream ms = new MemoryStream())
{
mapiAttachment.Save(ms);
ms.Position = 0;
var embeddedMessage = MapiMessage.Load(ms);
}
}
else
{
mapiAttachment.Save(Path.Combine(path, mapiAttachment.LongFileName));
}
}
}
[Visual Basic]
' Load the MAPI message from the specified file
Dim msg = MapiMessage.Load("source.msg")
' Iterate over each attachment in the MAPI message
For Each mapiAttachment In msg.Attachments
' Check if the attachment is inline
If mapiAttachment.IsInline Then
' If inline, print its display name
Console.WriteLine($"Inline: {mapiAttachment.DisplayName}")
Else
' If not inline
' Check if the attachment contains an embedded message
If mapiAttachment.ObjectData IsNot Nothing AndAlso mapiAttachment.ObjectData.IsOutlookMessage Then
' If it's an embedded message
' Save the attachment to a memory stream
Using ms As New MemoryStream()
mapiAttachment.Save(ms)
ms.Position = 0
' Load the embedded message from the memory stream
Dim embeddedMessage = MapiMessage.Load(ms)
Else
' If it's not an embedded message
' Save the attachment to the specified path
mapiAttachment.Save(Path.Combine(path, mapiAttachment.LongFileName))
End If
End If
Next