Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Importing Contacts to Exchange Server via web page


Message #1 by "aruna koya" <aruna.koya@e...> on Mon, 27 May 2002 13:27:53
On Exchange Server there is an option to do a directory import/export.  I 
need to put this on a web page where people can upload/download the 
directories.

I know I have to use CDO but how?  Any ideas anyone?

Thanks in advance.
RnR
Message #2 by "Siegfried Weber" <sweber@c...> on Thu, 30 May 2002 17:02:23 +0200
It depends on the Exchange Server version. With Exchange 2000 Server you
can use ADO, CDOEX or XML & WebDAV. While the latter one is the
recommended platform independent approach it is more complex and
requires advanced coding skills, ADO is pretty easy. You just need to
open a the folder in question and loop through all available records to
pull the data off.

Here's a sample snippet:

Set objConnection =3D CreateObject("ADODB.Connection")
Set objRecordSet =3D CreateObject("ADODB.RecordSet")
strURL =3D "http://yourserver/public/yourfolder"
objConnection.Provider =3D "Exoledb.DataSource"
objConnection.Open strURL
strSQL =3D "SELECT ""urn:schemas:httpmail:normalizedsubject"", "
strSQL =3D strSQL & """urn:schemas:contacts:cn"", "
strSQL =3D strSQL & """urn:schemas:httpmail:textdescription"", "
strSQL =3D strSQL & "FROM scope('shallow traversal of """ & strURL & 
"""')
"
strSQL =3D strSQL & "WHERE ""DAV:ishidden"" =3D False "
strSQL =3D strSQL & "AND ""DAV:isfolder"" =3D False "
strSQL =3D strSQL & "ORDER BY ""DAV:getlastmodified"" DESC"
With objRecordSet
  .Source =3D strSQL
  .ActiveConnection =3D objConnection
  .Open
  .MoveFirst
  If Not .EOF Then
    While Not .EOF
      ' Do something here
    Wend
  End If
End With

HTH

<Siegfried />

> -----Original Message-----
> From: aruna koya [mailto:aruna.koya@e...]
> Sent: Monday, May 27, 2002 3:28 PM
> To: ASP CDO
> Subject: [asp_cdo] Importing Contacts to Exchange Server via web page
>
> On Exchange Server there is an option to do a directory import/export.
I
> need to put this on a web page where people can upload/download the
> directories.
>
> I know I have to use CDO but how?  Any ideas anyone?
>
> Thanks in advance.
> RnR

  Return to Index