by Brett Greiner >> Tue, 9 Dec 2003 3:34:42 GMT
Hi,
Wanting to know if anyone has used Jade to extract information out of Microsoft Exchange.
If so, what was best way of doing this?
Cheers,
Brett Greiner,
Kinetix.
Code: Select all
zLoadAddressesFromOutlook(
pcAddressType : Character
) protected;
vars
oOutlookApp : OLApplication;
oNameSpace : I_OLNameSpace;
oContacts : OLMAPIFolder;
oItems : I_OLItems;
oDispatch : IDispatch;
oContactItem : I_OLContactItem;
bContactItem : Boolean;
sName : String;
sAddress : String;
begin
on Exception do zHandleAddressBookException( exception, bContactItem );
// Create Outlook application.
create oOutlookApp transient;
oOutlookApp.createAutomationObject;
// Get namespace and Contacts folder reference.
oNameSpace := oOutlookApp.getNamespace( "MAPI" );
zAllOutlookAddresses.clear;
zAllOutlookNames.clear;
lbAvailable.clear;
oContacts := oNameSpace.getDefaultFolder( OLApplication.OlFolderContacts );
oItems := oContacts.items;
oItems.sort( "FullName", false );
oDispatch := oItems.getFirst();
while oDispatch <> null do
bContactItem := true;
oContactItem := oDispatch.getInterface(I_OLContactItem).I_OLContactItem;
if bContactItem then
if pcAddressType = AddressType_Fax then
if oContactItem.homeFaxNumber <> null then
sName := oContactItem.fullName & " (Home Fax)";
sAddress := oContactItem.homeFaxNumber;
zAllOutlookNames.add( sName );
zAllOutlookAddresses.add( sAddress );
lbAvailable.addItem( sName & ' <' & sAddress & '>' );
endif;
if oContactItem.businessFaxNumber <> null then
sName := oContactItem.fullName & " (Business Fax)";
sAddress := oContactItem.businessFaxNumber;
zAllOutlookNames.add( sName );
zAllOutlookAddresses.add( sAddress );
lbAvailable.addItem( sName & ' <' & sAddress & '>' );
endif;
if oContactItem.otherFaxNumber <> null then
sName := oContactItem.fullName & " (Other Fax)";
sAddress := oContactItem.otherFaxNumber;
zAllOutlookNames.add( sName );
zAllOutlookAddresses.add( sAddress );
lbAvailable.addItem( sName & ' <' & sAddress & '>' );
endif;
elseif pcAddressType = AddressType_Email then
if oContactItem.email1AddressType ="SMTP" then
if oContactItem.email1Address <> null then
sName := oContactItem.email1DisplayName;
sAddress := oContactItem.email1Address;
zAllOutlookNames.add( sName );
zAllOutlookAddresses.add( sAddress );
lbAvailable.addItem( sName & ' <' & sAddress & '>' );
endif;
if oContactItem.email2AddressType ="SMTP" then
if oContactItem.email2Address <> null then
sName := oContactItem.email2DisplayName;
sAddress := oContactItem.email2Address;
zAllOutlookNames.add( sName );
zAllOutlookAddresses.add( sAddress );
lbAvailable.addItem( sName & ' <' & sAddress & '>' );
endif;
if oContactItem.email3AddressType ="SMTP" then
if oContactItem.email3Address<> null then
sName := oContactItem.email3DisplayName;
sAddress := oContactItem.email3Address;
zAllOutlookNames.add( sName );
zAllOutlookAddresses.add( sAddress );
lbAvailable.addItem( sName & ' <' & sAddress & '>' );
endif;
endif;
endif;
delete oDispatch;
oDispatch := oItems.getNext;
endwhile;
epilog
delete oItems;
delete oContacts;
delete oNameSpace;
delete oOutlookApp;
end;
Code: Select all
zHandleAddressBookException(
poException : Exception input;
pbIsContact : Boolean io
) : Integer protected;
vars
begin
if poException.errorCode = 14150 then
// Found an address list in the contact folder. Can't use this in the email code.
pbIsContact := false;
return Ex_Resume_Next;
else
return Ex_Pass_Back;
endif;
end;
Return to “Tips and Techniques”
Users browsing this forum: No registered users and 13 guests