대화 항목 관리
Contents
[
Hide
]
Aspose.Email for Java는 Exchange Server에서 대화 항목을 관리하는 데 사용할 수 있습니다. EWSClient 클래스. 이 클래스는 Exchange Web Services를 사용하며, 이는 Exchange Server 2007 이후 버전에서만 사용할 수 있습니다. 이 문서는 방법을 보여줍니다. find, copy, move 및 delete Exchange Server 2010의 대화 항목. 이 섹션에 포함된 모든 기능을 사용하려면 Microsoft Exchange Server 2010 Service Pack 1이 필요합니다.
대화 찾기
Exchange Server의 특정 폴더에서 대화 정보를 가져오려면:
- IEWSClient 클래스를 사용하여 Exchange Server에 연결합니다.
- 폴더에서 모든 대화 항목을 찾으려면 IEWSClient.findConversations() 메서드를 호출합니다.
- ID, 대화 주제 및 플래그 상태와 같은 대화 항목 속성을 표시합니다.
다음 코드 조각은 대화를 찾는 방법을 보여줍니다.
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);
System.out.println("Connected to Exchange 2010");
// Find Conversation Items in the Inbox folder
ExchangeConversation[] conversations = client.findConversations(client.getMailboxInfo().getInboxUri());
// Show all conversations
for (ExchangeConversation conversation : conversations) {
// Display conversation properties like Id and Topic
System.out.println("Topic: " + conversation.getConversationTopic());
System.out.println("Flag Status: " + conversation.getFlagStatus());
System.out.println();
}
대화 복사
대화를 한 폴더에서 다른 폴더로 복사하려면:
- IEWSClient 클래스를 사용하여 Exchange Server에 연결합니다.
- 대화 항목을 원본 폴더에서 대상 폴더로 복사하려면 IEWSClient.copyConversationItems() 메서드를 호출합니다.
다음 코드 조각은 대화를 복사하는 방법을 보여줍니다.
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);
System.out.println("Connected to Exchange 2010");
// Find those Conversation Items in the Inbox folder which we want to copy
ExchangeConversation[] conversations = client.findConversations(client.getMailboxInfo().getInboxUri());
for (ExchangeConversation conversation : conversations) {
System.out.println("Topic: " + conversation.getConversationTopic());
// Copy the conversation item based on some condition
if (conversation.getConversationTopic().contains("test email")) {
client.copyConversationItems(conversation.getConversationId(), client.getMailboxInfo().getDeletedItemsUri());
System.out.println("Copied the conversation item to another folder");
}
}
대화 이동
대화를 한 폴더에서 다른 폴더로 이동하려면:
- IEWSClient 클래스를 사용하여 Exchange Server에 연결합니다.
- 대화를 원본 폴더에서 대상 폴더로 이동하려면 IEWSClient.moveConversationItems() 메서드를 호출합니다.
다음 코드 조각은 대화를 이동하는 방법을 보여줍니다.
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);
System.out.println("Connected to Exchange 2010");
// Find those Conversation Items in the Inbox folder which we want to move
ExchangeConversation[] conversations = client.findConversations(client.getMailboxInfo().getInboxUri());
for (ExchangeConversation conversation : conversations) {
System.out.println("Topic: " + conversation.getConversationTopic());
// Move the conversation item based on some condition
if (conversation.getConversationTopic().contains("test email") == true) {
client.moveConversationItems(conversation.getConversationId(), client.getMailboxInfo().getDeletedItemsUri());
System.out.println("Moved the conversation item to another folder");
}
}
대화 삭제
폴더에서 대화를 삭제하려면:
- IEWSClient 클래스를 사용하여 Exchange Server에 연결합니다.
- 원본 폴더에서 대화 항목을 삭제하려면 IEWSClient.deleteConversationItems() 메서드를 호출합니다.
다음 코드 조각은 대화를 삭제하는 방법을 보여줍니다.
IEWSClient client = EWSClient.getEWSClient(mailboxUri, credentials);
System.out.println("Connected to Exchange 2010");
// Find those Conversation Items in the Inbox folder which we want to delete
ExchangeConversation[] conversations = client.findConversations(client.getMailboxInfo().getInboxUri());
for (ExchangeConversation conversation : conversations) {
System.out.println("Topic: " + conversation.getConversationTopic());
// Delete the conversation item based on some condition
if (conversation.getConversationTopic().contains("test email") == true) {
client.deleteConversationItems(conversation.getConversationId());
System.out.println("Deleted the conversation item");
}
}