Get-​Msol​Contact

Gets contacts from Azure Active Directory.

Syntax

Get-MsolContact
   [-All]
   [-HasErrorsOnly <Boolean>]
   [-SearchString <String>]
   [-TenantId <Guid>]
   [<CommonParameters>]
Get-MsolContact
   [-HasErrorsOnly <Boolean>]
   [-MaxResults <Int32>]
   [-SearchString <String>]
   [-TenantId <Guid>]
   [<CommonParameters>]
Get-MsolContact
   -ObjectId <Guid>
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

The Get-MsolContact cmdlet gets a contact object or list of contacts. Specify the ObjectId parameter to get a single contact.

Examples

Example 1: Get a contact

PS C:\> Get-MsolContact -ObjectId adc41dc7-4130-4215-adfb-2403bc9f844e

This command retrieves a contact.

Example 2: Get contacts that match a string

PS C:\> Get-MsolContact -SearchString "Patti"

This command retrieves a list of contacts with a display name or email address starting with Patti.

Required Parameters

-All

Indicates that this cmdlet returns all results that it finds. Do not specify this parameter and the MaxResults parameter.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ObjectId

Specifies the unique object ID of the contact to get.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-HasErrorsOnly

Indicates that this cmdlet returns contacts that have validation errors.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MaxResults

Specifies the maximum number of results that this cmdlet returns. The default value is 500.

Type:Int32
Position:Named
Default value:500
Accept pipeline input:False
Accept wildcard characters:False
-SearchString

Specifies a string. This cmdlet returns contacts with a display name or email address that start with this string.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Outputs

Microsoft.Online.Administration.Contact

This cmdlet returns contact objects, which include the following information:

  • City. The contact's city.

  • Country. The contact's country.

  • Department. The contact's department.

  • DisplayName. The contact's display name.

  • Fax. The contact's fax number.

  • FirstName. The contact's first name.

  • LastDirSyncTime. Returns the date and time of the last sync (only returned from contacts synced with Active Directory synchronization).

  • LastName. The contact's last name.

  • MobilePhone. The contact's mobile phone number.

  • ObjectId. The unique ID of the contact.

  • Office. The contact's office number.

  • Phone Number. The contact's phone number.

  • Postal Code. The contact's postal code.

  • Proxy Addresses. The proxy addresses associated with this contact.

  • State. The contact's state.

  • StreetAddress. The contact's street address.

  • Title. The contact's title.

  • UserPrincipalName. The user ID of the contact.

  • ValidationStatus. Whether or not the contact has any errors.