How to Automate Reminders for Users’ Profile Photos in Google Workspace Using Apps Script

How to send weekly emails to Google Workspace users without their profile photo uploaded.

Are you seeking a method to send email reminders to users in your Google Workspace who haven’t uploaded a profile photo? Today’s post covers this automation. By the end of this post, we’ll create a Google script that will automatically send weekly emails to users without their profile photo uploaded.

This automation offers several benefits. Firstly, it encourages users to complete their profiles, enhancing their identification within the workspace and making interactions more personable and engaging. Secondly, it eliminates the need for manual monitoring, saving administrators valuable time that they can allocate to other essential tasks.

To start, we need to fetch the list of all users in the Google Workspace. This is achieved using the AdminDirectory.Users.list() method, which returns a list of all users in the workspace.

const users = AdminDirectory.Users.list().users;

Then, for each user, we check if they have a profile photo. The AdminDirectory.Users.Photos.get(USER_PRIMARY_EMAIL) method returns an object if the user has a profile photo and throws an error if not.

When the method throws an error, it signifies that the user does not have a profile photo. In this case, we send a reminder email to the user using the MailApp.sendEmail() function. To send an email with HTML body content, check this post.

function checkUserProfilePhotos(){
  const users = AdminDirectory.Users.list().users;
  users.forEach(user => {
    try {
      const userPhoto = AdminDirectory.Users.Photos.get(user.primaryEmail);
    } catch (error) {
      // user does not have a profile photo
      // send reminder email
      MailApp.sendEmail({
        to: user.primaryEmail,
        subject: "Please upload your profile photo",
        body: "It looks like you haven't uploaded a profile photo. Please upload one."
      });
    }
  });
}

To automate this process and make it run every week, we can create a time-driven trigger using the ScriptApp.newTrigger() method. This method creates a trigger, which is an event that starts the execution of a particular script. Run the following function in your Google script editor to create the time-based trigger.

function createReminderTrigger(){
  ScriptApp.newTrigger('checkUserProfilePhotos')
  .timeBased()
  .everyWeeks(1)
  .create();
}

This automation of sending profile photo reminders in Google Workspace not only enhances user recognition and engagement but also saves administrators from the manual task of reminding each user.


Joseph Asinyo

Google Workspace Developer

I’m Joseph. I love building applications and writing Google scripts to automate Google Workspace for greater productivity. Learn more about me.

Scroll to Top