Не могу создать общую папку с помощью ews - PullRequest
0 голосов
/ 25 октября 2019

Я пытаюсь создать общую папку, используя приведенный ниже вызов, но он показывает ошибки. Я использовал автообнаружение и вызов 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>

Пожалуйста, помогите.

...