< Back

Set-GoogleDirectoryUserPhoto

Mon Jan 13, 2020 10:55 pm

NAME Set-GoogleDirectoryUserPhoto



SYNOPSIS

Sets the photo for a GSuite user.





SYNTAX

Set-GoogleDirectoryUserPhoto [-UserId] <String> -Path <String> [-PassThru] -BearerToken <String> [-UseCompression]

[<CommonParameters>]



Set-GoogleDirectoryUserPhoto [-UserId] <String> -Path <String> [-PassThru] [-ProfileLocation <String>] [-Persist]

[-UseCompression] [<CommonParameters>]





DESCRIPTION

This cmdlet updates a user's photo. In this version of the API, a photo is the user's

latest Gmail Chat profile photo. This is different from the Google+ profile photo.

When updating a photo, the height and width are ignored by the API.





PARAMETERS

-UserId <String>

The Id of the user to set the photo of. The UserId can be the user's primary email address, the unique user

id, or one of the user's alias email addresses.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

The path to the file containing the photo to be uploaded. The file data will be converted to web safe base64.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PassThru [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-BearerToken <String>

The bearer token to use to authenticate the request.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ProfileLocation <String>

The location where stored credentials are located. If this is not specified, the default location will be used.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Persist [<SwitchParameter>]

Indicates that the newly retrieved token(s) or refreshed token and associated client data like client secret

are persisted to disk.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-UseCompression [<SwitchParameter>]

If specified, the returned data is compressed using gzip.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None





OUTPUTS

None or System.Collections.Hashtable



This is a JSON representation of the output data:

{

"kind": "directory#user#photo",

"id": "the unique user id",

"primaryEmail": "liz@example.com",

"mimeType": "the photo mime type",

"height": "the photo height in pixels",

"width": "the photo width in pixels",

"photoData": "web safe base64 encoded photo data"

}





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 2/12/2018



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$PhotoData = Set-GoogleDirectoryUserPhoto -UserId liz@example.com -Path c:\\users\\liz\\desktop\\photo.jpg

-PassThru -ClientId $Id -Persist



Sets the photo data for the user liz@example.com using stored client credentials and bypasses confirmation. The

uploaded photo

information is returned to the pipeline.











RELATED LINKS