We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PeopleService->get returns no data, especially when trying to get the user's photo.
PeopleService->get
$client = new Client([ 'credentials' => (new GCEDWDCredentials( scope: implode(' ', [ Directory::ADMIN_DIRECTORY_USER_READONLY, PeopleService::DIRECTORY_READONLY, ]), ))->setSubject(env('GSUITE_ADMIN_IMPERSONATE')), ]); $user = (new Directory($client))->users->get($this->email, ['projection' => 'full']); $person = (new PeopleService($client))->people->get('people/'.$user->getId(), ['personFields' => 'photos']); $result = [ 'full_name' => $user->getName()->getFullName(), 'thumbnail' => ($person->getPhotos()[0] ?? null)?->getUrl() ?? '/propman/images/default_avatar.jpg', ];
This works in Go using the same credentials:
result, err := srv.Users.Get(email).Projection("full").Do() if err != nil { return nil, fmt.Errorf("GetUserInfo: User Info API Call (%s): %s", email, err) } name := result.Name.FullName person, err := pplsrv.People.Get("people/" + result.Id).PersonFields("photos").Do() if err != nil { return nil, fmt.Errorf("GetUserInfo: Person Info API Call (%s:%s): %s", email, result.Id, err) } var thumbnail string if len(person.Photos) > 0 { thumbnail = person.Photos[0].Url } else { thumbnail = "/static/img/placeholder.jpg" }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
PeopleService->get
returns no data, especially when trying to get the user's photo.Environment details
Code example
This works in Go using the same credentials:
The text was updated successfully, but these errors were encountered: