Hello,
my colleague finally found what the problem was. The parameter when sending an email to save to the sent folder must be "true". Also, when setting a custom parameter, you need to leave a constant value as the key, but enter a unique value in the "value" value. We then search using this key and value.
so the right solution is:
var emailMessage = new Microsoft.Graph.Message()
{
Subject = subject,
ToRecipients = to,
Body = new Microsoft.Graph.ItemBody()
{
ContentType = Microsoft.Graph.BodyType.Html,
Content = message
},
CcRecipients = cc,
SingleValueExtendedProperties=new MessageSingleValueExtendedPropertiesCollectionPage()
{
new Microsoft.Graph.SingleValueLegacyExtendedProperty()
{
Id = $@"String {{630b1eb6-293a-4c92-ba78-a40aadad5ae7}} Name EmailSender",
Value = uniqueVal
}
}
var c = _service.Users[from].Messages.Request(new List<Option>()
{
new QueryOption("filter",
@"singleValueExtendedProperties/Any(ep:ep/id eq 'String {630b1eb6-293a-4c92-ba78-a40aadad5ae7} Name EmailSender' and
ep/value eq '"+uniqueVal+"')"),
}
).GetAsync().GetAwaiter().GetResult();
var emailResponse = _service.Users[from].SendMail(emailMessage, true)
.Request().PostResponseAsync().GetAwaiter().GetResult();
Stream stream = _service.Users[from].Messages[emailId].Content.Request().GetAsync().GetAwaiter().GetResult();
Hi @vujtas ,
Hope you are doing well.
Could you please share what error code you are getting while sending mail and loading email content using graph API?