I am working on Outlook add-in and doing some Encryption and Decryption. I created some hashed string on the server during POST request. That string is later passed to GET request and on the server I need to compare that hashed string to see if the user is the same user who did POST request.
When I make a GET request I also send user smtp using Office.context.mailbox.userProfile.emailAddress
.
Question: How can find user mailboxGUID(or account information which will include mailboxGUID and more) using their email address?
Do you want the AD/Directory GUID or the ExchangeGUID ? you can get the ADGuid using ResolveName and specifying the property set (this works from 2010 up) eg
PropertySet exProp = new PropertySet(BasePropertySet.FirstClassProperties);
NameResolutionCollection ncCol = service.ResolveName("user@domain.com", ResolveNameSearchLocation.DirectoryOnly, true, exProp);
if (ncCol.Count == 1)
{
Console.WriteLine(ncCol[0].Contact.DirectoryId);
}
The MailboxGUID makes up part of the FolderId format so can be parsed out that https://msdn.microsoft.com/en-us/library/ee217297(v=exchg.80).aspx if you really need it.