/errors/exchange-online/object-couldnt-be-found
The operation couldn't be performed because object 'user@contoso.com' couldn't be found on (Exchange Online)
- tool
- Exchange Online PowerShell
- versions
- Exchange Online, ExchangeOnlineManagement 3.x
- os
- windows, linux, macos
The operation couldn't be performed because object 'user@contoso.com' couldn't be found on 'XXXXXX.PROD.OUTLOOK.COM'. means Exchange Online could not resolve the value you passed to -Identity to an object of the type that cmdlet works on. The server name at the end is an Exchange Online directory server and is not something you can change. Start by checking that the recipient exists and what type it is:
Get-EXORecipient -Identity user@contoso.com | Format-List DisplayName,PrimarySmtpAddress,RecipientTypeDetails,ExternalDirectoryObjectIdIf Get-EXORecipient finds nothing either, the address is not on any recipient in Exchange Online.
Common causes
| Cause | Fix |
|---|---|
| Typo or old address in -Identity | Use the PrimarySmtpAddress, UPN or ExternalDirectoryObjectId returned by Get-EXORecipient |
| User has no Exchange Online license | Assign a license with an Exchange Online plan; the mailbox is created after provisioning |
| New or synced object not provisioned yet | Wait for directory sync and provisioning, then retry |
| Wrong cmdlet for the recipient type | RecipientTypeDetails tells you which cmdlet to use (MailUser, MailContact, GroupMailbox, MailUniversalDistributionGroup) |
| Mailbox deleted | Get-Mailbox -SoftDeletedMailbox -Identity ... or Get-Mailbox -InactiveMailboxOnly |
Recipient type and cmdlet
Get-Mailbox, Set-Mailbox and Add-MailboxPermission work only on mailboxes (user, shared, room, equipment). A Microsoft 365 group shows GroupMailbox and is managed with Get-UnifiedGroup / Set-UnifiedGroup; a guest or external user is a MailUser (Get-MailUser); a distribution list is managed with Get-DistributionGroup.
Hybrid organizations
When users are synced from on-premises Active Directory, a change made on-premises can take a while to reach Exchange Online. Until it arrives, a cmdlet that reads the object may work while one that writes to it fails, or the other way round. Wait for the next synchronization cycle and run the command again before changing anything else.