Get-MgUserContact

What is Get-MgUserContact?

Get-MgUserContact is a Microsoft Graph PowerShell cmdlet used to retrieve personal contacts stored in a Microsoft 365 user’s mailbox. These contacts are typically created in Outlook and represent external people or organizations, not tenant users.

🚀 Community Edition Released!

Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.

Why Use Get-MgUserContact?

This cmdlet is especially useful for automation and reporting scenarios, such as:

  • Auditing personal contacts stored in user mailboxes
  • Exporting contacts for backup or migration
  • Validating contact data during mailbox cleanup
  • Automating user-level mailbox insights without manual Outlook access

Prerequisites

Before running this cmdlet, ensure you have:

  • Microsoft Graph PowerShell module installed
  • Appropriate permissions such as Contacts.Read or Contacts.Read.All
  • An active Graph connection:
  • Connect-MgGraph -Scopes "Contacts.Read"

How to Use Get-MgUserContact?

You must specify the target user using UserId, which can be a User Principal Name (UPN) or Object ID.

Basic syntax:

Get-MgUserContact -UserId <String>

Get-MgUserContact Examples

  • Example 1: Get Contacts for a Specific User
  • Get-MgUserContact -UserId "john.doe@example.com"

    This command retrieves all personal contacts stored in John Doe’s mailbox.

  • Example 2: Get Contacts for a Specific User and Select Specific Properties
  • Get-MgUserContact -UserId "john.doe@example.com" | Select-Object DisplayName, EmailAddresses, BusinessPhones

    This example limits the output to commonly used contact fields for cleaner reporting.

  • Example 3: Export Contacts to a CSV File
  • Get-MgUserContact -UserId "john.doe@example.com" | Select-Object DisplayName, EmailAddresses, BusinessPhones |Export-Csv -Path "JohnDoeContacts.csv" -NoTypeInformation

    This exports the user’s contacts into a CSV file, making it easy to archive or analyze externally.


Get-MgUserContact vs Get-MgContact

This is a common point of confusion, so it’s good to clarify clearly:

Cmdlet Purpose
Get-MgUserContact Retrieves personal Outlook contacts stored in a user’s mailbox
Get-MgContact Retrieves organizational contacts stored in the tenant directory

Key takeaway:
Use Get-MgUserContact for mailbox-level, user-created contacts.
Use Get-MgContact for directory-level, tenant-wide contacts.

Summary

Key Point Details
Cmdlet Name Get-MgUserContact
Purpose Retrieves personal Outlook contacts from a user’s mailbox
Data Source User mailbox (personal contacts, not tenant users)
Required Parameter UserId (UPN or Object ID)
Permissions Needed Contacts.Read or Contacts.Read.All
Automation Benefit Enables scripted contact audits, exports, and mailbox analysis
Common Use Cases Contact backup, reporting, migrations, mailbox cleanup

Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Your Site Name. All Rights Reserved. Design by HTML Codex