How to keep the message ID constant in every folder?

Salma Sultana 1 Reputation point

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.
11,382 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,711 Reputation points Microsoft Vendor

    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

    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

    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