Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)

[Previous] [Next]

The Outlook ContactItem object supports many properties and methods. I'll describe the properties and methods that are unique to the ContactItem object.

ContactItem Object Properties

The ContactItem object contains the most properties of all the Outlook objects. For this reason, the following sections list a small but important subset of them. For the complete property list, see the Olform.hlp file on the companion CD.

NetMeetingAlias and NetMeetingServer Properties

The NetMeetingAlias and NetMeetingServer properties allow you to develop Outlook applications that take advantage of the real-time collaboration of Microsoft NetMeeting. By having your users fill in these properties with the NetMeeting user names and the NetMeeting server for their contacts, you can create dynamic Outlook applications that use these properties to start NetMeetings by using the callto:servername/alias syntax that NetMeeting provides. In order to use this syntax, your users must have NetMeeting installed on their machines. The following code, taken from the Account Tracking application (described in Chapter 7 of the book), shows how you can use these properties to start a NetMeeting session inside your applications. The code checks to see whether the NetMeetingAlias and NetMeetingServer properties are filled in and, if they are, the code automates the web browser control to use the callto: syntax to start NetMeeting.

Sub cmdNetMeetingContact_Click set oListBox = oDefaultPage.Controls("lstContacts") if oListBox.ListIndex = -1 then MsgBox "No selected account contact. Please select one.", _ 48, "NetMeeting Account Contact" else set oItem = oRestrictedContactItems(oListBox.ListIndex + 1) if oItem.NetMeetingAlias = "" then MsgBox "The NetMeeting information is not filled in " & _ "for this contact.", 48, "NetMeeting Account Contact" exit sub end if if oItem.NetMeetingServer = "" then MsgBox "The NetMeeting information is not filled in " & _ "for this contact.", 48, "NetMeeting Account Contact" exit sub end if on error resume next txtNetMeetingAddress = "callto:" & _ oItem.NetMeetingServer & "/" & oItem.NetMeetingAlias oWebBrowser.Navigate txtNetMeetingAddress if err.number <> 0 then msgbox "NetMeeting is either not installed or not " & _ "configured correctly.", 48, _ "NetMeeting Account Contact" exit sub end if end if End Sub

ContactItem Object Methods

The following section describes the ForwardAsVcard method of the Outlook ContactItem object.

ForwardAsVcard Method

The ForwardAsVcard method returns a MailItem object that contains the current ContactItem object as a Vcard attachment. Vcard is an Internet-standard way to share business card information between programs. In your applications, you can use this functionality in any of your custom contact forms to forward contact information over the Internet. As long as the users who receive the Vcard over the Internet have a Vcard-compliant program, they can drag and drop the contact information into their program. The following code shows you how to use the ForwardAsVcard method:

Sub CommandButton1_Click set oNS = Application.GetNameSpace("MAPI") set oContact = oNS.GetDefaultFolder(10) set oItems = oContact.Items set oContact = oItems.GetFirst set oNewMail = oContact.ForwardAsVcard oNewMail.Display End Sub

Категории