generator-office icon indicating copy to clipboard operation
generator-office copied to clipboard

Strange restriction error when making ews call

Open rjpruitt16 opened this issue 4 years ago • 2 comments

I am using react to make an EWS call, and I receive this strange error. I think it has something to do with me being on mac. I saw a similar error on github without an answer. I doubt it has something to do with code I wrote because it sounds like me configurations are off. I have set my configuration to the highest possible


{
  code: 9017,
  message: "Internal protocol error: '-2147467259'.",
  name: "AccessRestricted",
}
// from manifest.xml
<Permissions>ReadWriteMailbox</Permissions>

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.context.mailbox.makeEwsRequestAsync(folderXMLRequest, callback);
}
// How I call in my react class
click = async () => {
    /**
     * Insert your Outlook code here
     */
    createFolders(["@COOLMONDAY", "@COOLTUESDAY"], asyncResult => {
      console.log(asyncResult);
    });
  };

rjpruitt16 avatar Apr 20 '20 16:04 rjpruitt16

https://github.com/OfficeDev/generator-office/issues/528

rjpruitt16 avatar Apr 21 '20 19:04 rjpruitt16

Things have changed in the last couple years . . . is this still being encountered?

millerds avatar May 25 '22 18:05 millerds