public class MapiAttachmentCollection extends List<MapiAttachment>
Represents a collection of MapiAttachment objects.
| Constructor and Description |
|---|
MapiAttachmentCollection()
Initializes a new instance of the
MapiAttachmentCollection class. |
MapiAttachmentCollection(MapiMessageItemBase owner)
Initializes a new instance of the MapiAttachmentCollection class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String name,
byte[] data)
Adds the new attachment.
|
void |
add(String name,
MapiMessage msg)
Adds the new attachment as embedded message.
|
void |
add(String name,
String sharedLink,
String url,
String providerName)
Adds the reference attachment.
|
void |
addMapiAttachment(MapiAttachment item)
Adds an object to the end of the
System.Collections.ObjectModel.Collection`1. |
void |
insert(int index,
String name,
MapiMessage msg)
Inserts a message as attachment into the
MapiAttachmentCollection at the specified index. |
void |
insertMapiAttachment(int index,
MapiAttachment item)
Inserts an element into the
System.Collections.ObjectModel.Collection`1 at the specified index. |
void |
removeAt(int index)
Removes the element at the specified index of the MapiAttachmentCollection.
|
boolean |
removeMapiAttachment(MapiAttachment item)
Removes the first occurrence of a specific object from the MapiAttachmentCollection.
|
void |
replace(int index,
String name,
MapiMessage msg)
Replaces an element at the specified index.
|
add, add, addAll, addAll, addItem, addRange, addRange, asReadOnly, binarySearch, binarySearch, binarySearch, clear, contains, containsAll, containsItem, convertAll, copyTo, copyTo, copyTo, copyToTArray, exists, find, findAll, findIndex, findIndex, findIndex, findLast, findLastIndex, findLastIndex, findLastIndex, forEach, fromJava, get_Item, get, getCapacity, getRange, getSyncRoot, getVersion, indexOf, indexOf, indexOf, indexOfItem, insertItem, insertRange, isEmpty, isFixedSize, isReadOnly, isSynchronized, iterator, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAll, removeItem, removeRange, retainAll, reverse, reverse, set_Item, set, setCapacity, size, sort, sort, sort, sort, subList, toArray, toArray, toJava, trimExcess, trueForAllpublic MapiAttachmentCollection()
Initializes a new instance of the MapiAttachmentCollection class.
public MapiAttachmentCollection(MapiMessageItemBase owner)
Initializes a new instance of the MapiAttachmentCollection class.
owner - The owner message.public final void add(String name, MapiMessage msg)
Adds the new attachment as embedded message.
name - The name of attachment.msg - The MapiMessage that represents the attached message.ArgumentNullException - throws if message is null.public final void add(String name, byte[] data)
Adds the new attachment.
name - The name of attachment.data - The attachment data.ArgumentNullException - throws if attachment name is null or empty.ArgumentNullException - throws if attachment data is null.public final void add(String name, String sharedLink, String url, String providerName)
Adds the reference attachment.
<p>This example demonstrates how to add a reference attachment to a message.</p>[C#]
// Let's say you want to send an email message that includes a link to a Document.pdf file stored on a Google Drive. // Instead of attaching the document directly to the email message, // you can create a reference attachment that links to the file on the Google Drive. // Create a message var msg = new MapiMessage("from@domain.com", "to@domain.com", "Outlook message file", "This message is created by Aspose.Email", OutlookMessageFormat.Unicode); // Add reference attachment msg.Attachments.Add("Document.pdf", "https://drive.google.com/file/d/1HJ-M3F2qq1oRrTZ2GZhUdErJNy2CT3DF/", "https://drive.google.com/drive/my-drive", "GoogleDrive"); //Also, you can set additional attachment properties msg.Attachments[0].SetProperty(KnownPropertyList.AttachmentPermissionType, AttachmentPermissionType.AnyoneCanEdit); msg.Attachments[0].SetProperty(KnownPropertyList.AttachmentOriginalPermissionType, 0); msg.Attachments[0].SetProperty(KnownPropertyList.AttachmentIsFolder, false); msg.Attachments[0].SetProperty(KnownPropertyList.AttachmentProviderEndpointUrl, ""); msg.Attachments[0].SetProperty(KnownPropertyList.AttachmentPreviewUrl, ""); msg.Attachments[0].SetProperty(KnownPropertyList.AttachmentThumbnailUrl, ""); // Finally save the message msg.Save(@"my.msg");[Visual Basic]
' Let's say you want to send an email message that includes a link to a Document.pdf file stored on a Google Drive. ' Instead of attaching the document directly to the email message, ' you can create a reference attachment that links to the file on the Google Drive. ' Create a message Dim msg As New MapiMessage("from@domain.com", "to@domain.com", "Outlook message file", "This message is created by Aspose.Email", OutlookMessageFormat.Unicode) ' Add reference attachment msg.Attachments.Add("Document.pdf", "https://drive.google.com/file/d/1HJ-M3F2qq1oRrTZ2GZhUdErJNy2CT3DF/", "https://drive.google.com/drive/my-drive", "GoogleDrive") ' Also, you can set additional attachment properties msg.Attachments(0).SetProperty(KnownPropertyList.AttachmentPermissionType, AttachmentPermissionType.AnyoneCanEdit) msg.Attachments(0).SetProperty(KnownPropertyList.AttachmentOriginalPermissionType, AttachmentPermissionType.None) msg.Attachments(0).SetProperty(KnownPropertyList.AttachmentIsFolder, False) msg.Attachments(0).SetProperty(KnownPropertyList.AttachmentProviderEndpointUrl, "") msg.Attachments(0).SetProperty(KnownPropertyList.AttachmentPreviewUrl, "") msg.Attachments(0).SetProperty(KnownPropertyList.AttachmentThumbnailUrl, "") ' Finally save the message msg.Save("my.msg")
name - The name of attachment.sharedLink - A fully qualified shared link to the attachment provided by web service manipulating the attachment.url - A file location.providerName - A name of reference attachment provider.
ArgumentNullException - throws if attachment name is null or empty.ArgumentNullException - throws if attachment shared link is null or empty.public final void addMapiAttachment(MapiAttachment item)
Adds an object to the end of the System.Collections.ObjectModel.Collection`1.
item - The object to be added to the end of the System.Collections.ObjectModel.Collection`1. The value can be null for reference types.public final void insertMapiAttachment(int index,
MapiAttachment item)
Inserts an element into the System.Collections.ObjectModel.Collection`1 at the specified index.
index - The zero-based index at which item should be inserted.item - The object to insert. The value can be null for reference types.ArgumentOutOfRangeException - index is less than zero.
-or-
index is greater than P:System.Collections.ObjectModel.Collection`1.Count.public final void insert(int index,
String name,
MapiMessage msg)
Inserts a message as attachment into the MapiAttachmentCollection at the specified index.
index - The zero-based index at which should be inserted.name - The name of attachment.msg - The MapiMessage that represents the attached message.ArgumentNullException - throws if message is null.public final void replace(int index,
String name,
MapiMessage msg)
Replaces an element at the specified index.
index - The zero-based index at which should be replaced.name - The name of attachment.msg - The MapiMessage that represents the attached message.ArgumentNullException - throws if message is null.public final void removeAt(int index)
Removes the element at the specified index of the MapiAttachmentCollection.
removeAt in interface IGenericList<MapiAttachment>removeAt in class List<MapiAttachment>index - he zero-based index of the element to remove.public final boolean removeMapiAttachment(MapiAttachment item)
Removes the first occurrence of a specific object from the MapiAttachmentCollection.
item - The object to remove from the MapiAttachmentCollection.Copyright (c) 2008-2024 Aspose Pty Ltd. All Rights Reserved.