2016-04-18 13 views

答えて

1

はいできます。実際には、Exchange Webサービスを使用して本文を取得します。 )溶液1にJavaScriptから1)SOAPリクエスト(クライアントアプリケーション)又は2)サーバ側このような.NETのExchange Web SDKのようにSDKを使用して

としてこれを行うには、2つの方法があるhereを説明しました

  function getSoapEnvelope(request) { 
      // Wrap an Exchange Web Services request in a SOAP envelope. 
      var result = 
      '<?xml version="1.0" encoding="utf-8"?>' + 
      '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' + 
      '    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' + 
      ' <soap:Header>' + 
      '  <t:RequestServerVersion Version="Exchange2013"/>' + 
      ' </soap:Header>' + 
      ' <soap:Body>' + 
      request + 
      ' </soap:Body>' + 
      '</soap:Envelope>'; 

      return result; 
      } 



      var getBodyAsync = function() { 
      var that =this; 
      var deferred = that.$q.defer(); 

      function getHeadersRequest(id) { 
       // Return a GetItem EWS operation request for the headers of the specified item. 
       var result = 
      ' <GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' + 
      '  <ItemShape>' + 
      '  <t:BaseShape>IdOnly</t:BaseShape>' + 
      '  <t:BodyType>HTML</t:BodyType>' + 
      '  <t:AdditionalProperties>' + 
      '   <t:FieldURI FieldURI="item:Body"/>' + 
      '  </t:AdditionalProperties>' + 
      '  </ItemShape>' + 
      '  <ItemIds><t:ItemId Id="' + id + '"/></ItemIds>' + 
      ' </GetItem>'; 
       return result; 
      } 
       // Create a local variable that contains the mailbox. 
      var mailbox = Office.context.mailbox; 
      var request = getHeadersRequest(mailbox.item.itemId); 
      var envelope = getSoapEnvelope(request); 

      var callback = function (data) { 
       var $data = $(data.value); 
       var $body = $("t\\:Body", $data); 
       deferred.resolve($body.html()); 
      } 

      mailbox.makeEwsRequestAsync(envelope, callback); 
      return deferred.promise; 
     }; 

、その溶液2).NET所SDKと

  ExchangeService service = new ExchangeService(); 
      service.Credentials = new OAuthCredentials(token); 
      service.Url = new Uri(ewsUrl); 

      PropertyDefinition definition = ItemSchema.NormalizedBody; 
      var propertySet = new PropertySet(definition, ItemSchema.Attachments, 
       ItemSchema.HasAttachments); 
      EmailMessage ewsEmail = EmailMessage.Bind(service, new ItemId(itemId), propertySet); 


      return ewsEmail.NormalizedBody.Text; 
のためにあなたの要求には、以下のjsのスニペットのようになります。(私は that.$q.defer();でangular.js約束を使用しているノートが、これは必須ではありません)
関連する問題