none
Error when moving mails between folders RRS feed

  • Question

  • Hi,

    I use PowerShell and WebServices DLL (I have tried different versions) to check and move messages inside a mailbox from Outbox to Sent Items. In 70% it works, but when processing some mailboxes I get an exception "The move or copy operation failed" on line  $item.Move("SentItems").

    Not moved messages does not look corrupted - I can access them, move them in OWA. They are also not special (calendar event/response/deffered message).

    Do you have any idea why?

    Thanks
    M.

    A move message part:

    ($service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService)

     function Move-Messages {
      [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")]
      param(
        [Parameter(Position = 0, Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
     [string]
        $Id    
        )
      process { 
        $view = New-Object Microsoft.Exchange.WebServices.Data.ItemView -ArgumentList 1
        $propertyset = New-Object Microsoft.Exchange.WebServices.Data.PropertySet ([Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly)
        $view.PropertySet = $propertyset
        $item = [Microsoft.Exchange.WebServices.Data.Item]::Bind($service, $Id)
        $item.Move("SentItems")
        $view = $null
        $propertyset = $null
      }
    }



    • Edited by MStoppl Tuesday, July 9, 2013 8:18 AM
    Tuesday, July 9, 2013 8:18 AM

Answers

  • I would suggest you enable Tracing and have a look/post the response you get from the server when the error occurs http://msdn.microsoft.com/en-us/library/exchange/dd633676(v=exchg.80).aspx.

    How many items are you moving ? if its a large number you maybe getting throttled.

    The other question is why have you got Items in the Outbox in the normal course of events normal Items shouldn't be saved in this folder unless there is another problem.

    Cheers
    Glen

    • Marked as answer by MStoppl Saturday, July 13, 2013 5:30 PM
    Wednesday, July 10, 2013 6:54 AM
  • If you retry the same move say 30 minutes later on the same items does it work. Or does it consistently fail on the same items not matter how many times you retry ?

    The traces aren't saying much other then that your Exchange server is behind on patches the latest rollup for 2010 SP2 is 6 and your on 4. (there's also SP3 out) this may or may not be relevant if it is a fixed bug. The other places to look are check the Event Log on the server to see if an error are being logged and also the EWS Log on the server which should be in \Microsoft\Exchange Server\V14\Logging\Ews

    Cheers
    Glen

    • Marked as answer by MStoppl Saturday, July 13, 2013 5:29 PM
    Thursday, July 11, 2013 10:56 AM

All replies

  • I would suggest you enable Tracing and have a look/post the response you get from the server when the error occurs http://msdn.microsoft.com/en-us/library/exchange/dd633676(v=exchg.80).aspx.

    How many items are you moving ? if its a large number you maybe getting throttled.

    The other question is why have you got Items in the Outbox in the normal course of events normal Items shouldn't be saved in this folder unless there is another problem.

    Cheers
    Glen

    • Marked as answer by MStoppl Saturday, July 13, 2013 5:30 PM
    Wednesday, July 10, 2013 6:54 AM
  • Hi Glen,

    thanks. A tracing is a good idea.
    I am moving from 1-200 items/mailbox. A sample mailbox has 3 items in outbox.

    About having items in outbox - some users still use Outlook 2007 and do not have necessary patch installed.

    Thanks.

    M.



    • Edited by MStoppl Wednesday, July 10, 2013 7:37 AM
    Wednesday, July 10, 2013 7:37 AM
  • Hi Glen,

    this is a traced request/response:

     

    <Trace Tag="EwsRequest" Tid="6" Time="2013-07-10 09:42:32Z" Version="15.00.0516.014">
      <?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:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2010_SP2" />
          <t:ExchangeImpersonation>
            <t:ConnectingSID>
              <t:SmtpAddress>targetuser@domain.com</t:SmtpAddress>
            </t:ConnectingSID>
          </t:ExchangeImpersonation>
        </soap:Header>
        <soap:Body>
          <m:MoveItem>
            <m:ToFolderId>
              <t:DistinguishedFolderId Id="sentitems" />
            </m:ToFolderId>
            <m:ItemIds>
              <t:ItemId Id="AAMkADExMDI0MjcyLTgwOWUtNGQwNi1iNTc1LTM2ZGJmZGMyN2ZiOABGAAAAAAAEh0ZJvJC7Ra+ojsq+4gj4BwBZGmfnJSRxQ6+lLXPx5mjGAAAAGWoWAAAnEcSixPLTQ4athfzPTwLnAAANUY9RAAA=" ChangeKey="DAAAABYAAAAnEcSixPLTQ4athfzPTwLnAAANUzMZ" />
            </m:ItemIds>
          </m:MoveItem>
        </soap:Body>
      </soap:Envelope>
    </Trace>

    <Trace Tag="EwsResponseHttpHeaders" Tid="6" Time="2013-07-10 09:42:32Z">
      <?xml version="1.0" encoding="utf-8"?>
      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <s:Header>
          <h:ServerVersionInfo MajorVersion="14" MinorVersion="2" MajorBuildNumber="342" MinorBuildNumber="4" Version="Exchange2010_SP2" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
        </s:Header>
        <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <m:MoveItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ResponseMessages>
              <m:MoveItemResponseMessage ResponseClass="Error">
                <m:MessageText>The move or copy operation failed.</m:MessageText>
                <m:ResponseCode>ErrorMoveCopyFailed</m:ResponseCode>
                <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
                <m:Items />
              </m:MoveItemResponseMessage>
            </m:ResponseMessages>
          </m:MoveItemResponse>
        </s:Body>
      </s:Envelope>
    </Trace>

    I still have no idea why it fails :(


    ------- Michal Stoppl MCP, MCSA, MCTS, MCITP, MCT Please always use Mark as answer if you are satisfied with provided solution.

    Wednesday, July 10, 2013 9:46 AM
  • If you retry the same move say 30 minutes later on the same items does it work. Or does it consistently fail on the same items not matter how many times you retry ?

    The traces aren't saying much other then that your Exchange server is behind on patches the latest rollup for 2010 SP2 is 6 and your on 4. (there's also SP3 out) this may or may not be relevant if it is a fixed bug. The other places to look are check the Event Log on the server to see if an error are being logged and also the EWS Log on the server which should be in \Microsoft\Exchange Server\V14\Logging\Ews

    Cheers
    Glen

    • Marked as answer by MStoppl Saturday, July 13, 2013 5:29 PM
    Thursday, July 11, 2013 10:56 AM
  • Unfortunately logs did not help. Let's hope patchs will do :)

    Thanks




    • Edited by MStoppl Saturday, July 13, 2013 5:29 PM
    Saturday, July 13, 2013 5:29 PM