Moving Calendars from one domain to another

146 views
Skip to first unread message

Joshua Barron

unread,
Aug 6, 2024, 8:54:00 PM8/6/24
to GAM for Google Workspace
Ross:  

Thoughts on the attached script?  As always, your insights on how to get this done more efficiently/painlessly are most appreciated.

Regards,
Joshua
______________________

# Calendar Events Migration Script 
 The attached script (makes an attempt at) migrates calendar events from users in one Google Workspace domain to another. 

It uses `gamadv` (GAMADV-XTD3) to read events from the source domain and update the events with a new domain in the destination domain. The script supports both test mode and actual migration. 

## Prerequisites 
1. **Python 3.x**: Ensure Python is installed on your system. 
2. **gamadv**: Install GAMADV-XTD3 and configure it for both source and destination domains. 
3. **Service Account Credentials**: Store the GAMADV configurations for each domain in separate folders under the `~/googlescripting` directory. 

## Setup 
1. **Install GAMADV-XTD3**: Follow the installation instructions for GAMADV-XTD3 from the official documentation. 
2. **Configure GAMADV-XTD3**: 
- Configure it for the source domain and save the configuration in `~/googlescripting/source_config`. 
- Configure it for the destination domain and save the configuration in `~/googlescripting/destination_config`. 

## Script Overview The script performs the following tasks: 
1. Fetches active users from the source domain. 
2. For each user, retrieves their calendar events. 
3. Updates the email addresses of attendees and organizers to the new domain. 
4. Creates or updates the events in the destination domain. 

## Running the Script 
### Test Mode 
 In test mode, the script runs through all the processes and logs the changes without making any updates to the destination domain. To run the script in test mode: 
```bash python script_name.py --test
### Actual Migration
To run the script and perform the actual migration:

# Script Details
## Logging

The script logs messages to both the console and a file named calendar_update.log located in the same directory as the script.

## Configuration Paths
  • Source Domain Configuration: ~/googlescripting/source_config
  • Destination Domain Configuration: ~/googlescripting/destination_config
## Functions
  1. log_and_print: Prints and logs messages with different logging levels.
  2. execute_gam_command: Executes a gam command and returns the output lines.
  3. get_active_users: Fetches active users from the specified domain.
  4. get_calendar_events: Fetches calendar events for the specified user.
  5. replace_domain: Replaces the old domain in an email address with the new domain.
  6. update_event_for_destination: Creates or updates an event in the destination domain.
  7. process_user_events: Processes calendar events for a single user, updating domains as needed.
  8. main: Orchestrates the entire process, including parallel processing for multiple users.

gamadv_calmove_test1_py.txt

Joshua Barron

unread,
Aug 13, 2024, 6:29:38 AM8/13/24
to GAM for Google Workspace
Ross? Others?  Certainly I can't be the first to try and administratively move calendars from one domain to another.

Zack Jacobsohn

unread,
Aug 15, 2024, 7:39:24 AM8/15/24
to GAM for Google Workspace
Hiya Josh,

I'm trying to do something similar - it's not as automated as your script, but it should hopefully work once I figure out how to deal with the fact that calendars don't get created until users login!

The nice thing about using the move operation is that the eventids stay the same, and the event can stay on the users primary calendar.

Let me know what you think, and if you have any improvments.

Thanks,
Zack

Joshua Barron

unread,
Sep 9, 2024, 6:30:26 PM9/9/24
to google-ap...@googlegroups.com
Hi Zack, have you made any progress on your end?


 

Quext 

JOSHUA BARRON

Head of Software & Systems

5214 68th Street Suite 402

Lubbock, TX  79424

 

P: 806-798-0888 x 3102

E: joshua...@onequext.com

The information contained in this email is intended for the individual or entity to whom it is addressed. Its contents (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient you must not use, disclose, disseminate, copy or print its contents. If you received this email in error, please notify the sender by replying to the e-mail and delete/destroy the message. Thank you.



--
You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/9bffSjB9jwo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-manager+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/f6c1ff8f-f471-432b-94ec-74ad9cb7432an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages