G
gregarican
What's a "Ruby way" of handling this situation? I am using XMLRPC to
pass Microsoft Exchange CDO data back and forth between a Linux client
and a Windows server. The problem occurs when I am trying to pull CDO
data for MAPI fields that aren't assigned a value.
For example, pulling MAPI Contact data there is always a display name
field value. I would access this by doing something like:
display_name = thisContact.Fields.Item(0x3001001F).Value
where the 0x3001001F hex value is the MAPI property id for display
name.
But when I access a blank field that hasn't been assigned a value yet
by doing something like:
fax_number = thisContact.Fields.Item(0x3A24001E).Value
I receive an XMLRPC::FaultException error that specifies
MAPI_E_NOT_FOUND(0x8004010F). This field exists but if it's blank it
raises an exception.
What I am looking to do is to the pseudo-code equivalent of:
if MAPI_E_NOT_FOUND
fax_number = nil
else
fax_number = thisContact.Fields.Item(0x3A24001E).Value
end
I haven't worked much with exception handling within Ruby and am
admittedly ignorant. What's the best way of accomplishing this? I don't
want the script to bomb out and exit, I just want it to assign a nil
value...
pass Microsoft Exchange CDO data back and forth between a Linux client
and a Windows server. The problem occurs when I am trying to pull CDO
data for MAPI fields that aren't assigned a value.
For example, pulling MAPI Contact data there is always a display name
field value. I would access this by doing something like:
display_name = thisContact.Fields.Item(0x3001001F).Value
where the 0x3001001F hex value is the MAPI property id for display
name.
But when I access a blank field that hasn't been assigned a value yet
by doing something like:
fax_number = thisContact.Fields.Item(0x3A24001E).Value
I receive an XMLRPC::FaultException error that specifies
MAPI_E_NOT_FOUND(0x8004010F). This field exists but if it's blank it
raises an exception.
What I am looking to do is to the pseudo-code equivalent of:
if MAPI_E_NOT_FOUND
fax_number = nil
else
fax_number = thisContact.Fields.Item(0x3A24001E).Value
end
I haven't worked much with exception handling within Ruby and am
admittedly ignorant. What's the best way of accomplishing this? I don't
want the script to bomb out and exit, I just want it to assign a nil
value...