Pieter van der Westhuizen

Programming for Outlook Business Contact Manager (BCM)

Microsoft Business Contact Manager or BCM is a great way for mostly small businesses to manage their business contacts, sales leads and projects. The beauty of BCM for MS Office developers is the fact that it is entirely contained within MS Outlook; giving the user a seamlessly integrated experience with Outlook. Of course this fact provides you as Office developer an opportunity to add even more functionality to BCM by using Add-in Express.

First, you need to make sure that BCM is installed; if you’re using Outlook 2007 you’ll see an additional store in MS Outlook entitled Business Contact Manager. However, if like me, you’re using Outlook and BCM 2010, you’ll see an additional Business Contact Manager store as well as an Outlook solution module / pane.

Next, start a new ADX COM Add-in using Visual Studio.

Creating a new Add-in Express COM Add-in project in Visual Studio

Complete the New Microsoft Office COM Add-in Wizard by selecting your programming language, minimum supported Office version and Microsoft Outlook as the supported application.

We’ll add an advanced Outlook region and set it to only display on BCM Employees inspector windows. In order to accomplish this add a new ADXOutlookFormsManager to the AddinModule designer surface. Next, add a new Outlook Form item to your project.

Adding a new advanced Outlook region

Add the required functionality to the form. I’ve added a label and button that sends an e-mail to the employee. The design looks like this:

A label and button that sends an e-mail to the employee

The code to send the email is:

private void btnSendBonusLetter_Click(object sender, EventArgs e)
{
Outlook.Inspector currInspector = (Outlook.Inspector)this.InspectorObj;
if (currInspector.CurrentItem is Outlook.ContactItem)
{
    Outlook.ContactItem contactItem = currInspector.CurrentItem as Outlook.ContactItem;
    Outlook.Application outlookApp = (Outlook.Application)OutlookAppObj;
 
    Outlook.MailItem mailItem = outlookApp.CreateItem(Outlook.OlItemType.olMailItem)
		as Outlook.MailItem;
    mailItem.To = contactItem.Email1Address;
    mailItem.Body = String.Format("Dear {0},{1}", contactItem.FirstName, Environment.NewLine);
    mailItem.Body += "Thank you for your continued loyalty to our company." +
		Environment.NewLine;
    mailItem.Body += "As a token of our appreciation we are happy to inform you of a " +
		"10% increase to your monthly salary." + Environment.NewLine;
    mailItem.Body += "Thanks again," + Environment.NewLine;
    mailItem.Body += "-The Management Team" + Environment.NewLine;
    mailItem.Send();
    Marshal.ReleaseComObject(mailItem);
    Marshal.ReleaseComObject(contactItem);
}
}

Switch back to the Addin Module designer surface and add a new item to the ADXOutlookFormsManager you’ve added earlier. Set its properties as specified below.

  • InspectorLayout: LeftSubPane
  • InspectorMessageClass: IPM.Contact.BCM.Contact.1
  • InspectorMode: Read
  • FormClassName: BCMSample.BCMContact (The ADX Outlook Form you’ve added earlier)
  • AlwaysShowHeader: True

By setting the InspectorMessageClass we ensure that our advanced region will only be shown on the BCM employees form. If you’re wondering how to get BCM InspectorMessageClasses, I recommend you use a utility called OutlookSpy.

When you install OutlookSpy it adds a ribbon tab with a host of useful tools. To see the BCM employees form’s MessageClass, open an instance of it and click on the CurrentItem button on the OutlookSpy ribbon tab. This will display a window with all the information you need about the current Inspector object.

MessageClass property of the BCM ContactItem object

Build, register and run the add-in and you’ll notice the advanced Outlook region only displays on the BCM employee form.

Advanced Outlook region only displays on the BCM employee form

Adding your own ribbon tab to the Business Contact Manager Employee form takes a bit more work. Add an ADXRibbonTab component to the AddinModule designer surface and set its Visible property to False. Secondly, add an Outlook Events object to the AddinModule designer and add an event handler for the InspectorActivate event by selecting the Outlook Events object and double-clicking in the InspectorActivate event. This will automatically generate code for the event handler. Add the following code to the event handler:

private void adxOutlookEvents_InspectorActivate(object sender,
	object inspector, string folderName)
{
Outlook.Inspector currInsp = inspector as Outlook.Inspector;
if (currInsp.CurrentItem is Outlook.ContactItem)
{
    Outlook.ContactItem contact = currInsp.CurrentItem as Outlook.ContactItem;
    if (contact.MessageClass == "IPM.Contact.BCM.Contact.1")
    {
        customBCMRibbonTab.Visible = true;
    }
    else
    {
        customBCMRibbonTab.Visible = false;
 
    }
    Marshal.ReleaseComObject(contact);
}
}

This code will check if the current inspector object is a Contact and whether the current object’s MessageClass property is IPM.Contact.BCM.Contact.1. If it is, the ribbon tab will be visible, if not it will be hidden.

Thank you for reading. Until next time, keep coding.

Available downloads:

This sample add-in was developed using Add-in Express 2010 for Office and .net:
C# sample Outlook add-in

5 Comments

  • Steve Holderness says:

    This looks interesting but I’m not quite sure what is all provided once purchased. Is there something else you can share? I’m using BCM 2010 and Outlook 2010 and am looking for additional assistance with BCM; user friendly, project management, etc.

    Thanks,

    Steve

  • Pieter van der Westhuizen says:

    Hi Steve,

    Do you require more information on using BCM for Outlook or on customizing it using Add-in Express?

  • Denilson says:

    Hi Pieter!

    Is it possible to create new reports (more detailed) using these Add-in?

    I need to create a report that cross Contacts x Oportunitys (like a table with all contacts in lines, and oportunitys in collumns)?

    Thanks
    Denilson

  • Pieter van der Westhuizen says:

    Hi Denilson,

    I doubt you would be able to create a new report since we do not really have access to the BCM object model. You can however access the BCM database directly and create reports that way using either Excel or a reporting tool like Crystal Reports.

  • James says:

    Hi,

    I have some very important client in Gambling/Casino and Betting industry.We are looking at reputable sites to offer them opportunities to help promote some of our client sites.It would be beneficial and productive for both sides!

    Ideally I would be looking to add a new post on your blog. Our team of content writers will write an article designed to complement your website. The content would also include a followed link back to our client’s site.

    Is this something you would be interested in? How much do you charge?

    Thanks,
    James

Post a comment

Have any questions? Ask us right now!