question

78669366 avatar image
0 Votes"
78669366 asked Deva-MSFT answered

Mail properties not being saved in UpdateAsync

Hi

I am starting out in MS Graph. I have below code to pick up all mail messages from Inbox of a specific user. Then I go through each message, process it and set its Subject. When I try to save back message using UpdateAsync it executes fine but change in mail subject text doesn't seem to get saved.

What am I doing wrong?

Thanks

Regards


  var inboxMessages = await graphClient
    .Users[user.Id]
    .MailFolders.Inbox
    .Messages
    .Request()
    .OrderBy("receivedDateTime DESC")
    .GetAsync();
    
  foreach(Microsoft.Graph.Message x in inboxMessages) {
    
    //Process message
    
    // ...
    
    x.Subject = "Processed: " + x.Subject
    
    //Save changes to message Subject
    graphClient
      .Users[user.Id]
      .MailFolders.Inbox
      .Messages[$"{x.Id}"]
      .Request()
      .UpdateAsync(x);
  }
microsoft-graph-sdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered

You can update Subject only for messages that have "isDraft = true"; please refer the documentation.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.