This topic has not yet been rated - Rate this topic

How to: Apply conversation actions

EWS Managed API

Last modified: February 07, 2014

Applies to: EWS Managed API | Exchange Server 2010 Service Pack 1 (SP1)

Note: This content applies to the EWS Managed API 2.0 and earlier versions. For the latest information about the EWS Managed API, see Web services in Exchange.

You can use the Microsoft Exchange Web Services (EWS) Managed API to apply actions to manage conversations in a mailbox.

Note Note

The conversations feature is available in versions of Exchange starting with Exchange Server 2010 Service Pack 1 (SP1).

To apply categorization and move actions to a conversation

  1. Instantiate a class that implements the IEnumerable interface that iterates a collection of strings. Add categories to the enumerator.

    List<string> categories = new List<string>();
    categories.Add("Customer");
    categories.Add("System Integrator");
    
  2. Call the EnableAlwaysCategorizeItems(IEnumerable<String>, Boolean) method with the category enumerator.

    conversation.EnableAlwaysCategorizeItems(categories, true);
    
  3. Call the EnableAlwaysMoveItems(FolderId, Boolean) method with the identifier of the folder that will contain the moved items.

    conversation.EnableAlwaysMoveItems(WellKnownFolderName.Drafts, false);
    

The following example shows how to add categories to existing items in a conversation and apply the same categories to future items in the conversation. It also shows how to enable the automatic moving of items in the conversation to a folder; in this example, items are moved to the Drafts folder.

   Sub ApplyConversationActions(ByVal service As ExchangeService, ByVal conversation As Conversation)

      ' Create a list of categories to apply to a conversation.
      Dim categories As New List(Of String)
      categories.Add("Customer")
      categories.Add("System Integrator")

      ' Apply categorization to all items in the conversation and process the request
      ' synchronously after enabling this rule and all item categorization has been applied. 
      ' This results in a call to EWS. 
      conversation.EnableAlwaysCategorizeItems(categories, True)

      ' Apply an always move rule to all items in the conversation and move the items
      ' to the Drafts folder. Process the request asynchronously and return the response. 
      ' immediately. This results in a call to EWS. 
      conversation.EnableAlwaysMoveItems(WellKnownFolderName.Drafts, False)

   End Sub

For information about compiling this code, see Getting started with the EWS Managed API.

  • Write appropriate error handling code for common search errors.

  • Review the client request XML that is sent to the Exchange server.

  • Review the server response XML that is sent from the Exchange server.

  • Set the service binding as shown in Setting the Exchange service URL by using the EWS Managed API. Do not hard code URLs because if mailboxes move, they might be serviced by a different Client Access server. If the client cannot connect to the service, retry setting the binding by using the AutodiscoverUrl(String) method.

  • Set the target Exchange Web Services schema version by setting the requestedServerVersion parameter of the ExchangeService constructor. For more information, see Versioning EWS requests.

  • Use HTTP with SSL for all communication between client and server.

  • Always validate the server certificate that is used for establishing the SSL connections. For more information, see Validating X509 certificates.

  • Do not include user names and passwords in trace files.

  • Verify that Autodiscover lookups that use HTTP GET to find an endpoint always prompt for user confirmation; otherwise, they should be blocked.

Show:
© 2014 Microsoft. All rights reserved.