You can create an Opportunity object and link it to a new or existing Account object. If linked with an Account, the History section of the Account form displays details of the Opportunity and the Link To field on the Opportunity form displays the Account name. When you create an Opportunity programmatically, you must reload the Opportunity object before the Account link will appear on the Opportunity form.
The following C# and Visual Basic for Applications (VBA) examples show how to create a new Opportunity and link it to a new Account object.
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 bcmOppFolder As Outlook.Folder
Dim newAcct As Outlook.ContactItem
Dim newOpportunity As Outlook.TaskItem
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 bcmOppFolder = bcmRootFolder.Folders("Opportunities")
Set newAcct = bcmAccountsFldr.Items.Add("IPM.Contact.BCM.Account")
newAcct.FullName = "Wide World Importers"
newAcct.FileAs = "Wide World Importers"
newAcct.Email1Address = "someone@example.com"
newAcct.Save
Set newOpportunity = bcmOppFolder.Items.Add("IPM.Task.BCM.Opportunity")
newOpportunity.Subject = "Opportunity For Wide World Importers to enter into Retail Field"
If (newOpportunity.UserProperties("Parent Entity EntryID") Is Nothing) Then
Set userProp = newOpportunity.UserProperties.Add("Parent Entity EntryID", olText, False, False)
userProp.Value = newAcct.EntryID
End If
newOpportunity.Save
Set newOpportunity = Nothing
Set newAcct = Nothing
Set bcmOppFolder = Nothing
Set bcmAccountsFldr = Nothing
Set bcmRootFolder = Nothing
Set olFolders = Nothing
Set objNS = Nothing
Set olApp = Nothing