ניהול פריטי שיחה
Contents
[
Hide
]
ניתן להשתמש ב‑Aspose.Email ל‑Java כדי לנהל את פריטי השיחה ב‑Exchange Server עם ה‑ EWSClient מחלקה. מחלקה זו משתמשת ב‑Exchange Web Services, זמינה רק ב‑Exchange Server 2007 וגרסאות מאוחרות יותר. מאמר זה מראה כיצד חיפוש, העתקה, העברה ו מחיקה פריטי שיחה ב‑Exchange Server 2010. נדרש Microsoft Exchange Server 2010 Service Pack 1 לכל הפיצ’רים הנכללים בחלק זה.
מציאת שיחות
כדי לקבל את מידע השיחה מתיקייה ספציפית ב‑Exchange Server:
- התחבר ל‑Exchange Server באמצעות מחלקת IEWSClient.
- קרא למתודה 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();
}
העתקת שיחות
כדי להעתיק שיחות מתיקייה אחת לשנייה:
- התחבר ל‑Exchange Server באמצעות מחלקת IEWSClient.
- קרא למתודה 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");
}
}
העברת שיחות
להעברת שיחות מתיקייה אחת לשנייה:
- התחבר ל‑Exchange Server באמצעות מחלקת IEWSClient.
- קרא למתודה 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");
}
}
מחיקת שיחות
כדי למחוק שיחות מתיקייה:
- התחבר ל‑Exchange Server באמצעות מחלקת IEWSClient.
- קרא למתודה 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");
}
}