none
how can I be getting duplicate EntryID's RRS feed

  • Question

  • I've written some Access VBA code to copy information from Outlook task items in a Public Folder into a SQL database. I assumed the Outlook EntryID was unique within the data store. But I'm getting the a SQL error that the EntryID already exists with the following code. Any ideas how this could be happening?

    Set objItems = olNCTfolder.Items.Restrict("[Created] > ""1/1/2009""")
    
    lngItems = objItems.Count
    
    For i = 1 To lngItems
        Set olItem = objItems(i)
        ~SQL insert statement using olItem.EntryID
    next i
    

    I've got 93,000 items in the Outlook folder. 31,000 of them insert into SQL properly, then SQL starts complaining about duplicate EntryID's. The SQL EntryID column is a varchar(255) data type. My Outlook.EntryID's look like they're varchar(140), so I don't think truncation is causing the problem.

    Any ideas how I can select only one of each of the items using Outlook or what's causing the duplicates?


    Gordon Prince * (901) 761-3393

    Monday, June 18, 2012 2:58 PM

Answers

  • yes, that could be the reason for 'duplicate' entries. either add checking if item is already there or use some kind of 'marking' that will tell you if item was already processed (user property, mapi property, category, etc.)
    Tuesday, June 19, 2012 10:54 AM

All replies

  • That is not possible.

    Are you sure you are not inserting the same item twice? Or have old data in the table?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Monday, June 18, 2012 5:07 PM
  • First thing I do is delete everything from the SQL table.

    Then the for loop, with one INSERT statement in it.

    After processing 27462 items in the folder, I encountered 19 duplicated EntryID's.


    Gordon Prince * (901) 761-3393


    Monday, June 18, 2012 8:45 PM
  • And if you print out the values of the entry ids, do they match the entries from the same collection?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Tuesday, June 19, 2012 5:45 AM
  • I'm not quite sure what "print out the values of the EntryID's" means. What would I compare the EntryID's to?

    Overnight I ran the program again and out of a larger set (91,000 items) only encountered one duplicated EntryID. This is a superset of the 27462 items that showed me 19 duplicate EntryID's earlier. So maybe there's something going on related to people using the system while I'm working with the set of items. That there aren't duplicate EntryID's, but that the FOR loop encounters the same item more than once as a result of people changing some of the items while the FOR loop is running and the sequence the items are processed gets some of the items to be processed more than once.




    Tuesday, June 19, 2012 10:34 AM
  • yes, that could be the reason for 'duplicate' entries. either add checking if item is already there or use some kind of 'marking' that will tell you if item was already processed (user property, mapi property, category, etc.)
    Tuesday, June 19, 2012 10:54 AM