Get-OneMailObject
SYNOPSIS
Retrieve a single mail object based on identity and recipient type.
SYNTAX
Get-OneMailObject [-Identity] <String> [[-RecipientType] <String>] [[-RecipientTypeDetails] <String>]
[[-Properties] <Array>] [<CommonParameters>]
DESCRIPTION
The `Get-OneMailObject` function retrieves a single mail object from Exchange based on the provided identity. It supports filtering by recipient type, recipient type details, and allows specifying properties to include in the output. If multiple results are found, the function prompts the user to select one.
EXAMPLES
EXAMPLE 1
Get-OneMailObject -Identity "[email protected]"
Retrieves the mail object for the identity `user@example.com`.
EXAMPLE 2
Get-OneMailObject -Identity "[email protected]" -RecipientType "UserMailbox"
Retrieves the mail object for the identity `user@example.com` filtered by recipient type `UserMailbox`.
EXAMPLE 3
Get-OneMailObject -Identity "[email protected]" -Properties @("DisplayName", "PrimarySmtpAddress")
Retrieves the mail object for the identity `user@example.com` and includes the `DisplayName` and `PrimarySmtpAddress` properties.
PARAMETERS
-Identity
The identity of the mail object (e.g., UserPrincipalName, DistinguishedName, or SamAccountName) to retrieve.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-RecipientType
The recipient type to filter the search (e.g., UserMailbox, MailUser, PublicFolder).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-RecipientTypeDetails
The recipient type details to filter the search (e.g., SharedMailbox, RoomMailbox, RemoteUserMailbox).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Properties
An array of properties to include in the output. Defaults to `DistinguishedName`.
Type: Array
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: @('DistinguishedName')
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.