< Back
Get-GoogleDirectoryUserPhoto
Post
NAME Get-GoogleDirectoryUserPhoto
SYNOPSIS
Gets one photo thumbnail for a GSuite user.
SYNTAX
Get-GoogleDirectoryUserPhoto [-UserId] <String> [-OutFile <String>] -BearerToken <String> [-UseCompression]
[<CommonParameters>]
Get-GoogleDirectoryUserPhoto [-UserId] <String> [-OutFile <String>] [-ProfileLocation <String>] [-Persist]
[-UseCompression] [<CommonParameters>]
DESCRIPTION
This cmdlet retrieves one photo thumbnail, the lastest Gmail Chat profile photo for a user. The details of the
photo and
the photo base64 data are returned to the pipeline. Optionally, the photo data can also be written out to a file.
If you choose
to write the photo data to a file, you should check the mimeType property returned with the object to make sure
you use
the correct file extension.
The output photoData property of the object returned to the pipeline is web safe base64 encoded, meaning:
- The slash (/) character is replaced with the underscore (_) character.
- The plus sign (+) character is replaced with the hyphen (-) character.
- The equals sign (=) character is replaced with the asterisk (*).
- For padding, the period (.) character is used instead of the RFC-4648 baseURL definition which uses the equals
sign (=) for padding. This is done to simplify URL-parsing.
- Whatever the size of the photo being uploaded, the API downsizes it proportionally to 96x96 pixels.
PARAMETERS
-UserId <String>
The Id of the user to get 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? true (ByValue)
Accept wildcard characters? false
-OutFile <String>
The path to a file where the photo data will be written. If the directory path does not exist, it will be
created.
Required? false
Position? named
Default value
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
System.String
OUTPUTS
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 = Get-GoogleDirectoryUserPhoto -UserId liz@example.com -ClientId $Id -Persist
Gets the photo data for the user liz@example.com using stored client credentials and bypasses confirmation.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>$PhotoData = Get-GoogleDirectoryUserPhoto -OutFile "c:\\users\\liz\\desktop\\thumbnail.txt" -UserId
liz@example.com -ClientId $Id -Persist
$MimeType = $PhotoData["mimeType"]
SYNOPSIS
Gets one photo thumbnail for a GSuite user.
SYNTAX
Get-GoogleDirectoryUserPhoto [-UserId] <String> [-OutFile <String>] -BearerToken <String> [-UseCompression]
[<CommonParameters>]
Get-GoogleDirectoryUserPhoto [-UserId] <String> [-OutFile <String>] [-ProfileLocation <String>] [-Persist]
[-UseCompression] [<CommonParameters>]
DESCRIPTION
This cmdlet retrieves one photo thumbnail, the lastest Gmail Chat profile photo for a user. The details of the
photo and
the photo base64 data are returned to the pipeline. Optionally, the photo data can also be written out to a file.
If you choose
to write the photo data to a file, you should check the mimeType property returned with the object to make sure
you use
the correct file extension.
The output photoData property of the object returned to the pipeline is web safe base64 encoded, meaning:
- The slash (/) character is replaced with the underscore (_) character.
- The plus sign (+) character is replaced with the hyphen (-) character.
- The equals sign (=) character is replaced with the asterisk (*).
- For padding, the period (.) character is used instead of the RFC-4648 baseURL definition which uses the equals
sign (=) for padding. This is done to simplify URL-parsing.
- Whatever the size of the photo being uploaded, the API downsizes it proportionally to 96x96 pixels.
PARAMETERS
-UserId <String>
The Id of the user to get 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? true (ByValue)
Accept wildcard characters? false
-OutFile <String>
The path to a file where the photo data will be written. If the directory path does not exist, it will be
created.
Required? false
Position? named
Default value
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
System.String
OUTPUTS
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 = Get-GoogleDirectoryUserPhoto -UserId liz@example.com -ClientId $Id -Persist
Gets the photo data for the user liz@example.com using stored client credentials and bypasses confirmation.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>$PhotoData = Get-GoogleDirectoryUserPhoto -OutFile "c:\\users\\liz\\desktop\\thumbnail.txt" -UserId
liz@example.com -ClientId $Id -Persist
$MimeType = $PhotoData["mimeType"]