How to: Get service configuration information by using EWS in Exchange

Find out how to get service configuration information for UM, policy nudges, mail tips, and protection rules from EWS in Exchange.

Last modified: March 09, 2015

Applies to: Exchange Online | Exchange Server 2013 | Office 365

In this article
Code example: Get service configuration information for mail tips by using EWS
Next steps
Additional resources

Does your EWS application work with Unified Messaging (UM), policy nudges, mail tips, or protection rules? If so, your application will need to call the GetServiceConfiguration operation to get the service configuration information that it needs. The GetServiceConfiguration operation returns configuration information that is specific to each of these EWS features.

Note Note

The EWS Managed API does not implement this functionality.

Table 1.  Configuration information that the GetServiceConfiguration operation returns

EWS feature

GetServiceConfiguration operation returns…


  • A value that indicates whether UM is enabled.

  • A value that indicates whether play on phone is enabled.

  • The play on phone dial string.

Policy nudges

  • Policy nudges for display in your client.

Mail tips

  • A value that indicates whether mail tips are enabled.

  • The maximum number of recipients per request.

  • The maximum message size.

  • The large audience threshold.

  • A value that indicates whether the number of external recipients is shown.

  • A list of internal domains.

  • A value that indicates whether policy tips are enabled.

  • The large audience cap threshold for indicating whether your mail is considered to have a large number of recipients.

Protection rules

  • Protection rules setup for your client.

  • A list of domains that are internal to your organization.

The following code example uses the GetServiceConfiguration operation to request service configuration information for mail tips. You can request additional service configuration information by adding more ConfigurationName elements with different values.

private static void GetServiceConfiguration(ExchangeService service, NetworkCredential creds)
  // XML for the GetServiceConfiguration request SOAP envelope for mail tips configuration information.
  const string getServiceConfigurationRequest = 
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    "<soap:Envelope xmlns:xsi=\"\"\n" +
    "               xmlns:m=\"\"\n" +
    "               xmlns:t=\"\" \n" +
    "               xmlns:soap=\"\"\n" +
    "               xmlns:xs=\"\">\n" +
    "  <soap:Header>\n" +
    "    <t:RequestServerVersion Version=\"Exchange2013\" />\n" +
    "  </soap:Header>\n" +
    "  <soap:Body>\n" +
    "    <m:GetServiceConfiguration>\n" +
    "      <m:ActingAs>\n" +
    "        <t:EmailAddress></t:EmailAddress>\n" +
    "        <t:RoutingType>SMTP</t:RoutingType>\n" +
    "      </m:ActingAs>\n" +
    "      <m:RequestedConfiguration>\n" +
    "        <m:ConfigurationName>MailTips</m:ConfigurationName>\n" +
    "      </m:RequestedConfiguration>\n" +
    "    </m:GetServiceConfiguration>\n" +
    "  </soap:Body>\n" +

  // Encoded GetServiceConfiguration operation request.
  byte[] payload = System.Text.Encoding.UTF8.GetBytes(getServiceConfigurationRequest);

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(service.Url);
    request.AllowAutoRedirect = false;
    request.Credentials = creds;
    request.Method = "POST";
    request.ContentType = "text/xml";

    Stream requestStream = request.GetRequestStream();
    requestStream.Write(payload, 0, payload.Length);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    if (response.StatusCode == HttpStatusCode.OK)
      Stream responseStream = response.GetResponseStream();

      StreamReader reader = new StreamReader(responseStream);

      string responseFromServer = reader.ReadToEnd();

      Console.WriteLine("You will need to parse this response to get the configuration information:\n\n" + responseFromServer);

      throw new WebException(response.StatusDescription);
  catch (WebException e)

After you request service configuration information, use the XmlDocument class to load the response XML so that you can parse it. Then, depending on your scenario, you can do one of the following: