Forum Discussion

John Warner's avatar
John Warner
Iron Contributor
Dec 13, 2018
Solved

Update Custom User Profile Property in SharePoint Online, Possible???

I hope someone knows the answer to this because no one I've talked to at Microsoft does.

I have created custom properties for my user profiles, such as Employee Id.  I want to update these properties on a nightly schedule using PowerShell.  I have followed the instructions on this page in order to accomplish this task:

https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online

When I run the script, I seem to get a successful run, ie: No error messages

However, the Guid returned is a null value, in other words 00000000-0000-0000-0000-000000000000

Also when I run this command $o365.GetImportProfilePropertyJobs(), I get an error stating that the collection has not been initialized.  Meaning there have been no jobs created.

 

So it looks like this command is not working for me, am I missing something???

  • BTW, I was able to accomplish this task by using the following PowerShell command.  Thanks to Mikael Svenson.

    New-PnPUPABulkImportJob -Folder "Shared Documents" -Path "userprofileimport.json" -IdP
    roperty "IdName" -UserProfilePropertyMapping @{"EmpId"="EmpId"}

     

4 Replies

  • jonathan_kong's avatar
    jonathan_kong
    Copper Contributor

    John Warner  able to share the script you used to schedule nightly updates? I'm trying to do something similar, to update say every alternate Monday at 12 AM

  • Doug Allen's avatar
    Doug Allen
    Iron Contributor

    I've been able to do this successfully, and I can tell you to be sure you are a global admin running the PowerShell, have access to the library where you are writing/storing the JSON files, and especially pay very close attention to the format of your JSON files.  That gave us more grief more than anything.  I would run the script in VSCode or the ISE and go line by line to ensure things are getting loaded and check to see where you might be going sideways.

    • John Warner's avatar
      John Warner
      Iron Contributor

      BTW, I was able to accomplish this task by using the following PowerShell command.  Thanks to Mikael Svenson.

      New-PnPUPABulkImportJob -Folder "Shared Documents" -Path "userprofileimport.json" -IdP
      roperty "IdName" -UserProfilePropertyMapping @{"EmpId"="EmpId"}

       

  • I have not tried the how-to my self but I don't see anything extrange there...have you tried, as an alternative to PowerShell, to create a Visual Studio solution where you program all the stuff in C#?