You can create a Business Note object and immediately add it to an Account, Business Contact, Opportunity, or Business Project object. A business note in Business Contact Manager for Outlook is not the same as a note in Outlook, which is basically an electronic notepad. In contrast, a business note can store the subject of the note, the name of the person who created it, and comments about the Account, Business Contact, Opportunity, or Business Project.
Note
To associate a Business Note object to multiple entities, you must create multiple objects.
The following C# and Visual Basic for Applications (VBA) examples show how to create a new business note and associate it with a new Account object.
private void CreateBusinessNote()
{
Outlook.ApplicationClass _app = new Outlook.ApplicationClass();
Outlook.Application olApp = (Outlook.Application)_app;
Outlook.NameSpace olNameSpace = _app.GetNamespace("MAPI");
Outlook.Folders folders = olNameSpace.Session.Folders;
Outlook.Folder bcmRootFolder = (Outlook.Folder)folders["Business Contact Manager"];
Outlook.Folder accountsFolder = (Outlook.Folder)bcmRootFolder.Folders["Accounts"];
Outlook.ContactItem newAccount = (Outlook.ContactItem)accountsFolder.Items.Add("IPM.Contact.BCM.Account");
newAccount.FullName = "Wide World Importers";
newAccount.FileAs = "WWImporters";
newAccount.Save();
string accountEntryID = newAccount.EntryID;
Outlook.Folder historyFolder = (Outlook.Folder)bcmRootFolder.Folders["Communication History"];
Outlook.JournalItem journalItem = (Outlook.JournalItem)historyFolder.Items.Add("IPM.Activity.BCM.BusinessNote");
journalItem.Type = "Business Note";
journalItem.Subject = "Discussion with Sales Manager";
journalItem.Body = "As per the discussion on 23-Jun-2005, we agreed to give 15% on our products";
if (journalItem.UserProperties["Parent Entity EntryID"] == null)
{
Outlook.UserProperty userProp = journalItem.UserProperties.Add("Parent Entity EntryID", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
userProp.Value = accountEntryID;
}
journalItem.Save();
}
Sub CreateBusinessNote()
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 bcmHistoryFolder As Outlook.Folder
Dim newAcct As Outlook.ContactItem
Dim newBusinessNote As Outlook.JournalItem
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")
newAcct.FullName = "Wide World Importers"
newAcct.FileAs = "Wide World Importers"
newAcct.Email1Address = "someone@example.com"
newAcct.Save
Set bcmHistoryFolder = bcmRootFolder.Folders("Communication History")
Set newBusinessNote = bcmHistoryFolder.Items.Add("IPM.Activity.BCM.BusinessNote")
newBusinessNote.Subject = "Business Note associated with Account"
newBusinessNote.Type = "Business Note"
If (newBusinessNote.UserProperties("Parent Entity EntryID") Is Nothing) Then
Set userProp = newBusinessNote.UserProperties.Add("Parent Entity EntryID", olText, False, False)
userProp.Value = newAcct.EntryID
End If
newBusinessNote.Save
Set newBusinessNote = Nothing
Set newAcct = Nothing
Set bcmHistoryFolder = Nothing
Set bcmAccountsFldr = Nothing
Set bcmRootFolder = Nothing
Set olFolders = Nothing
Set objNS = Nothing
Set olApp = Nothing