0

I've been working with the Google Admin API C# library for a few days now to create / delete users. Which I have got working.

However when I create a new user via the API, the Gmail app is turned off by default (along with other apps) and so when the user logs gmail for the first time they are presented with the message

"We are sorry, but you do not have access to Gmail. Please contact your organisation administrator for access."

I then have to go and turn it on manually via admin.google.com

I haven't yet managed to find any docs or mentions anywhere on how to turn on/off the apps via the API. Is this actually possible?

here is my code for creating the user:

User user = new User
{
    Name = new UserName
    {
        FullName = employee.DisplayName,
        GivenName = employee.FirstName,
        FamilyName = employee.LastName
    },
    PrimaryEmail = employee.Email,
    Password = "P@ssw0rd!.",
    OrgUnitPath = "/UK/sales",
    ChangePasswordAtNextLogin = true,
    IncludeInGlobalAddressList = true
};

UsersResource.InsertRequest request = ds.Users.Insert(user);
await request.ExecuteAsync();

Note: ds is a DirectoryService with scopes AdminDirectoryUser, AdminDirectoryGroup and AdminDirectoryOrgunit

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449

0 Answers0