Get message id of multiple email with same subject using graph client in C#

SAC_535 36 Reputation points
2022-04-19T10:40:35.647+00:00

We have outlook addin built in C# .net where user selects any email from inbox to perform some operations. It is working fine for email with unique subject in inbox but if we have multiple email with same subject then its picks random email from mailbox with same subject which does not satisfy our condition.
Need help to get message id of selected email message using Graph client in C# .net.

Below code works for Outook 2016 or below user but user with M365 its not working
string ConvertHexEntryIdToEwsId(ExchangeService esb, string sID, string strSMTPAdd)
{
AlternateId objAltID = new AlternateId();
objAltID.Format = IdFormat.HexEntryId;
objAltID.Mailbox = strSMTPAdd;
objAltID.UniqueId = sID;

AlternateIdBase objAltIDBase = esb.ConvertId(objAltID, IdFormat.EwsId);
AlternateId objAltIDResp = (AlternateId)objAltIDBase;
return objAltIDResp.UniqueId;
}

Need help to convert HexEntryid to Graph client Message id or other way to get message id of selected message from inbox.
eg.HexEntryId: 0000000042388A9A3ACF664B976EBDC1B0907873070020FE808A154DAE42A53AAF935C0D5C0000000000010C000020FE808A154DAE42A53AAF935C0D5C000002AD8313E90000

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