Graph API - Unable to restore messages in non-draft state during backup/restore implementation

Shyamjith Cherukara 20 Reputation points
2024-12-23T09:41:17.77+00:00

We are implementing a backup/restore solution for Microsoft 365 messages using Graph API. During the restore process, we are experiencing a critical limitation where all restored messages are marked as drafts, regardless of their original state.

  1. Current Implementation:

await graphClient.Users[userId] .Messages .Request() .AddAsync(newMessage);

  1. Attempted Solutions (None Worked):
  • Setting isDraft: false during message creation
  • Setting ReceivedDateTime and SentDateTime
  • Moving messages to Sent Items folder
  • Using beta endpoint
  • Move operations
  • Creating in specific folders (Inbox/Sent Items)

Expected Behavior:

  • Messages should restore to their original non-draft state, preserving their original appearance and metadata

Actual Behavior:

  • All restored messages show "[Draft] This message hasn't been sent" regardless of attempted solutions
  • This occurs even for messages restored to Sent Items or Inbox folders

Impact:

  • This significantly impacts our backup/restore functionality
  • Users see all restored messages as drafts, creating confusion
  • Affects message integrity and user experience

Questions:

  1. Is there an official way to restore messages in their original non-draft state?
  2. If not, can this capability be added to the Graph API?
  3. Are there any workarounds or alternative approaches recommended by Microsoft?

Please provide guidance on the correct approach to restore messages while maintaining their original non-draft state.

Environment:

  • Microsoft Graph API v1.0 and beta
  • Microsoft 365
  • C# implementation

Thank you for your assistance.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,795 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,201 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saranya Madhu-MSFT 1,005 Reputation points Microsoft Vendor
    2025-01-08T08:25:48.9166667+00:00

    Hi Shyamjith Cherukara,

    Thanks for reaching out to Microsoft!

    Currently, the Microsoft Graph API does not provide a direct way to restore messages in the non-draft state.

    Since this feature/functionality is presently not available, you can submit a feature request idea using support link, which will be monitored by Microsoft team and make the enhancements to Microsoft Graph APIs. I will also upvote for you.

    Note: APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

    Similar posts: https://learn.microsoft.com/en-us/answers/questions/1013351/how-to-restore-embedded-message-and-it-s-attachmen

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Shyamjith Cherukara 20 Reputation points
    2025-01-14T08:33:37.76+00:00

    However I could find a work around solution by setting SingleValueExtendedProperties

    
    
    // Assigning extended properties to the message
    newMessage.SingleValueExtendedProperties = new MessageSingleValueExtendedPropertiesCollectionPage
    {
        // Adding a single-value legacy extended property for the message class
        new SingleValueLegacyExtendedProperty
        {
            Id = "String 0x001A", // Property ID for the message class
            Value = "IPM.Note" // Specifies the message as an email
        },
    
        // Adding a single-value legacy extended property for message flags
        new SingleValueLegacyExtendedProperty
        {
            Id = "Integer 0x0E07", // Property ID for message flags
            Value = "5" // Combines multiple flags: sent, received, read, and removes the draft flag
        },
    
        // Adding a single-value legacy extended property for message storage state
        new SingleValueLegacyExtendedProperty
        {
            Id = "Integer 0x0E17", // Property ID for PR_MESSAGE_STATE
            Value = "1" // Indicates the message is not in draft
        },
        
        // Adding a single-value legacy extended property for send status
        new SingleValueLegacyExtendedProperty
        {
            Id = "Integer 0x6751", // Property ID for ptagSendStatus
            Value = "2" // Indicates the message has been sent
        },
    
        // Adding a single-value legacy extended property for access level
        new SingleValueLegacyExtendedProperty
        {
            Id = "Integer 0x0FF7", // Property ID for PR_ACCESS_LEVEL
            Value = "1" // Specifies read-only access
        }
    };
    
    
    
    0 comments No comments

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.