active-directorysharepoint-onlineazure-ad-graph-apipnp-jssharepointframework

Unable to update Azure AD user property from SharePoint using @pnp/graph


I have created a SharePoint Framework web part using React. After that, I integrated @pnp/graph under that SPFx application. Also, I have given an API access permission request to my SPFx app.

I have fetched all users from the Azure AD group. Now, I need to update the currently logged-in user property under Azure AD. Below is my code snippet,

import { graph } from "@pnp/graph";

 public async UpdateCurrentUserProperties(companyName) {
    return await graph.me.update({
        companyName: companyName
    });
}

Below is the reference link, https://pnp.github.io/pnpjs/graph/users/#update-current-user

I am facing the below error while updating the currently logged-in user profile properties under Azure AD.

Unable to update the specified properties for on-premises mastered Directory Sync objects or objects currently undergoing migration

Can anyone help me with the same?


Solution

  • The error "Unable to update the specified properties for on-premises mastered Directory Sync objects or objects currently undergoing migration" usually occurs if you are trying to update the users which synced from on-premises to Azure AD.

    For more in detail, please find below links:

    azure - Set-AzureADuser failing - Stack Overflow

    Unable to update the specified properties for on-premises mastered Directory Sync objects - Microsoft Q&A