Results 1 to 6 of 6

Thread: ContactItem key

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Granby, Qc, Canada
    Posts
    602

    ContactItem key

    Is there any free property of a ContactItem in which I can add the ID of the contact from a DB. I want to modify the contact in Outlook each time it's modified in my VB Application and this way, it would be easier to find the contact in outlook.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ContactItem key

    The .EntryID field is the unique identifier in Outlook. You can add custom properties if you want or just use some obscure base field.

    Bring up a contact in Outlook, go to Tools > Forms > Design this form... > All Fields tab > select All Contact fields...
    This will show you ALL the contact fields and if the ContactItem Form is a standard Outlook Form and hasnt been modified then all the fields will be default across all Contact Items.

    You could use the Customer ID, Government ID Number, UserField1 - UserField4.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Granby, Qc, Canada
    Posts
    602

    Re: ContactItem key

    These fields will never be changed by Outlook ? So I put my DB field index in it and compare with it after?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ContactItem key

    Actually, my mistake. You dont need to go into design view of the form but anyone could click the All Fields tab and change the values for any of the visible fields. If you want you could look at the UserProperty or ItemProperty for adding a custom property.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Granby, Qc, Canada
    Posts
    602

    Re: ContactItem key

    What is the fastest way to retrieve a ContactItem if I have about 2500.

    Right now i'm doing this but it's really slow, it takes something like 2 minutes to go through all the ContactItem.

    VB Code:
    1. For Each otlContact In folContact.Items
    2.   If otlContact.User1 <> "" Then
    3.     If otlContact.User1 = m_iNoContact Then
    4.       Exit For
    5.     End If
    6.   End If
    7. Next

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ContactItem key

    If your saving the .EntryID of the contact item then you can use a quick method without looping...
    VB Code:
    1. Dim oApp As Outlook.Application
    2.     Dim oNS As Outlook.NameSpace
    3.    
    4.     Set oApp = New Outlook.Application
    5.     Set oNS = oApp.GetNamespace("MAPI")
    6.    
    7.     Dim oContact As Outlook.ContactItem
    8.  
    9.     Set oContact = oNS.GetItemFromID("EntryID", "EntryIDStore")
    10.     MsgBox oContact.FullName ' "VB/Outlook Guru™"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width