This documentation is archived and is not being maintained.

Getting a vCard Stream for a Contact

EWS Managed API

Topic Last Modified: 2006-06-12

Microsoft® Exchange Server 2007 supports the Internet industry vCard standard for obtaining contact information through the Collaboration Data Objects (CDO) Person object. You can import contact information from any vCard-compliant contact application.

The GetVCardStream Method on the IPerson Interface returns contact information by returning a Microsoft ActiveX® Data Objects (ADO) stream object.

The following example uses the CDO Person object to obtain vCard information for a contact.

Visual Basic

Dim oPerson As New CDO.Person
Dim strm As New ADODB.Stream

' Assume strURL is a valid URL to a person contact item
oPerson.DataSource.Open strURL

' You can set the ADO Stream object to the returned vCard stream
Set strm = oPerson.GetvCardStream

' Save the stream to a file.
' Note: using adSaveCreateOverwrite may cause an existing
' contact to be overwritten.
strm.SaveToFile "d:\vcard.txt", adSaveCreateOverwrite

' You don't have to set a Stream object,
' just use the Stream methods off GetvCardStream directly
oPerson.GetvCardStream.SaveToFile "d:\vcard.txt", adSaveCreateOverwrite