GKoehn
Guest
|
I am trying to read a property that may or may not exists.
Here is my code...
const PropNameForFirmGuid = 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORIONFGUID';
function TUIOrionOfficeOutlookEmailPanel.GetFirmGuidFromItem: string;
var
Mail: _MailItem;
begin
sndmsgts('[I] GetFirmGuidFromItem');
FItemsFirmGuid := '';
try
OutlookAppObj.ActiveInspector.CurrentItem.QueryInterface(IID__MailItem,Mail);
if Assigned(Mail) then
begin
try
FItemsFirmGuid := (OleVariant(OutlookAppObj.ActiveInspector.CurrentItem).PropertyAccessor.GetProperty(PropNameForFirmGuid));
except
sndmsgts('... EXCEPTION Accessing the FirmGUID');
end;
end;
except
end;
result := FItemsFirmGuid;
sndmsgts('[O] GetFirmGuidFromItem');
end;
The Procedure call of sndmsgts is a debug logging system I use.
On a specific users system, It surfaces an error!
Why is the error not handled?
What am I doing wrong?
My original code had an empty except block and it still surfaced to the user.
Is there a way to check for a property without try..except block?
The error the user sees is...
(TadxOlForm.AdxOlShow): the add-in has fired an exception.
The property "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ORIONFGUID" does not support this operation. |
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello,
GKoehn writes:
FItemsFirmGuid := (OleVariant(OutlookAppObj.ActiveInspector.CurrentItem).PropertyAccessor.GetProperty(PropNameForFirmGuid));
You can try doing the above in two steps: get the PropertyAccessor first and call the method then.
But it doesn't look like the exact exception location. Are you sure that it occurs here? How do you set this property? Can it be that sndmsgts generates this exception?
Andrei Smolin
Add-in Express Team Leader |
|