Reputation: 111
I'm converting the following example code to Delphi:
http://msdn.microsoft.com/en-us/library/bb176406%28v=office.12%29.aspx
My code is something like:
var vTable, vRow: OleVariant; begin .... while vTable.EndOfTable = False do begin vRow := vTable.GetNextRow; sEmail := vRow['Email1Address']; ShowMessage(sEmail); end; end;
The problem is that I need to pass a string index, 'Email1Address', but Delphi gives the error: Incompatible types: Integer and string.
Should I be using a different type of variant?
TIA
Upvotes: 0
Views: 761
Reputation: 7062
I've taken a look at the Outlook unit generated from a TLB file and it looks like this:
_Row = interface(IDispatch)
['{000630D3-0000-0000-C000-000000000046}']
//snip
function Item(Index: OleVariant): OleVariant; safecall;
//snip
end;
The Row interface has a method Item, which takes an OleVariant. So use this:
sEmail := vRow.Item('Email1Address');
Also take a look at the MSDN help.
Upvotes: 3