Page 1 of 1

Microsoft Exchange

Posted: Fri Aug 07, 2009 2:48 pm
by ConvertFromOldNGs
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.

Re: Microsoft Exchange

Posted: Fri Aug 07, 2009 2:48 pm
by ConvertFromOldNGs
by Scott >> Fri, 9 Jan 2004 2:26:02 GMT

What version of Exchange?
I have used CDO to extract data in the past with a reasonable amount of success.

Re: Microsoft Exchange

Posted: Fri Aug 07, 2009 2:48 pm
by ConvertFromOldNGs
by Brett Greiner >> Thu, 22 Jan 2004 21:11:34 GMT

Exchange 2000 we are using.

Did you find the CDO east to setup/use?

Cheers,
Brett.

Re: Microsoft Exchange

Posted: Tue Dec 15, 2009 4:51 pm
by adamr
I note you say you are on Microsoft Exchange 2000 but FYI Microsoft Exchange 2007 has Web Services available to request data which could make it simple (Public Folder based Web Services after SP1).

On the Exchange 2000/2003 side I had some play with ADO, and here is a simple script I had in ASP that maybe of some use -

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<TITLE></TITLE>
</HEAD>
<BODY>



<% Dim Rec
Dim Rs
Dim strURL
Dim strQ

Dim DomainName
Dim strLocalPath

' Specify your own domain. (This should actually refer to the Default Recipient Policies default domain address)
DomainName = "Your.domain.local"

' Specify a URL to a folder or item.
strLocalPath = "public folders/ContactFolder"

Set Rec = CreateObject("ADODB.Record")
Set Rs = CreateObject("ADODB.Recordset")

' This URL is for a public folder.
strURL = "file://./backofficestorage/" & DomainName & "/" & strLocalPath
Rec.Open strURL

' Construct the SQL query to run on the folder.
' To avoid confusion in escaping quotes,
' Chr(34)s are used to delimit the URL.

strQ = "select "
strQ = strQ & " ""urn:schemas:mailheader:content-class"" "
strQ = strQ & ", ""DAV:href"" "
strQ = strQ & ", ""DAV:displayname"" "
strQ = strQ & ", ""DAV:id"" "
strQ = strQ & ", ""DAV:getlastmodified"" "
strQ = strQ & ", ""urn:schemas:contacts:email1"" "
strQ = strQ & ", ""urn:schemas:contacts:cn"" "
strQ = strQ & ", ""urn:schemas:contacts:sn"" "
strQ = strQ & ", ""urn:schemas:contacts:title"" "
strQ = strQ & ", ""urn:schemas:contacts:telephoneNumber"" "
strQ = strQ & ", ""urn:schemas:contacts:email1"" "
strQ = strQ & " from scope ('shallow traversal of "
strQ = strQ & Chr(34) & strURL & Chr(34) & "')"
strQ = strQ & " ORDER BY ""DAV:displayname"" "

Rs.Open strQ, Rec.ActiveConnection

Rs.MoveFirst

While Not Rs.EOF

Response.Write "GUID:" & Rs.Fields("DAV:id").Value & ","
Response.Write "CN:" & Rs.Fields("urn:schemas:contacts:cn").Value & ","
Response.Write "SN:" & Rs.Fields("urn:schemas:contacts:sn").Value & ","
Response.Write "Title:" & Rs.Fields("urn:schemas:contacts:title").Value & ","
Response.Write "Modified:" & Rs.Fields("DAV:getlastmodified").Value & ","
Response.Write "Phone:" & Rs.Fields("urn:schemas:contacts:telephoneNumber").Value & ","
Response.Write "Email1:" & Rs.Fields("urn:schemas:contacts:email1").Value & "</br>"
Rs.MoveNext

Wend


Rs.Close
Rec.Close

%>
<p>
</BODY>
</HTML>

Re: Microsoft Exchange

Posted: Wed Dec 16, 2009 8:51 am
by torrie
We use the Outlook Active X Library to access list of contacts etc in Exchange. You can use a similar mechanism for email etc. The Code looks something like this

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;
The exception handler handles the case where we find a group in the address book

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;