Working with In-Place Archive
Contents
[
Hide
]
In-Place Archives in Office 365
In-Place Archives in Office 365 provides users with additional storage space. After the archive mailboxes are turned on, users can access and store messages in their Archive Mailbox by using Microsoft Outlook and Outlook on the Web. When the mailbox with In-Place archiving enabled is opened with Outlook, the archive mailbox is shown as a separate mailbox.
Move Items to In-Place Archive
Aspose.Email API can be used to move items into users archive mailbox by using the IEWSClient.ArchiveItem method. IEWSClient.ArchiveItem method provides four overloads which are listed below.
- ArchiveItem(string sourceFolderUri, Appointment appointment)
- ArchiveItem(string sourceFolderUri, ExchangeTask task)
- ArchiveItem(string sourceFolderUri, MapiMessageItemBase item)
- ArchiveItem(string sourceFolderUri, string uniqueId)
The code example given below demonstrates the use of IEWSClient.ArchiveItem method to move an email to the Archive Mailbox by using the UniqueUri.
This file contains hidden or 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
// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET | |
const string mailboxUri = "<HOST>"; | |
const string domain = @""; | |
const string username = @"<USERNAME>"; | |
const string password = @"<PASSWORD>"; | |
NetworkCredential credentials = new NetworkCredential(username, password, domain); | |
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials); | |
ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri); | |
foreach (ExchangeMessageInfo msgInfo in msgCollection) | |
{ | |
Console.WriteLine("Subject:" + msgInfo.Subject); | |
client.ArchiveItem(client.MailboxInfo.InboxUri, msgInfo.UniqueUri); | |
} | |
client.Dispose(); |