简体   繁体   English

如何在Outlook的Deleted Items文件夹中创建EWS项目(日历事件或联系人)?

[英]How to create an EWS item (Calendar event or Contact) in the Deleted Items folder in Outlook?

I was trying to recreate the item into Deleted Items folder, but nothing happened, I got these errors "ErrorCannotCreateCalendarItemInNonCalendarFolder" or "ErrorCannotCreateContactInNonContactFolder". 我试图将项目重新创建到Deleted Items文件夹中,但是什么也没有发生,我得到了以下错误“ ErrorCannotCreateCalendarItemInNonCalendarFolder”或“ ErrorCannotCreateContactInNonContactFolder”。 How to overcome this? 如何克服呢?

I used the request to POST with the body 我使用的请求用身体POST

    "<?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=\"Exchange2013\" /> "
        "<t:ExchangeImpersonation> "
          "<t:ConnectingSID> "
            "<t:PrincipalName>%MAIL_BOX%</t:PrincipalName> "     // <<------- MAIL_BOX ---- FILLED IN BY A TEMPLATE PARAM
          "</t:ConnectingSID> "
        "</t:ExchangeImpersonation> "
      "</soap:Header> "
      "<soap:Body> "
        "<CreateItem xmlns=\"http://schemas.microsoft.com/exchange/services/2006/messages\" "
                    "MessageDisposition=\"SaveOnly\" "
                    "SendMeetingInvitations=\"SendToNone\"> "
          "<SavedItemFolderId>"
            "<t:FolderId Id=\"%FOLDER_ID%\"/>"                             // <<------- FOLDER_ID ---- FILLED IN BY A TEMPLATE PARAM
          "</SavedItemFolderId>"
          "<Items>"
            "%ITEMS_CONTENT%"                                              // <<------- ITEMS_CONTENT ---- FILLED IN BY A TEMPLATE PARAM
          "</Items>"
        "</CreateItem>"
      "</soap:Body>"
    "</soap:Envelope>";

And got such the response: 并得到了这样的回应:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="1922" MinorBuildNumber="23" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
    </s:Header>
    <s:Body>
        <m:CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ResponseMessages>
                <m:CreateItemResponseMessage ResponseClass="Error">
                    <m:MessageText>Cannot create a calendar item in a non-calendar folder.</m:MessageText>
                    <m:ResponseCode>ErrorCannotCreateCalendarItemInNonCalendarFolder</m:ResponseCode>
                    <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
                    <m:Items />
                </m:CreateItemResponseMessage>
            </m:ResponseMessages>
        </m:CreateItemResponse>
    </s:Body>
</s:Envelope>

Because the Deleted Items Folder class is IPF.Note EWS restricts you from creating items that are Calendar or Contacts in these types of folder hence the error message your receiving. 由于Deleted Items Folder类是IPF.Note EWS限制您在这些类型的文件夹中创建日历或联系人项目,因此会收到错误消息。 A workaround is just create the Items in the normal Calendar or Contacts folder and then use the Move operation to move it after you have created it. 解决方法是,在普通的“日历”或“联系人”文件夹中创建“项目”,然后在创建后使用“移动”操作将其移动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM