שתף באמצעות


Get-MsolContact

Updated: July 30, 2015

Applies To: Azure, Office 365, Windows Intune

Note



  • The cmdlets were previously known as the Microsoft Online Services Module for Windows PowerShell cmdlets.

The Get-MsolContact cmdlet can be used to retrieve a contact object, or list of contacts. A single contact will be retrieved if the ObjectId is used.

Syntax

Get-MsolContact [-HasErrorsOnly] [-MaxResults <int>] [-SearchString <string>] [-TenantId <Guid>] [<CommonParameters>]

Get-MsolContact [-All] [-TenantId <Guid>] [<CommonParameters>]

Get-MsolContact -ObjectId <Guid> [-TenantId <Guid>] [<CommonParameters>]

Parameters

    -All [<SwitchParameter>]
        If present then all results will be returned.  Cannot be used with 
        MaxResults parameter.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -HasErrorsOnly [<SwitchParameter>]
        The filter for only contacts with validation errors.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -MaxResults <int>
        The maximum number of results returned for a search. If not specified, 
        500 results will be returned.
        
        Required?                    false
        Position?                    named
        Default value                500
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -ObjectId <Guid>
        The unique ID of the contact to retrieve.
        
        Required?                    true
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -SearchString <string>
        The string to search on. Only contacts with a display name or email 
        address starting with this string will be returned.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -TenantId <Guid>
        The unique ID of the tenant to perform the operation on. If this is 
        not provided, then the value will default to the tenant of the current 
        user. This parameter is only applicable to partner users.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".

Examples

The output is provided by 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.

  • 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.

Example 1

The following command retrieves a contact.

Get-MsolContact -ObjectId <id>

Example 2

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

Get-MsolContact -SearchString "Melissa"

Additional Resources

There are several other places you can get more information and help. These include:

See Also

Other Resources

Manage Azure Active Directory by using Windows PowerShell