?
Solved

Reset Sync Fields

Posted on 2009-02-23
3
Medium Priority
?
230 Views
Last Modified: 2012-05-06
BlueDevilFan has written a fantastic macro:

http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_23992307.html

Which syncs two folders within Outlook, the problem is I've been testing it out and have managed to really mess up the sync fields it uses.

Please is there someone out there (David - are you up for it?) who could write me a macro which cycles through all the records in a folder and resets the various sync fields the above macro uses?

The hope is that then the macro would see the all the records in the source folder as brand new and sync them all over to the target folder, refreshing the messed up sync data.

I've been trying the code below (taken and slightly altered from another ee answer) but it's not working and I don't know if I'm close!

Thanks experts.
Charlie

If one of you could invent a way to email beer I'll gladly buy you a pint or two if you could solve this!
Sub ResetSyncID()
    Dim olkItems As Outlook.Items, _
        olkFolder As Outlook.MAPIFolder, _
        olkItem As Object, _
        olkProperty As Outlook.UserProperty
    Set olkFolder = Application.ActiveExplorer.CurrentFolder
    Set olkItems = olkFolder.Items
    For Each olkItem In olkItems
        'Replace MyPropertyName on the folliwng line with the name of your property
        Set olkProperty = olkItem.UserProperties.Find("SyncID")
        If TypeName(olkProperty) <> "Nothing" Then
            'Replace New Value on the next line with teh new value you want assigned to the property
            olkProperty.Delete
            olkItem.Save
        End If
    Next
    Set olkProperty = Nothing
    Set olkFolder = Nothing
    Set olkItem = Nothing
    Set olkProperty = Nothing
    MsgBox "All done resetting property."
End Sub
 
Sub ResetLastSync()
    Dim olkItems As Outlook.Items, _
        olkFolder As Outlook.MAPIFolder, _
        olkItem As Object, _
        olkProperty As Outlook.UserProperty
    Set olkFolder = Application.ActiveExplorer.CurrentFolder
    Set olkItems = olkFolder.Items
    For Each olkItem In olkItems
        'Replace MyPropertyName on the folliwng line with the name of your property
        Set olkProperty = olkItem.UserProperties.Find("LastSync")
        If TypeName(olkProperty) <> "Nothing" Then
            'Replace New Value on the next line with teh new value you want assigned to the property
            olkProperty.Delete
            olkItem.Save
        End If
    Next
    Set olkProperty = Nothing
    Set olkFolder = Nothing
    Set olkItem = Nothing
    Set olkProperty = Nothing
    MsgBox "All done resetting property."
End Sub

Open in new window

0
Comment
Question by:RevIngram
  • 2
3 Comments
 

Accepted Solution

by:
RevIngram earned 0 total points
ID: 23720366
Hi Experts,
I've managed to sort this myself, can I have the points?
I looked through BlueDevilFan's code, which took several hours as I'm no programmer(!), and maganged to work out what it did. Rather than delete the SyncID or LastSync fields I simply needed to set the LastSync field to "1/1/1900 12:01:00 AM" this makes the macro behave as if the item is new.
I deleted all the items from the target folder, ran the 'ResetLastSync'  mako below on the source folder and we're back in sync.
(BlueDevilFan: if you're reading this I worked out the other problems I was having - mainly due to the fact that I'm syncing in about 4 directions, iPhone, exchange in cached mode, favourite folders and then your macro. I'm now syncng the iPhone via Push instead of iTunes, which gives me multiple contacts folders, enabling me to keep work and home (private and non-private separate). It also removed the need to use cached favourite public folders. By removing 2 of the 4 sync routines it all got alot cleaner)
Cheers,
Charlie
Sub ResetLastSync()
    Dim olkItems As Outlook.Items, _
        olkFolder As Outlook.MAPIFolder, _
        olkItem As Object, _
        olkProperty As Outlook.UserProperty
    Set olkFolder = Application.ActiveExplorer.CurrentFolder
    Set olkItems = olkFolder.Items
    For Each olkItem In olkItems
        'Replace MyPropertyName on the folliwng line with the name of your property
        Set olkProperty = olkItem.UserProperties.Find("LastSync")
        If TypeName(olkProperty) <> "Nothing" Then
            'Replace New Value on the next line with teh new value you want assigned to the property
            olkProperty.Value = "1/1/1900 12:01:00 AM"
            olkItem.Save
        End If
    Next
    Set olkProperty = Nothing
    Set olkFolder = Nothing
    Set olkItem = Nothing
    Set olkProperty = Nothing
    MsgBox "All done resetting property."
End Sub

Open in new window

0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 23720367
Pending David's appearance to use his knowledge of the solution.  As far as I can see runnu=ing ResetSyncID in the target folder should delete the synch data.  ... mind so will deleting teh old files in entirity ... and remove a potential for duplication.

I may be missing something obvious ... so if you can advise?

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 23720373
Oops!

You can ask the admin to delete the question.

Chris
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

807 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