Results 1 to 4 of 4

Thread: Contactitem collection

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    7

    Angry Contactitem collection

    I have a sub in my program to display all the contacts from a public folder. My problem is the performance. Some of company branch have more than 1000 mixed items in a folder (mails, contacts, ...). This is taking more than 60 seconds to get the result . Any idea to decrease the responds time will be appreciate.
    VB Code:
    1. Set olObject = olItems.GetFirst
    2.  
    3. ' For i = 1 To olItems.Count
    4.     While Not (TypeName(olObject) = "Nothing")
    5.    
    6.         If olObject.Class = Outlook.olContact Then
    7. ' Set olSafeContactItem = New Redemption.SafeContactItem
    8. ' olSafeContactItem.Item = olObject
    9.            
    10.             Set olContactItem = olObject
    11. ' With olSafeContactItem
    12.             With olContactItem
    13.                 If optAffichageContacts(mcOptCourriel).Value = True Then
    14.                     If .Email1Address <> "" Then
    15.                         Set itmListItem = lvwContactsPublics.ListItems.Add(, .EntryID, .FullName, , mcIconOutlookContact)
    16.                         Call itmListItem.ListSubItems.Add(, , .Email1Address)
    17.                         Call itmListItem.ListSubItems.Add(, , .CompanyName)
    18.                     End If
    19.                 Else
    20.                     If .BusinessFaxNumber <> "" Then
    21.                         Set itmListItem = lvwContactsPublics.ListItems.Add(, .EntryID, .FullName, , mcIconOutlookContact)
    22.                         Call itmListItem.ListSubItems.Add(, , .BusinessFaxNumber)
    23.                         Call itmListItem.ListSubItems.Add(, , .CompanyName)
    24.                     End If
    25.                 End If
    26.             End With
    27.         End If
    28.    
    29.         Set olObject = olItems.GetNext
    30.    
    31.     Wend
    32.     'Next i
    Last edited by SNick1974; Apr 21st, 2005 at 09:56 AM.

  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 collection

    Are you using a .Restrict or a .Find to populate your olItems object?
    I see comments on redemption. Are you using it also or the OOM only?
    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
    New Member
    Join Date
    Feb 2005
    Posts
    7

    Re: Contactitem collection

    I dont use restrict or find because those functions are a kind of string filter. I dont want to filter, i want to display all the contacts of the current folder. I have the redemption object to avoid the outlook security message, but even if i remove it, i have the same result (too long).

    If you dont have a tip or a hint, i will force the company branch to reorganize their public folders.

  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 collection

    No tips if your getting all the folder contents. They are just to large for Outlook to perform quickly. Outlook
    is not know for its speed

    Edit: One tip would be to organize your item into folders by type. Contacts in one folder, MailItems in another, etc.
    Last edited by RobDog888; Apr 21st, 2005 at 12:21 PM.
    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