Exchange Server の会話アイテムの管理
Contents
[
Hide
]
Aspose.Email for .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");
}
}