The following C# and Visual Basic for Applications (VBA) examples show how to create a new Account object and assign to it some basic information about the account, such as the Account name, primary contact, business address, telephone, and e-mail address.
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim bcmRootFolder As Outlook.Folder
Dim olFolders As Outlook.Folders
Dim bcmAccountsFldr As Outlook.Folder
Dim newAcct As Outlook.ContactItem
Dim userProp As Outlook.UserProperty
Set olApp = CreateObject("Outlook.Application")
Set objNS = olApp.GetNamespace("MAPI")
Set olFolders = objNS.Session.Folders
Set bcmRootFolder = olFolders("Business Contact Manager")
Set bcmAccountsFldr = bcmRootFolder.Folders("Accounts")
Set newAcct = bcmAccountsFldr.Items.Add("IPM.Contact.BCM.Account")
If (newAcct.UserProperties("Source of Lead") Is Nothing) Then
Set userProp = newAcct.UserProperties.Add("Source of Lead", olText, False, False)
userProp.Value = "Advertisement"
End If
If (newAcct.UserProperties("Territory") Is Nothing) Then
Set userProp = newAcct.UserProperties.Add("Territory", olText, False, False)
userProp.Value = "North"
End If
newAcct.Save
Set newItemProp = Nothing
Set newAcct = Nothing
Set bcmAccountsFldr = Nothing
Set bcmRootFolder = Nothing
Set olFolders = Nothing
Set objNS = Nothing
Set olApp = Nothing