Exchange Server에서 대화 항목 관리

Aspose.Email for .NET은 다음을 사용하여 Exchange Server의 대화 항목을 관리할 수 있습니다 EWSClient 클래스. 이 클래스는 Exchange Web Services를 사용하며, 이는 Exchange Server 2007 이후 버전에서만 사용할 수 있습니다. 이 문서는 방법을 보여줍니다. find, copy, movedelete Exchange Server 2010의 대화 항목. 이 섹션에 포함된 모든 기능을 사용하려면 Microsoft Exchange Server 2010 Service Pack 1이 필요합니다.

대화 찾기

Exchange Server의 특정 폴더에서 대화 정보를 가져오려면:

  1. 다음을 사용하여 Exchange Server에 연결합니다 IEWSClient 인터페이스.
  2. 다음을 호출합니다. IEWSClient.FindConversations() 폴더에서 모든 대화 항목을 찾는 메서드.
  3. 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();
}

대화 복사

대화를 한 폴더에서 다른 폴더로 복사하려면:

  1. 다음을 사용하여 Exchange Server에 연결합니다 IEWSClient 인터페이스.
  2. 다음을 호출합니다. 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");
    }
}

대화 이동

대화를 한 폴더에서 다른 폴더로 이동하려면:

  1. 다음을 사용하여 Exchange Server에 연결합니다 IEWSClient 인터페이스.
  2. 다음을 호출합니다. 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");
    }
}

대화 삭제

폴더에서 대화를 삭제하려면:

  1. 다음을 사용하여 Exchange Server에 연결합니다 IEWSClient 인터페이스.
  2. 다음을 호출합니다. 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");
    }
}