EWS ArchiveItem internal server error

Simon Hain 96 Reputation points
2024-11-11T07:57:50.0833333+00:00

We are using the ArchiveItem operation on a mailbox on O365 with enabled online archive. The request is identical to the one in the reference, with a real item id of course.

https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/archiveitem-operation

The Exchange server replies with an InternalServerError:

An internal server error occurred. The operation failed., Unable to cast object of type 'Microsoft.Exchange.Services.Core.Types.MoveItemRequest' to type 'Microsoft.Exchange.Services.Core.ILegacyServiceCommandFactory'.

Microsoft Exchange Online
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
551 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jake Zhang-MSFT 6,930 Reputation points Microsoft Vendor
    2024-11-12T07:57:52.2533333+00:00

    Hi @Simon Hain ,

    Welcome to the Microsoft Q&A platform!

    According to your description, you're encountering an issue with the ArchiveItem operation in Exchange Online. The error message you're receiving, "Unable to cast object of type 'Microsoft.Exchange.Services.Core.Types.MoveItemRequest' to type 'Microsoft.Exchange.Services.Core.ILegacyServiceCommandFactory'," suggests there might be a problem with how the request is being interpreted or processed by the Exchange server.

    Here are a few steps that might help you troubleshoot and potentially resolve this issue:

    1. Ensure that the request you're sending matches the expected format exactly. Even a small discrepancy could lead to errors.
    2. Make sure you are using the correct version of the Exchange Web Services (EWS) API. Sometimes, mismatched versions can cause issues.
    3. Ensure the account you're using has the necessary permissions to perform the ArchiveItem operation on the mailbox. Lack of proper permissions can lead to internal server errors.
    4. Verify that the item IDs you are using in the request are valid and that the items actually exist in the mailbox.
    5. If you have control over the Exchange Online environment, ensure that it is fully updated. Sometimes, such errors can be due to bugs that have been fixed in more recent updates.
    6. Enable detailed logging of the requests and responses if possible. Sometimes, additional context from the logs can provide more insights into the root cause of the error.

    Please feel free to contact me for any updates. And if this helps, don't forget to mark it as an answer.

    Best,

    Jake Zhang


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.