Làm việc với Lưu trữ tại chỗ

Lưu trữ tại chỗ trong Office 365

Lưu trữ tại chỗ trong Office 365 cung cấp cho người dùng không gian lưu trữ bổ sung. Sau khi bật hộp thư lưu trữ, người dùng có thể truy cập và lưu trữ tin nhắn trong Hộp thư Lưu trữ bằng Microsoft Outlook và Outlook trên Web. Khi hộp thư đã bật lưu trữ tại chỗ được mở bằng Outlook, hộp thư lưu trữ sẽ hiển thị như một hộp thư riêng biệt.

Di chuyển các mục vào Lưu trữ tại chỗ

Aspose.Email API có thể được dùng để di chuyển các mục vào hộp thư lưu trữ của người dùng bằng cách sử dụng IEWSClient.archiveItem phương thức. IEWSClient.archiveItem phương thức cung cấp bốn overload được liệt kê dưới đây.

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

Ví dụ mã dưới đây minh họa việc sử dụng IEWSClient.archiveItem phương thức để di chuyển email tới Hộp thư Lưu trữ bằng cách sử dụng 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();