Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Aug 2001
    Location
    Lanham, Maryland
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating Outlook XP Contacts from Access XP (XP)

    In Access I have two tables. One for Companies and one for POCs (Point of Contact). There are cases where someone can be the POC for more than one company. In Outlook for a Contact, I can select one or more contact names to be associated with particular contact. I want to create an Outlook Contact folder, add the company records to it, and then add the POC records. When I add the POC record, I would like to populate the 'Contacts...' field I see on the Outlook Contact form, with the Company the POC is associated with. I am unsure of which field in the Outlook object model I should be using and how.
    Here is a related thread <post#=373329>post 373329</post#>.

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Creating Outlook XP Contacts from Access XP (XP)

    I'm not sure, but I suspect it's part of the Links collection associated with any Contact, so you would use the Add method to link the source Contact to the target. I have no experience setting a Link in code.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Creating Outlook XP Contacts from Access XP (XP)

    I see that my reply didn't tell you anything that Wendell had not already. Did you look at the GetItemFromID Method?

    Returns a Microsoft Outlook item identified by the specified entry ID (if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.

    expression.GetItemFromID(EntryIDItem, EntryIDStore)
    expression Required. An expression that returns a NameSpace object.

    EntryIDItem Required String. The EntryID of the item.

    EntryIDStore Optional Variant. The StoreID for the folder. EntryIDStore usually must be provided when retrieving an item based on its MAPI IDs.

    For more information about Entry IDs, see the EntryID property


    I have used Folder ID level code, but not Item ID code. ID codes are fixed in Outlook provided the item is not moved to another folder. What I'm wondering is, how will the logic know which ID to apply? (LIke the old joke about how does the thrmos know to keep hot things hot and cold things cold?)
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    Lounger
    Join Date
    Aug 2001
    Location
    Lanham, Maryland
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Outlook XP Contacts from Access XP (XP)

    John, thanks. I have looked at the GetItemFromID Method. It was my thought that I could use that to get the 'unique' id. But I do not know what field in a contact item I need to set to this unique id. Also, based on Outlook contacts, I think I should be able to set a POC contact item to point to multiple company contact items.

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Creating Outlook XP Contacts from Access XP (XP)

    Dick, it occurs to me that you can't use EntryID's to address multiple users Contacts lists, because no two ID's will be the same for any user for the same Contact.

    But if it's a single Contact list you are addressing, in say Public Folders, you might be able to. In your Access database, I assume you have some 'key' linking POC's to Companies. You wouldn't "set to this unique ID to a field in a contact item", rather you would store the ID in the Access DB, and then use the ID to retrieve the corresponding Outlook Contact Items, something like what I attempt to lay out. I think you'd have to run two overall steps, the second step would be a lot of coding, and my logic is oversimplified and may need some work:

    1. For every Contact in your Access DB, import the Item .EntryID from Outlook, store it in a new string field in Access.

    2. In your Access DB loop through each Contact Company which has POC Links TO it, and instantiate Outlook
    a) take the EntryID now stored from the Access field and in Outlook set a Contact Item (object) using GetItemFromID like this:
    Set nsNS = Application.GetNamespace("MAPI")
    Set itmCompany = nsNS.GetItemFromID(strCompanyID)

    [img]/forums/images/smilies/cool.gif[/img] In your Access database for each Company, using the key to POC's, loop through each linked Contact POC and grab it's EntryID, in Outlook set the POC Item object the same way:
    Set itmPOC = nsNS.GetItemFromID(strPOCID)

    c) in the Outlook instance, Add the Link to the CompanyItem to the POCItem like this:
    itmPOC.Link.Add(itmCompany)
    itmPOC.Save

    d) keep looping til the cows come home
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •