Do you need an on premise exchange server to call makeEwsRequestAsync?

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-14 09:10:10

问题


I am trying to create an add in for outlook using office.js. For a week now, I have been receiving accessRestricted error from using makeEwsRequestAsync. When I read the documentation again, it says I have to explicitly set oauthentication to true in the exchange server. When I check to see how to set oauthentication to true, at the top of the page, I see the command only exist in on-premise exchange server. I bought an online exchange server, and the command listed does not work in my environment. I have been complaining to microsoft that they should have put this information at the front, but someone from microsoft message me and said that oauthentication is set to true automatically when using exchange online. This appears to be false because I receive the same error using my administrator account of exchange online. I have posted the error message below. It seems obvious that the error message has something to with improper configurations, but I have also posted my code below.

 function getCreateFolderXMLRequest(request) {
  /*
  example request parameter
  <t:Folder>
    <t:DisplayName>Folder1</t:DisplayName>
  </t:Folder>
  <t:Folder>
    <t:DisplayName>Folder2</t:DisplayName>
  </t:Folder>
  */

  var completeRequest =
    '<?xml version="1.0" encoding="utf-8"?>' +
    '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/ "' +
    '               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">' +
    "      <soap:Body>" +
    '          <CreateFolder xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">' +
    "              <ParentFolderId>" +
    '                  <t:DistinguishedFolderId Id="msgfolderroot"/>' +
    "              </ParentFolderId>" +
    "              <Folders>" +
    request +
    "              </Folders>" +
    "          </CreateFolder>" +
    "      </soap:Body>" +
    "</soap:Envelope>";

  return completeRequest;
}

export default function createFolders(listOfFolders, callback) {
  const folderHeader = "<t:Folder> <t:DisplayName>";
  const folderFooter = "</t:DisplayName> </t:Folder>";
  var xmlFolders = [];
  for (var folderName of listOfFolders) {
    xmlFolders.push(folderHeader + folderName + folderFooter);
  }

  const folderXMLRequest = getCreateFolderXMLRequest(xmlFolders.join(" "));
  Office.onReady(() => {
    Office.context.mailbox.makeEwsRequestAsync(folderXMLRequest, callback);
  });
}

回答1:


I would say yes because the documentation provides two ways of settings oauth and both explicitly states it has to be an on premise exchange server. https://docs.microsoft.com/en-us/office/dev/add-ins/outlook/web-services#authentication-and-permission-considerations-for-makeewsrequestasync



来源:https://stackoverflow.com/questions/61451273/do-you-need-an-on-premise-exchange-server-to-call-makeewsrequestasync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!