Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

outlook business contacts manager link

Posted on 2011-10-17
1
Medium Priority
?
528 Views
Last Modified: 2012-05-12
Hi,
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.
Thanks
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 = "someone@example.com"
   newAcct.Save

   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'
        newOpportunity.....
   
   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

   newOpportunity.Save

   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

0
Comment
Question by:erezabou
1 Comment
 
LVL 11

Accepted Solution

by:
DavidT543 earned 2000 total points
ID: 36985258
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

...so 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
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
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…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

578 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