ניהול פריטי שיחה ב‑Exchange Server
Contents
[
Hide
]
ניתן להשתמש ב‑Aspose.Email עבור .NET כדי לנהל פריטי שיחה ב‑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);
Console.WriteLine("Connected to Exchange 2010");
// Find Conversation Items in the Inbox folder
ExchangeConversation[] conversations = client.FindConversations(client.MailboxInfo.InboxUri);
// Show all conversations
foreach (ExchangeConversation conversation in conversations)
{
// Display conversation properties like Id and Topic
Console.WriteLine("Topic: " + conversation.ConversationTopic);
Console.WriteLine("Flag Status: " + conversation.FlagStatus.ToString());
Console.WriteLine();
}
העתקת שיחות
כדי להעתיק שיחות מתיקייה אחת לשנייה:
- התחבר ל‑Exchange Server באמצעות ה‑ IEWSClient ממשק.
- הפעל את IEWSClient.CopyConversationItems() שיטה להעתיק את פריט השיחה מתיקיית המקור לתיקיית היעד.
קטעת הקוד הבא מראה לך כיצד להעתיק שיחות.
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
Console.WriteLine("Connected to Exchange 2010");
// Find those Conversation Items in the Inbox folder which we want to copy
ExchangeConversation[] conversations = client.FindConversations(client.MailboxInfo.InboxUri);
foreach (ExchangeConversation conversation in conversations)
{
Console.WriteLine("Topic: " + conversation.ConversationTopic);
// Copy the conversation item based on some condition
if (conversation.ConversationTopic.Contains("test email") == true)
{
client.CopyConversationItems(conversation.ConversationId, client.MailboxInfo.DeletedItemsUri);
Console.WriteLine("Copied the conversation item to another folder");
}
}
העברת שיחות
להעברת שיחות מתיקייה אחת לשנייה:
- התחבר ל‑Exchange Server באמצעות ה‑ IEWSClient ממשק.
- הפעל את IEWSClient.MoveConversationItems() שיטה להעביר שיחה מתיקיית המקור לתיקיית היעד.
קוד הדוגמה הבא מראה לך כיצד להעביר שיחות.
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
Console.WriteLine("Connected to Exchange 2010");
// Find those Conversation Items in the Inbox folder which we want to move
ExchangeConversation[] conversations = client.FindConversations(client.MailboxInfo.InboxUri);
foreach (ExchangeConversation conversation in conversations)
{
Console.WriteLine("Topic: " + conversation.ConversationTopic);
// Move the conversation item based on some condition
if (conversation.ConversationTopic.Contains("test email") == true)
{
client.MoveConversationItems(conversation.ConversationId, client.MailboxInfo.DeletedItemsUri);
Console.WriteLine("Moved the conversation item to another folder");
}
}
מחיקת שיחות
כדי למחוק שיחות מתיקייה:
- התחבר ל‑Exchange Server באמצעות ה‑ IEWSClient ממשק.
- הפעל את IEWSClient.DeleteConversationItems() שיטה למחוק את פריט השיחה מתיקיית המקור.
קוד הדוגמה הבא מראה לך כיצד למחוק שיחות.
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
Console.WriteLine("Connected to Exchange 2010");
// Find those Conversation Items in the Inbox folder which we want to delete
ExchangeConversation[] conversations = client.FindConversations(client.MailboxInfo.InboxUri);
foreach (ExchangeConversation conversation in conversations)
{
Console.WriteLine("Topic: " + conversation.ConversationTopic);
// Delete the conversation item based on some condition
if (conversation.ConversationTopic.Contains("test email") == true)
{
client.DeleteConversationItems(conversation.ConversationId);
Console.WriteLine("Deleted the conversation item");
}
}