无法使用ews创建公用文件夹

时间:2019-10-25 08:18:19

标签: outlook office365 exchangewebservices

  

我正在尝试使用以下调用创建公用文件夹,但这是   显示错误。我已经使用自动发现和POX调用来获取   X-PublicFolderMailbox和X-AnchorMailbox的数据。我已经将这两个值都包含在Http标头中

    def create_public_folder():
    a = 'https://outlook.office365.com/EWS/Exchange.asmx'
    soap_request = b'''<?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="Exchange2007_SP1" />
        <t:ExchangeImpersonation>
            <t:ConnectingSID>
                <t:PrimarySmtpAddress>%s</t:PrimarySmtpAddress>
            </t:ConnectingSID>
        </t:ExchangeImpersonation>
    </soap:Header>
    <soap:Body>
        <CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
            <ParentFolderIds>
                <t:DistinguishedFolderId Id="publicfoldersroot"/>
            </ParentFolderIds>
            <Folders>
                <t:Folder>
                    <t:DisplayName>Folder1</t:DisplayName>
                </t:Folder>
            </Folders>
        </CreateFolder>
    </soap:Body>
</soap:Envelope>
    '''%(email_id)

但是我收到的错误消息是

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <Action s:mustUnderstand="1"
            xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">*
        </Action>
    </s:Header>
    <s:Body>
        <s:Fault>
            <faultcode
                xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInternalServerError
            </faultcode>
            <faultstring xml:lang="en-US">An internal server error occurred. The operation failed.</faultstring>
            <detail>
                <e:ResponseCode
                    xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInternalServerError
                </e:ResponseCode>
                <e:Message
                    xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">An internal server error occurred. The operation failed.
                </e:Message>
            </detail>
        </s:Fault>
    </s:Body>
</s:Envelope>

请帮助。

0 个答案:

没有答案