none
EWS Cannot HardDelete or SoftDelete Items or Folders RRS feed

  • Question

  • I have a mailbox (office 365 hosted), and am attempting to permanently delete items from it. Permanently delete rather than move to Deleted Items folder. These are all mail objects.

    Item.Delete and Folder.Delete both fail, for all items, with the following error:

    Exception calling "Delete" with "1" argument(s): "Object cannot be deleted."
    At line:9 char:1
    + $Folder.Delete([Microsoft.Exchange.WebServices.Data.DeleteMode]::Hard ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ServiceResponseException

    Trace:

    <Trace Tag="EwsResponse" Tid="13" Time="2017-06-27 16:44:41Z" Version="15.00.0516.014">
      <?xml version="1.0" encoding="utf-8"?>
      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <s:Header>
          <h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1199" MinorBuildNumber="19" Version="V2017_04_14" 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:DeleteFolderResponse 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:DeleteFolderResponseMessage ResponseClass="Error">
                <m:MessageText>Object cannot be deleted.</m:MessageText>
                <m:ResponseCode>ErrorCannotDeleteObject</m:ResponseCode>
                <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
              </m:DeleteFolderResponseMessage>
            </m:ResponseMessages>
          </m:DeleteFolderResponse>
        </s:Body>
      </s:Envelope>
    </Trace>

    What are possible reasons why this would fail? I have full admin privileges. I can move these items successfully to other folders, and also Delete successfully with 

    $item.Delete([Microsoft.Exchange.WebServices.Data.DeleteMode]::MoveToDeletedItems)

    but HardDelete and SoftDelete both fail.



    • Edited by davegravy Tuesday, June 27, 2017 4:49 PM Clarification
    Tuesday, June 27, 2017 4:47 PM

All replies

  • Can you delete via "regular" methods, such as Outlook/OWA? Perhaps the dumpster is full, check the recoverable items quota.
    Tuesday, June 27, 2017 7:57 PM
  • Litigation hold on the Mailbox would cause that issue.

    Also if your trying to hard delete something from the RetainedItems\Purges folder you would get that error also, the only way of clearing that folder is to let Exchange do it when the retention period has expired.

    Cheers
    Glen

    Wednesday, June 28, 2017 2:42 AM