Can't use EWS UpdateItem operation from Outlook add-in

本小妞迷上赌 提交于 2020-01-02 20:09:12

问题


I'm am trying to update a dictionary element in the IPM.Configuration.OWA.UserOptions message using an UpdateItem via an EWS (SOAP) request from an Outlook web add-in with ReadWriteMailbox permissions. However it is failing with the following error in the response:

ErrorAccessDenied: Office extension is not allowed to update this type of item.

The UpdateItem request I'm using is a fairly straightforward example of updating a message by it's ID and setting the value of an extended property:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"               xmlns:xsd="http://www.w3.org/2001/XMLSchema"               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />
  </soap:Header>
  <soap:Body>
    <m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
      <m:ItemChanges>
        <t:ItemChange>
          <t:ItemId Id="AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MABGAAAAAACxU7lpjO+oS5hB0UfA6muFBwDcAGmTk49MRrSCdR7rvVFPAAAAAAEBAADcAGmTk49MRrSCdR7rvVFPAAD2pXuVAAA=" ChangeKey="CQAAABYAAADcAGmTk49MRrSCdR7rvVFPAAD2uhNb" />
          <t:Updates>
            <t:SetItemField>
              <t:ExtendedFieldURI PropertyTag="0x7c07" PropertyType="Binary" />
              <t:Message>
                <t:ExtendedProperty>
                    <t:ExtendedFieldURI PropertyTag="0x7c07" PropertyType="Binary" />
                    <t:Value>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxVc2VyQ29uZmlndXJhdGlvbj4NCgk8SW5mbyB2ZXJzaW9uPSJFeGNoYW5nZS4xMiIgLz4NCgk8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XVGQVFEY0FHbVRrNDlNUnJTQ2RSN3J2VkZQQUFBQUFBRVBBQUE9IiAvPg0KCQk8ZSBrPSIxOC1Jc09wdGltaXplZEZvckFjY2Vzc2liaWxpdHkiIHY9IjMtRmFsc2UiIC8+DQoJCTxlIGs9IjE4LUlzRm9jdXNlZEluYm94RW5hYmxlZCIgdj0iMy1UcnVlIiAvPg0KCQk8ZSBrPSIxOC1OZXdFbmFibGVkUG9udHMiIHY9IjktMjE0NzQwMTcyNyIgLz4NCgkJPGUgaz0iMTgtc2lnbmF0dXJlaHRtbCIgdj0iMTgtJmx0O2h0bWwmZ3Q7JiN4RDsmI3hBOyZsdDtoZWFkJmd0OyYjeEQ7JiN4QTsmbHQ7L2hlYWQmZ3Q7JiN4RDsmI3hBOyZsdDtib2R5Jmd0OyYjeEQ7JiN4QTsmbHQ7cCZndDsmYW1wO25ic3A7Jmx0Oy9wJmd0OyYjeEQ7JiN4QTsmbHQ7cCZndDstLSZsdDsvcCZndDsmI3hEOyYjeEE7Jmx0O3AmZ3Q7SXp6eiBhbSBKYW5pY2smbHQ7L3AmZ3Q7JiN4RDsmI3hBOyZsdDtwJmd0OyZhbXA7bmJzcDsmbHQ7L3AmZ3Q7JiN4RDsmI3hBOyZsdDsvYm9keSZndDsmI3hEOyYjeEE7Jmx0Oy9odG1sJmd0OyYjeEQ7JiN4QTsiIC8+DQoJPC9EYXRhPg0KPC9Vc2VyQ29uZmlndXJhdGlvbj4=</t:Value>
                </t:ExtendedProperty>                
              </t:Message>
            </t:SetItemField>
          </t:Updates>
        </t:ItemChange>
      </m:ItemChanges>
    </m:UpdateItem>
  </soap:Body>
</soap:Envelope>

The 0x7c07 property I'm updating in the UserOptions message contains a base64 encoded value of various signature related dictionary properties that I've modified:

<?xml version="1.0" encoding="utf-8"?>
<UserConfiguration>
    <Info version="Exchange.12" />
    <Data>
        <e k="18-IsFocusedInboxOnLastUpdateTime" v="18-01/01/0001 00:00:00" />
        <e k="18-autoaddsignature" v="3-True" />
        <e k="18-UserOptionsMigrationState" v="9-5" />
        <e k="18-themeStorageId" v="18-" />
        <e k="18-autoaddsignatureonreply" v="3-True" />
        <e k="18-timezone" v="18-Central Standard Time" />
        <e k="18-signaturetext" v="18-&#xD;&#xA;--&#xD;&#xA;Izzz am Janick&#xD;&#xA;&#xD;&#xA;" />
        <e k="18-FavoriteFolders" v="1-18-3-120-AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MAAuAAAAAACxU7lpjO+oS5hB0UfA6muFAQDcAGmTk49MRrSCdR7rvVFPAAAAAAEMAAA=-120-AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MAAuAAAAAACxU7lpjO+oS5hB0UfA6muFAQDcAGmTk49MRrSCdR7rvVFPAAAAAAEJAAA=-120-AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MAAuAAAAAACxU7lpjO+oS5hB0UfA6muFAQDcAGmTk49MRrSCdR7rvVFPAAAAAAEPAAA=" />
        <e k="18-IsOptimizedForAccessibility" v="3-False" />
        <e k="18-IsFocusedInboxEnabled" v="3-True" />
        <e k="18-NewEnabledPonts" v="9-2147401727" />
        <e k="18-signaturehtml" v="18-&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;--&lt;/p&gt;&lt;p&gt;John Doe&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;;" />
    </Data>
</UserConfiguration>

I can't find any documentation that states what is allowed or not allowed with UpdateItem operations (the list should be here). Updating the Outlook Online signature is also not currently possible with Graph or the Mail API. If what I'm trying to do ultimately cannot work then I just wasted 40+ hours of effort and will lose a client. :-|

Does anybody have any clever workarounds or know of a way to enable this operation? Note that using the EWS Managed API in server-side code is not currently an option for this solution.


回答1:


Outlook does not allow add-ins to create or update FAI messages by design. In general we don't allow modifications of OWA options (or any other “service-type”, internal, item/data) directly which is probably an internal data structure, subject to change and potentially break the add-in.

If your scenario specifically requires access to outlook's signature system, I would recommend making a request to UserVoice



来源:https://stackoverflow.com/questions/46739744/cant-use-ews-updateitem-operation-from-outlook-add-in

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