Phone Logs
Business Contact Manager for Outlook allows you to track phone interactions with an Account, Business Contact, Opportunity, or Business Project object.
Note To link a Phone Log object to multiple entities, you must create multiple Phone Log objects.
The following C# and Visual Basic for Applications (VBA) examples show how to create a new phone log and link it to a new Account object.
C#
private void CreatePhoneLog()
{
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.PhoneCall");
journalItem.Type = "Phone Log";
journalItem.Subject = "Tele-Conference on 23-June-2005";
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();
}
VBA
Sub CreatePhoneLog()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim olFolders As Outlook.Folders
Dim bcmRootFolder As Outlook.Folder
Dim bcmAccountsFldr As Outlook.Folder
Dim bcmHistoryFolder As Outlook.Folder
Dim newAcct As Outlook.ContactItem
Dim newPhoneLog As Outlook.JournalItem
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 bcmHistoryFolder = bcmRootFolder.Folders("Communication History")
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 newPhoneLog = bcmHistoryFolder.Items.Add("IPM.Activity.BCM.PhoneCall")
newPhoneLog.Type = "Phone Log"
newPhoneLog.Subject = "Called the Account and settled down the Tax Issue and took the confirmation"
If (newPhoneLog.UserProperties("Parent Entity EntryID") Is Nothing) Then
Set userProp = newPhoneLog.UserProperties.Add("Parent Entity EntryID", olText, False, False)
userProp.Value = newAcct.EntryID
End If
newPhoneLog.Save
Set newPhoneLog = Nothing
Set newAcct = Nothing
Set bcmAccountsFldr = Nothing
Set bcmHistoryFolder = Nothing
Set bcmRootFolder = Nothing
Set olFolders = Nothing
Set objNS = Nothing
Set olApp = Nothing
End Sub
See Also
About Communication History Items | 2007 Office System: Updated Developer Content