In the code window, replace all the code with the following.
Note You must run the following code sample on a computer that is
running Microsoft Exchange 2000 Server for the code sample to run correctly.
Module Module1
Sub Main()
' TODO: Replace the URL with your folder URL.
Dim sURL As String
sURL = "http://<ExchServer>/Exchange/<UserAlias>/Contacts"
Dim oCn As ADODB.Connection = New ADODB.Connection()
oCn.Provider = "exoledb.datasource"
oCn.Open(sURL, "", "", 0)
If oCn.State = 1 Then
Console.WriteLine("Good Connection")
Else
Console.WriteLine("Bad Connection")
Return
End If
Dim oPerson As CDO.Person = New CDO.Person()
oPerson.Title = "Engineer"
oPerson.FirstName = "Joe"
oPerson.LastName = "Healy"
oPerson.Company = "Fabrikam, Inc."
oPerson.Email = "abc@fabrikam.com"
oPerson.FileAs = "Joe Healy"
oPerson.DataSource.SaveToContainer(sURL, , _
ADODB.ConnectModeEnum.adModeReadWrite, _
ADODB.RecordCreateOptionsEnum.adCreateNonCollection, _
ADODB.RecordOpenOptionsEnum.adOpenSource, _
"", "")
oCn.Close()
oPerson = Nothing
oCn = Nothing
End Sub
End Module
|