Create a Business Project linked to a Primary Business Contact
Article
Outlook Developer Reference
Create a Business Project linked to a Primary Business Contact
You can create a Business Project object and link it to one or more Business Contact objects, but the business project can have only one primary Business Contact. If linked with a Business Contact, the History section of the Business Contact form displays details of the project and the Link To field on the Business Project form displays the Business Contact name.
The following C# and Visual Basic for Applications (VBA) examples show how to create a new business project and link it to a new Business Contact object.
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim olFolders As Outlook.Folders
Dim bcmRootFolder As Outlook.Folder
Dim bcmContactsFldr As Outlook.Folder
Dim newContact As Outlook.ContactItem
Dim newProject 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 bcmContactsFldr = bcmRootFolder.Folders("Accounts")
Set bcmProjFolder = bcmRootFolder.Folders("Business Projects")
Set newProject = bcmProjFolder.Items.Add("IPM.Task.BCM.Project")
newProject.Subject = "Project For Wide World Importers to enter into Retail Field"
If (newProject.UserProperties("Parent Entity EntryID") Is Nothing) Then
Set userProp = newProject.UserProperties.Add("Parent Entity EntryID", olText, False, False)
userProp.Value = newContact.EntryID
End If
newProject.Save
Set newProject = Nothing
Set newContact = Nothing
Set bcmProjFolder = Nothing
Set bcmContactssFldr = Nothing
Set bcmRootFolder = Nothing
Set olFolders = Nothing
Set objNS = Nothing
Set olApp = Nothing