I am trying to get the address associated with a user from Outlook using this following code and it seems to consistently fail on some machines:-
var application = CurrentAppointmentItem.Application;
var session = application.Session;
var organizer = CurrentAppointmentItem.GetOrganizer();
var recipient = session.CreateRecipient(organizer.Name);
var addressEntry = recipient.AddressEntry;
var propertyAccessor = addressEntry.PropertyAccessor;
var addressProperty = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x800F101E");
The error is:-
System.Runtime.InteropServices.COMException (0x80004005): The operation failed.
at Microsoft.Office.Interop.Outlook.PropertyAccessorClass.GetProperty(String SchemaName)
To be specific I am trying to get the SIP address (not the SMTP address) of the current user, does anyone have any ideas?
Extra info: despite the error message being on propertAccessor.GetProperty() it turns out that recipient.Resolve() fails for the recipient in the coded example.