Item.WebClientReadFormQueryString プロパティ

定義

Web ブラウザーで適切な読み取りフォームを使用してこのアイテムを開くために Exchange Web クライアント URL に追加する必要があるクエリ文字列を取得します。

public:
 property System::String ^ WebClientReadFormQueryString { System::String ^ get(); };
public string WebClientReadFormQueryString { get; }
Public ReadOnly Property WebClientReadFormQueryString As String

プロパティ値

文字列値。

/// <summary>
/// Demonstrates how to open an item in Outlook Web App.
/// </summary>
/// <param name="service">An ExchangeService object that has already had credentials set and contains a valid service URL.</param>
static void OpenOWAFromWebClientReadFormQueryString(ExchangeService service)
{
  // Create a view that will return the identifier for the first item in a folder.
  ItemView itemView = new ItemView(1);
  itemView.PropertySet = new PropertySet(BasePropertySet.IdOnly);

  // Make a call to EWS to get one item from the mailbox folder.
  FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.Drafts, itemView);

  // Get the item identifier of the item to open in Outlook Web App.
  ItemId itemId = results.Items[0].Id;

  ExchangeServerInfo serverInfo = service.ServerInfo;
  var owaReadFormQueryString = string.Empty;
  var ewsIdentifer = itemId.UniqueId;

  try
  {
    // Make a call to EWS to bind to the item returned by the FindItems method.
    EmailMessage msg = EmailMessage.Bind(service, itemId);
    msg.Load(new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.WebClientReadFormQueryString));

    // Versions of Exchange starting with major version 15 and ending with Exchange Server 2013 build 15.0.775.09
    // returned a different query string fragment. This optional check is not required for applications that
    // target Exchange Online.
    if ((serverInfo.MajorVersion == 15) && (serverInfo.MajorBuildNumber < 775) &&(serverInfo.MinorBuildNumber < 09))
    {
      // If your client is connected to an Exchange 2013 server that has not been updated to CU3,
      // this query string will be returned.
      owaReadFormQueryString = string.Format("#viewmodel=_y.$Ep&ItemID={0}",
        System.Web.HttpUtility.UrlEncode(ewsIdentifer, Encoding.UTF8));
    }
    else
    {
      // If your client is connected to an Exchanger 2010, Exchange 2013 CU3, or Exchange Online server,
      // the WebClientReadFormQueryString is used.
      owaReadFormQueryString = msg.WebClientReadFormQueryString;
    }

    // Create the URL that Outlook Web App uses to open the email message.
    Uri url = service.Url;
    string owaReadAccessUrl = string.Format("{0}://{1}/owa/{2}",
      url.Scheme, url.Host, owaReadFormQueryString);

    if (!string.IsNullOrEmpty(owaReadAccessUrl))
    {
      System.Diagnostics.Process.Start("IEXPLORE.EXE", owaReadAccessUrl);
    }
  }
  catch (System.ComponentModel.Win32Exception ex)
  {
    Console.WriteLine(ex.Message);
    Console.WriteLine("ERRROR: Internet Explorer cannot be found.");
  }
}

注釈

Outlook Web App URL のアイテム識別子は、アイテムの EWS 識別子です。 EWS アイテム識別子を URL エンコードし、クエリ文字列に追加して、アイテムのOutlook Web App URL を取得できます。

バージョンの相違点

メジャー バージョン 15 で始まり、15.00.775.009 で終わる Exchange のバージョンでは、 プロパティに正しいクエリ文字列フラグメントが WebClientReadFormQueryString 返されません。

メジャー バージョン 15 より前のバージョンの Exchange では、Outlook Web App URL のアイテム識別子はOutlook Web App識別子です。 メジャー バージョン 15 より前のバージョンの Exchange を対象とする場合は、 メソッドを Microsoft.Exchange.WebServices.ExchangeService.ConvertID 使用して識別子を変換する必要があります。

適用対象