Home   |   Asp.Net 2.0   |   .Net Framework 2.0   |   IIS 6.0   |   Sql Server 2005   |   Visual Basic 2005   |   c# 2005   |   VS 2005   |   Visual Source Safe 2005

MS Dynamics CRM 3.0

SharePoint Portal Server 2003
SharePoint Server 2007
Dynamics NAV
Dynamics CRM
SharePoint Designer 2007
SharePoint Portal Server 2001
Windows SharePoint Services
Windows SharePoint Services 3.0
Project Server 2003
Project Server 2007
Dynamics – Point of Sale
Dynamics AX
Dynamics GP
Dynamics Retail Management System (RMS)
Dynamics SL
SQL Server 2000
Visual Basic .NET 2003
Visual C# .NET 2003
Visual C++ .NET 2003
Visual C++ 2005
Visual SourceSafe 6.0
Windows Server 2003
Windows Server 2003
Outlook 2003
ADO.NET 1.1
ASP.NET 1.0
Visual Studio Team Foundation Server
Visual Studio 2005 Team Edition
Windows Internet Explorer 7
BizTalk Server 2000
BizTalk Server 2002
BizTalk Server 2004
BizTalk Server 2006
Visual Studio 6.0
Access 2000
Access 2002
Access 2003
Access 2007
Access 97
Collaboration Data Objects 2.0
Commerce Server 2002
Content Management Server 2001
Commerce Server 2007
Content Management Server 2002
Data Access Components 2.7
Data Access Components 2.8
DirectX 9.0b
Office Small Business Accounting 2006
Accounting 2007
ActiveSync 4.1
Class Server 2.0
Groove 2007
Windows Vista
Outlook 2007
OneNote 2003
OneNote 2007
Office X for Mac
Zune software
Zune Live
Zoo Tycoon 2
Flight Simulator 2002
Dungeon Siege II

Cervo Technologies
The Right Source to Outsource

Oracle Database FAQS

Sharepoint Portal Server KB

Outlook 2007 Knowledge Base Articles

Collaboration Data Objects 2.0 Knowledge Base Articles

Describes how to create an Outlook contact by using the CDO for Exchange 2000 Library and the ExOLEDB provider. This article contains a Visual Basic .NET code sample.


This article describes how to use the Microsoft Collaboration Data Objects (CDO) for Microsoft Exchange 2000 (CDOEX) library and the Exchange OLE DB provider (ExOLEDB) to create a Microsoft Outlook contact in Microsoft Visual Basic .NET.

MORE INFORMATION

To use the CDOEX library and the ExOLEDB provider to create an Outlook contact in Visual Basic .NET, follow these steps:
1.Start Microsoft Visual Studio .NET.
2.On the File menu, point to New, and then click Project.
3.Under Project Types, click Visual Basic Projects.
4.Under Templates, click Console Application, and then click OK.

By default, Module1.vb is created.
5.Add a reference to the Microsoft CDO for Exchange 2000 library. To do this, follow these steps:
a. On the Project menu, click Add Reference.
b. On the COM tab, click Microsoft CDO for Exchange 2000 Library, and then click Select.
c. In the Add References dialog box, click OK to accept your selections. If you receive a prompt to generate wrappers for the libraries that you selected, click Yes.
6.Follow the same steps to add a reference to the Microsoft ActiveX Data Objects 2.5 Library.
7.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
					
8.Search for "TO DO" in the code, and then modify the code for your environment.
9.Press F5 to build and to run the program.
10.Verify that the contact has been created.


APPLIES TO
Microsoft Visual Basic .NET 2002 Standard Edition
Microsoft Visual Basic .NET 2003 Standard Edition
Microsoft Exchange 2000 Server Standard Edition
Collaboration Data Objects for Exchange 2000
Microsoft ActiveX Data Objects 2.5
Microsoft ActiveX Data Objects 2.6
Microsoft ActiveX Data Objects 2.7

Keywords: 
kbhowto KB314374
Copyright © 2004 - 2007 Gridview.org, Inc. All rights reserved. Powered by Smart Web Content Management System