phw198 / OutlookGoogleCalendarSync

Sync your Outlook and Google calendars
https://www.outlookgooglecalendarsync.com/
Mozilla Public License 2.0
1.78k stars 214 forks source link

Un-sync? #125

Open phw198 opened 7 years ago

phw198 commented 7 years ago
This discussion was imported from CodePlex

miscott wrote at 2016-03-21 14:33:

Hi, I accidentally synced to the wrong google calendar. Is there a way to "un-sync" the events or do I have to manually go and delete (all 100+) of those items manually in google?
phw198 commented 6 years ago

Two possible enhancements here:

jthannickal commented 5 years ago

Was this resolved? I have the same problem please.

phw198 commented 5 years ago

@jthannickal I did recently add the ability to remove the OGCS metadata added to synced events, but that's not going to remove the actual synced items. It's intended to help resolve items that OGCS keeps wanting to delete that it shouldn't.

To be honest, I'm really not sure about providing the feature to delete synced items as it is fraught with danger! For example, if users are, or have ever, configured

Locate Your Access Token

This is required to allow the calendar items to be deleted via a script. We can just use the same token that OGCS uses, since that already has access.

  1. Back in Windows Explorer, locate the file Google.Apis.Auth.OAuth2.Responses.TokenResponse-user and open it in Notepad.exe
  2. The start of the line will be: {"access_token":"<big_long_string>","token_type"
  3. We want that <big_long_string> - everything between the speech marks
  4. Copy that string and paste it into cell T1 in your CSV spreadsheet.

Prepare the Script

  1. In cell T2 enter the formula:
    ="curl --request DELETE --header ""Authorization: Bearer """& T$1 & """ --header ""Accept: application/json"" --compressed " & """https://www.googleapis.com/calendar/v3/calendars/"& SUBSTITUTE(M2,"@","%40") &"/events/"& L2 &""""
  2. Copy the formula down for each record in the spreadsheet you want to delete in your calendar

Download curl

  1. Download curl for Windows
  2. Extract the zip file to somewhere on your computer, eg C:\temp
  3. Open a Windows Command Prompt window (Start > Run > cmd)
  4. Change into the extracted file location: cd C:\temp\curl-7.64.1-win64-mingw\bin
  5. Copy cell T2 and paste it into the cmd window. That should have deleted the event! :wastebasket:
  6. Now repeat the copy-paste process for each item. You could even paste them all into their own deletes.bat file and then just execute that.

Deleting Outlook Events

  1. Open the calendar in Outlook
  2. Click View > Change View > List
  3. Click the Created column to order by that
  4. Identify the items created at the same time as the OGCS sync 1.1 To be more specific, right-click a column header and Field Chooser 1.1 Select User-defined fields in folder from the dropdown 1.1 Click and drag googleEventID onto the column headers. 1.1 Items synced by OGCS from Google will have a value in this new column.
  5. Click the first one, then press Shift and click the last one. (Or press Ctrl and click each item individually)
  6. Press delete. :wastebasket:

    :beers: That's got to be worth a beer hasn't it? :wink: