Script to Write and Get User Profile Properties in SharePoint Online with CSOM

Script to Write and Get of User Profile properties in SharePoint Online via PowerShell with CSOM. Spports Single and Multi valued properties!In Order to use this script you will need SharePoint Server 2013 Client Components SDK or SharePoint Online Client Components SDK that

 
 
 
 
 
5 Star
(18)
3,520 times
Add to favorites
Office 365
4/6/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Amazing
    1 Posts | Last post February 22, 2019
  • Exception calling "ExecuteQuery" with "0" argument(s):
    3 Posts | Last post January 24, 2019
    • Ivan,
      
      I get the following error: Exception calling "ExecuteQuery" with "0" argument(s): "The sign-in name or password does not match one in the Microsoft  Account system even thought I can log in via MFA or directly to the O365 Admin center portal with same credentials.   sharepointclientcomponents_16-6518-1200_x64-en-us installed on a Win10 Machine with SP Online Management shell version 16.6906.1200 installed.  
      
      Any help would be appreciated.
    • Hi dcp41, did you manage to get it resolved? We have MFA enabled as well and I can log in to powershell and admin portal, but apparently I got an issue with:
      
      $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
      $Context.Credentials = $Creds
      
      #Identify users in the Site Collection
      $Users = $Context.Web.SiteUsers
      $Context.Load($Users)
      $Context.ExecuteQuery()
      
      it gives me:
      
      Exception calling "ExecuteQuery" with "0" argument(s): "The sign-in name or password does not match one in the Microsoft account system."
      At line:3 char:1
      + $Context.ExecuteQuery()
      + ~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
          + FullyQualifiedErrorId : IdcrlException
       
      
    • Got the answer - use app password mate: https://docs.microsoft.com/en-us/office365/admin/security-and-compliance/set-up-multi-factor-authentication?view=o365-worldwide
  • Multivalue Properties
    1 Posts | Last post April 30, 2018
    • Is there away to update AccountName with several different PropertyNames?   I see mentioned of single value - curious if anyone has been able to come up with a way.?
      
      Thanks.
  • Property with Privacy "only me"
    2 Posts | Last post September 20, 2017
    • the "Get-" didn't pull out the properties that are marked as "only me" privacy. It gives the properties marked as "everyone" privacy. Any idea to include that.?
    • did you find any solution for this, i am also looking for answer
  • ----
    1 Posts | Last post July 08, 2017
    • I love it! Thank you!
  • Permissions issue
    2 Posts | Last post June 23, 2017
    • I'm having a hard time narrowing down the permissions that are required to run the Set- command. 
      
      I have a user set up as a SharePoint Admin in Office 365 and still get an Access Denied error. 
      
      Anything else I could be missing?
    • Figured out the answer. Wasn't using the admin portal. (https://<tenant>-admin.sharepoint.com)
      
      The Get- command works with https://<tenant>.sharepoint.com, but the Set- command does not.
  • Good walkthrough!
    1 Posts | Last post June 08, 2017
    • Very nice script. Thank you!
      
  • Great, work fine!
    1 Posts | Last post March 03, 2017
    • Thanks a lot, Ivan. You did a great job.
      
      It works much better than the SharePoint Online modules downloaded at each Powershell session which manages only a very few user properties.
      
      Your script can manage all the user properties.
      
      It works even for properties newly and manually created for the users in SharePoint Online.
      
      Thanks again!
      Jean.
  • How to get specific user properties for all SPO users
    1 Posts | Last post March 02, 2017
    • For example. I want to find all users who does not have job title, and display their account name. We have a lot of test accounts in Sharepoint. I want to delete or at least hide them from sharepoint online. The test accounts, don't have job titles.
      
      So I need to make adjustments to Get-SPOUserProfileProperty.ps1 to accomplish that goal, any recommendations?
  • Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 3
    4 Posts | Last post March 02, 2017
    • Keeps getting error: 
      
      Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 3.
      At C:\PP\SCRIPTS\Upload-ProfilePhotos.psm1:72 char:1
      + Add-PSSnapin Microsoft.SharePoint.PowerShell
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      
      Installed Sharepoint Online Management Shell, but did not help. Tried some google solutions, but did not help.
      Any idea?
    • You do not need any additional PowerShell module, you need SP Client SDK.
      
      Are you sure that you are running the scripts as the provided examples?
    • Thanks Serg777777.
      
      I worked this out. I was using Sharepoint online. The script Ivan developed was for SP2013. That's why I got the error.
      
      I changed his code a little bit, and it worked fine now.
    • Sorry, I should say thanks Ivan. 
1 - 10 of 15 Items