outlook business contacts manager link

Posted on 2011-10-17
Last Modified: 2012-05-12
I would like to create an opportunity in outlook business contact manager and add a comment in a custom field.
Creation off the opportunity works but can't find how to write in the custom field.
Sub CreateOpportunityWithAccount()

   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 = ""

   Set newOpportunity = bcmOppFolder.Items.Add("IPM.Task.BCM.Opportunity")
        newOpportunity.Subject = "Opportunity For Wide World Importers to enter into Retail Field"
        'Add to a custom field: 'Total Income'
   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


   Set newOpportunity = Nothing
   Set newAcct = Nothing
   Set bcmOppFolder = Nothing
   Set bcmAccountsFldr = Nothing
   Set bcmRootFolder = Nothing
   Set olFolders = Nothing
   Set objNS = Nothing
   Set olApp = Nothing

End Sub

Open in new window

Question by:erezabou
    1 Comment
    LVL 11

    Accepted Solution

    You are already adding a custom field in the following lines:

    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 you can do:

    If (newOpportunity.UserProperties("TotalIncome") Is Nothing) Then
            Set userProp = newOpportunity.UserProperties.Add("TotalIncome", olText, False, False)
            userProp.Value = myTotalIncome  '* or whatever the value should be
       End If

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now