Link to home
Start Free TrialLog in
Avatar of Phoenix_2
Phoenix_2

asked on

Viewing Outlook Emails by clicking on a hyperlink...

I am looking for a way to be able to view an email by clicking on a link.

Essentially, I am trying to keep track of certain emails in an external/third party program.  This program simply display a list of the email subjects.  When clicking on the link, the full text of the email is displayed.

Also, I was originally thinking that I could do this by using the PR_ENTRYID as the message's unique identifier, but reading further on this identifier, it appears that the PR_ENTRYID can change depending on a few different factors.

I can't seem to find too much on doing this, or I am looking in the wrong location.  Any help at all is greatly appreciated.

Thanks in advance!

Phoenix-2
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phoenix_2
Phoenix_2

ASKER

Thanks BlueDevilFan for the response.

I had already been scouring those pages and had seen the page(s) you linked.  I tried adding the registry entry yesterday and had no luck.  I decided to try it again this morning, and low and behold it worked!  There must have been a type in my entry.  However, I did get it working and the results are what I was looking for.

Now, this leads me into another question.  Everything that I have read points me to the PR_ENTRYID as the GUID that I want, however, the PR_ENTRYID changes depending on how the datastores are set up.  In addition, the PR_ENTRYID changes depending on which folder the message is placed into.  Nowhere have I been able to find reference to a GUID that is unique to the message at all times.

Would you happen to know if there is a GUID/UID that is unique to each message that never changes?  In addition, would you know how to grab this unique id without using third party tools like the MAPI editor that I am using?

Thanks in advance,

Phoenix-2
You're welcome.

Outlook items do not have a true GUID.  EntryID is the closest Outlook comes to having one.  An item's EntryID should not change so long as the item is not moved from one store to another (e.g. from a PST file to another PST file, from an Exchange mail store to PST file).  If you can't be certain that an item will remain in the same store, then the best suggestion I know of is to store the message in the file system.  You could then link to it with a file URL.
Is there a way to extract the EntryID (PR_ENTRYID) without using a 3rd party too such as a MAPI Editor?

I suppose that I could write some code to extract the value, storing the value in a database table, and the message on the file system.

Thanks again for all of your time.

Phoenix-2
Yes, you can extract the EntryID with any programming language that can access Outlook's object model.  For example, in VBA you'd use

SomeVariable = Item.EntryID

where SomeVariable is a variable and Item is an Outlook item (e.g. message, contact, appointment, etc.).
Yes, yes, yes!  I should have known that!  Brain is fried!

Thanks again for your time!

Phoenix-2
You're welcome.
BlueDevilFan (and all other experts) ~

I have another question in regards to Outlook and Outlook Web Access (OWA).  I have an email that I would like to view via OWA.  I have used a MAPI editor to grab the PR_ENTRYID from the email message.  I would like to convert the PR_ENTRYID to the Exchange Web Services Id (EWS) so that I can create the URL And display the email through OWA.

Here is what I have done:

PR_ENTRYID = 0000000034E9C2678E77E6448CDC18FFB30C89CC07005735D6F34030134A80136D21A793BDD7000000E3750700005735D6F34030134A80136D21A793BDD700000188F4F40000" ;

I have a function that I have created (many examples out there on the web) that takes care of the converting of the ids.

string ConvertHexEntryIdToEwsId(ExchangeService service, string entryId, string mailbox)
{
    AlternateId hexEntryId = new AlternateId( IdFormat.HexEntryId, idToConvert, mailbox);
    AlternateId ewsId = service.ConvertId(hexEntryId, IdFormat .EwsId) as AlternateId;

    Console.WriteLine("Hex Entry Id: " + hexEntryId.UniqueId);
    Console.WriteLine("EWS Id: " + ewsId.UniqueId);

    return ewsId.UniqueId;
}

The result of the function call is:
AAMkADlkNTE1MzMxLWYzMzctNDdmNi05OWFkLWYxYmU0ZTk2ODJhMQBGAAAAAAA06cJnjnfmRIzcGP+zDInMBwBXNdbzQDATSoATbSGnk73XAAAA43UHAABXNdbzQDATSoATbSGnk73XAAABiPT0AAA=

However, in the actual URL that I have in OWA, it should be:
RgAAAAA06cJnjnfmRIzcGP%2bzDInMBwBXNdbzQDATSoATbSGnk73XAAAA43UHAABXNdbzQDATSoATbSGnk73XAAABiPT0AAAA

Needless to say, that if I use the AAMk... id, I get an error.  If I use the RgAAA... id, it displays the message perfectly.

I have tried going backwards, converting the EWS Id into the Hex/Entry Id, but I get errors there too.  Because of this, I really feel that I am either using the wrong conversion, or I have missed a step.

It really seems like this would be straight forward.  What am I missing?  Any thoughts?

Thanks in advance,

Phoenix-2
I've no experience with Exchange Web Services.  That said, the code in this example looks a bit different than what you posted above.  How about giving it a try?