Hi @Aishwarya Ganesh You're encountering the error:
"Client Error: Object reference not set to an instance of an object" while trying to create an adaptive scope for specific users based on email addresses in Microsoft Purview.
This type of error usually points to issues with the attributes being used in the query or how the scope is being constructed. Below are clear steps to help you successfully create the adaptive scope and avoid this error.
Steps to Create an Adaptive Scope for Specific Users
Access the Microsoft Purview Compliance Portal
- Go to: https://compliance.microsoft.com
- You must be a Compliance Administrator or Global Administrator.
Navigate to Adaptive Scopes: Select Data lifecycle management > Microsoft 365 > Adaptive scopes, Click Create scope
Define Scope Details: Choose User scope, Enter a Name (e.g., “Specific Users Scope”) and an optional Description
Build the Query: Click Advanced query builder (recommended to avoid UI-based issues),
Use PrimarySmtpAddress
for more accurate results (recommended over EmailAddresses
, which is multi-valued and prone to errors)
Examples:
- Single User:
PrimarySmtpAddress -eq "******@mobileaspects.com"
- Multiple Users:
PrimarySmtpAddress -eq "******@mobileaspects.com" -or PrimarySmtpAddress -eq "******@mobileaspects.com"
- You may also use:
UserPrincipalName -eq "******@mobileaspects.com"
- Validate the Query: Click Preview results to confirm the correct users are being returned.
- Save the adaptive scope. It may take up to a few hours to become available.
- Apply it under: Data lifecycle management > Retention policies > Choose locations > Adaptive
Troubleshooting the Error
If you still see the error:
- Verify Email Addresses in Azure AD Use PowerShell to confirm the user’s primary email:
If no results are returned, verify this is the user’s primary SMTP address.Connect-AzureAD Get-AzureADUser -Filter "mail eq '******@mobileaspects.com'"
- Test with a Single User
- Delete the current draft and recreate the scope with just one user.
- Add additional users one at a time.
- Use the Advanced Query Builder: This bypasses some known issues with the standard UI-based builder.
- Check for Backend/Browser Issues
- Try using an incognito/private browser session.
- Check for any known service issues in the Microsoft 365 admin center under Service Health.
I hope this information helps. Please do let us know if you have any further queries.
Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.