How to keep the message ID constant in every folder?

Salma Sultana 1 Reputation point
2022-11-24T12:54:05.36+00:00

Hi !!

I'm using graphAPI to retrieve the mail from GroupMailbox and once done i'm moving it to another destination folder.

While retrieving the mail i'm storing the message ID and trying to use the same ID i'm trying to invoke the replyAll functionality from the destination folder.

As the message ID will be changed once moved to another folder it is failing with the error "Resource not found"

Is there any way to keep the message ID constant in every folder and using the same for replyAll functionality ?

I have tried Immutable header while retrieving the mail but the ID is not constant when moved to other folder.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,569 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,686 Reputation points Microsoft Vendor
    2022-11-24T17:39:52.503+00:00

    Hi @Salma Sultana ,

    By default, message-id for the message changes when the item is moved from one container (such as a folder or calendar) to another. To change this behavior, use the Prefer: IdType="ImmutableId" header.
    See Get immutable identifiers for Outlook resources for more information.

    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

  2. Salma Sultana 1 Reputation point
    2022-11-28T06:07:57.277+00:00

    Hi Srinivas !!

    I have already tried by using the header Prefer: IdType="ImmutableId" to retrieve the mail but still the ID of the message is getting changed once moved to another folder.

    Do we need to use the header while moving the message to other folder and while performing reply-all functionality as well ?

    0 comments No comments

  3. Salma Sultana 1 Reputation point
    2022-11-29T14:49:40.073+00:00

    Hi !!

    Why is the message ID changing when filtered using From ? Is there a way to make sure the ID doesn't change ?

    NOTE : I'm using "ImmutableId" header for every graph api URL.

    0 comments No comments