SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-301753%22%20slang%3D%22en-US%22%3EUpdate%20Custom%20User%20Profile%20Property%20in%20SharePoint%20Online%2C%20Possible%3F%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301753%22%20slang%3D%22en-US%22%3E%3CP%3EI%20hope%20someone%20knows%20the%20answer%20to%20this%20because%20no%20one%20I've%20talked%20to%20at%20Microsoft%20does.%3C%2FP%3E%3CP%3EI%20have%20created%20custom%20properties%20for%20my%20user%20profiles%2C%20such%20as%20Employee%20Id.%26nbsp%3B%20I%20want%20to%20update%20these%20properties%20on%20a%20nightly%20schedule%20using%20PowerShell.%26nbsp%3B%20I%20have%20followed%20the%20instructions%20on%20this%20page%20in%20order%20to%20accomplish%20this%20task%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsolution-guidance%2Fbulk-user-profile-update-api-for-sharepoint-online%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsolution-guidance%2Fbulk-user-profile-update-api-for-sharepoint-online%3C%2FA%3E%3C%2FP%3E%3CP%3EWhen%20I%20run%20the%20script%2C%20I%20seem%20to%20get%20a%20successful%20run%2C%20ie%3A%20No%20error%20messages%3C%2FP%3E%3CP%3EHowever%2C%20the%20Guid%20returned%20is%20a%20null%20value%2C%20in%20other%20words%26nbsp%3B00000000-0000-0000-0000-000000000000%3C%2FP%3E%3CP%3EAlso%20when%20I%20run%20this%20command%26nbsp%3B%24o365.GetImportProfilePropertyJobs()%2C%20I%20get%20an%20error%20stating%20that%20the%20collection%20has%20not%20been%20initialized.%26nbsp%3B%20Meaning%20there%20have%20been%20no%20jobs%20created.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20it%20looks%20like%20this%20command%20is%20not%20working%20for%20me%2C%20am%20I%20missing%20something%3F%3F%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-301753%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302842%22%20slang%3D%22en-US%22%3ERe%3A%20Update%20Custom%20User%20Profile%20Property%20in%20SharePoint%20Online%2C%20Possible%3F%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302842%22%20slang%3D%22en-US%22%3E%3CP%3EBTW%2C%20I%20was%20able%20to%20accomplish%20this%20task%20by%20using%20the%20following%20PowerShell%20command.%26nbsp%3B%20Thanks%20to%26nbsp%3B%3CSPAN%20class%3D%22gD%22%3EMikael%20Svenson%3C%2FSPAN%3E.%3C%2FP%3E%3CP%3ENew-PnPUPABulkImportJob%20-Folder%20%22Shared%20Documents%22%20-Path%20%22userprofileimport.json%22%20-IdP%3CBR%20%2F%3Eroperty%20%22IdName%22%20-UserProfilePropertyMapping%20%40%7B%22EmpId%22%3D%22EmpId%22%7D%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22gD%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302242%22%20slang%3D%22en-US%22%3ERe%3A%20Update%20Custom%20User%20Profile%20Property%20in%20SharePoint%20Online%2C%20Possible%3F%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302242%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20been%20able%20to%20do%20this%20successfully%2C%20and%20I%20can%20tell%20you%20to%20be%20sure%20you%20are%20a%20global%20admin%20running%20the%20PowerShell%2C%20have%20access%20to%20the%20library%20where%20you%20are%20writing%2Fstoring%20the%20JSON%20files%2C%20and%20especially%20pay%20very%20close%20attention%20to%20the%20format%20of%20your%20JSON%20files.%26nbsp%3B%20That%20gave%20us%20more%20grief%20more%20than%20anything.%26nbsp%3B%20I%20would%20run%20the%20script%20in%20VSCode%20or%20the%20ISE%20and%20go%20line%20by%20line%20to%20ensure%20things%20are%20getting%20loaded%20and%20check%20to%20see%20where%20you%20might%20be%20going%20sideways.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-301771%22%20slang%3D%22en-US%22%3ERe%3A%20Update%20Custom%20User%20Profile%20Property%20in%20SharePoint%20Online%2C%20Possible%3F%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301771%22%20slang%3D%22en-US%22%3EI%20have%20not%20tried%20the%20how-to%20my%20self%20but%20I%20don't%20see%20anything%20extrange%20there...have%20you%20tried%2C%20as%20an%20alternative%20to%20PowerShell%2C%20to%20create%20a%20Visual%20Studio%20solution%20where%20you%20program%20all%20the%20stuff%20in%20C%23%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1223923%22%20slang%3D%22en-US%22%3ERe%3A%20Update%20Custom%20User%20Profile%20Property%20in%20SharePoint%20Online%2C%20Possible%3F%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1223923%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F124143%22%20target%3D%22_blank%22%3E%40John%20Warner%3C%2FA%3E%26nbsp%3B%20able%20to%20share%20the%20script%20you%20used%20to%20schedule%20nightly%20updates%3F%20I'm%20trying%20to%20do%20something%20similar%2C%20to%20update%20say%20every%20alternate%20Monday%20at%2012%20AM%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

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-s...

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???

4 Replies
Highlighted
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#?
Highlighted

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.

Highlighted
Best Response confirmed by John Warner (Contributor)
Solution

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"}

 

Highlighted

@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