Error when accessing a property

Add-in Express™ Support Service
That's what is more important than anything else

Error when accessing a property
Error when accessing a property 
GKoehn




Posts: 37
Joined: 2009-03-23
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.
Posted 22 Nov, 2013 17:43:44 Top
Andrei Smolin


Add-in Express team


Posts: 14372
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?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Nov, 2013 00:28:20 Top