0

Is it possible to assign EmailMessage specific GUID/ID, which will be later used for search?

var email = new EmailMessage(_service);
email.ExternalGuid = /*Guid or Identifier*/;
email.Send();

And later I should be able to use it to find if this mail is present:

var isExist = _service.IsExistByExternalGuid(/*Guid or Identifier*/);
eocron
  • 6,885
  • 1
  • 21
  • 50

1 Answers1

0

Why don't you use the InternetMessageid eg Internet Message ID FROM EWS Managed API Send Email c# this Id will then appear in any tracking logs associated with the Message and you can search for the message at a later date using a SearchFilter eg

     ItemView ivew = new ItemView(3);
  service.TraceEnabled = true;
  ExtendedPropertyDefinition PidTagInternetMessageId = new ExtendedPropertyDefinition(4149, MapiPropertyType.String);
  SearchFilter sf = new SearchFilter.IsEqualTo(PidTagInternetMessageId, MessageID);
  FindItemsResults<Item> iCol = service.FindItems(WellKnownFolderName.Inbox, sf, ivew);

  foreach (Item item in iCol.Items)
  {
    Console.WriteLine(item.Subject);
  }
Glen Scales
  • 20,495
  • 1
  • 20
  • 23