Bekerja dengan Arsip In-Place

Arsip In-Place di Office 365

Arsip In-Place di Office 365 memberi pengguna ruang penyimpanan tambahan. Setelah arsip kotak surat diaktifkan, pengguna dapat mengakses dan menyimpan pesan di Arsip Kotak Surat mereka dengan menggunakan Microsoft Outlook dan Outlook di Web. Ketika kotak surat dengan arsip In-Place diaktifkan dibuka dengan Outlook, kotak arsip ditampilkan sebagai kotak surat terpisah.

Pindahkan Item ke Arsip In-Place

Aspose.Email API dapat digunakan untuk memindahkan item ke arsip kotak surat pengguna dengan menggunakan the IEWSClient.archiveItem metode. IEWSClient.archiveItem metode menyediakan empat overload yang tercantum di bawah ini.

  • archiveItem(String sourceFolderUri, Appointment appointment)
  • archiveItem(String sourceFolderUri, ExchangeTask task)
  • archiveItem(String sourceFolderUri, MapiMessageItemBase item)]
  • archiveItem(String sourceFolderUri, String uniqueId)

Contoh kode di bawah ini menunjukkan penggunaan IEWSClient.archiveItem metode untuk memindahkan email ke Arsip Kotak Surat dengan menggunakan UniqueUri.

NetworkCredential credentials = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);

ExchangeMessageInfoCollection msgCollection = client.listMessages(client.getMailboxInfo().getInboxUri());

for (ExchangeMessageInfo msgInfo : (Iterable<ExchangeMessageInfo>) msgCollection) {
    System.out.println("Subject:" + msgInfo.getSubject());
    client.archiveItem(client.getMailboxInfo().getInboxUri(), msgInfo.getUniqueUri());
}
client.dispose();