Graph Java SDK: I want to send the saved draft mail but dont want it to be saved in sent items

Shahid 6 Reputation points
2022-11-16T12:55:31.487+00:00

Hi,

I am using graph Java SDK and want to send the saved draft mail but don't want it to be saved in sent items folder.Basically the control by some flag where i can opt to save or not to save in sent folder.

below code snippet which is automatically saving it in sent folder.

//send message to draft

Message draftMessage= graphClient.users(fromAddress)
.messages()
.buildRequest()
.post(message);

//send email from above draft message.

graphClient.users(fromAddress)
.messages(draftMessage.id)
.send()
.buildRequest()
.post();

Could you please help on it.

Thanks ,
Shahid

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

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,711 Reputation points Microsoft Vendor
    2022-11-16T14:09:18.46+00:00

    Hello @Shahid ,

    message resource type, doesn't support "saveToSentItems": "false". Hence it is not possible to /send Draft message without saving to sentItems.
    user-sendmail along with message resource type with additional support for "saveToSentItems": "false".

    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