การทำงานกับที่เก็บไว้ในตำแหน่ง (In-Place Archive)

In-Place Archives ใน Office 365

In-Place Archives ใน Office 365 ให้พื้นที่จัดเก็บเพิ่มเติมแก่ผู้ใช้. หลังจากเปิดใช้งานกล่องจดหมาย Archive แล้ว ผู้ใช้สามารถเข้าถึงและเก็บข้อความใน Archive Mailbox ของตนโดยใช้ Microsoft Outlook และ Outlook บนเว็บ. เมื่อเปิดกล่องจดหมายที่เปิดใช้งาน In-Place Archiving ด้วย Outlook, กล่องจดหมาย Archive จะแสดงเป็นกล่องจดหมายแยกต่างหาก.

ย้ายรายการไปยัง In-Place Archive

Aspose.Email API สามารถใช้เพื่อย้ายรายการไปยังกล่องจดหมาย Archive ของผู้ใช้โดยใช้ IEWSClient.archiveItem เมธอด. IEWSClient.archiveItem เมธอดให้ overload สี่แบบซึ่งระบุด้านล่าง.

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

ตัวอย่างโค้ดด้านล่างแสดงการใช้ของ IEWSClient.archiveItem เมธอดเพื่อย้ายอีเมลไปยังกล่องจดหมาย Archive โดยใช้ 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();