1

The Get-PnPUserProfileProperty (part of the Officedev Pnp Powershell commandlets) can be used to query User Profiles on SharePoint Online. We must connect to the tenant admin website (https://:-admin.sharepoint.com) with Connect-PnPOnline in order to use this cmdlet with SharePoint Online.

I would like to use the commandlet to talk to an On Premise SharePoint server too

I've tested this, but as far as I can see this commandlet is not included in the On Premise version of the Officedev PNP Powershell Commandlets. In the documentation I cannot find a definite answer.

Can someone confirm that this commandlet does indeed not work with SharePoint Server?

1 Answer 1

1

that commands is only for the SPO not for on-prem. But you can use the below powershell to query the User's profile in on-prem.

The basic PowerShell code for getting a user profile, using the user's login name:

[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server");            
$site=new-object Microsoft.SharePoint.SPSite("https://c05470sp10:7443");            
$serviceContext = Get-SPServiceContext $site;            
$site.Dispose();            
$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext);
$userProfile = $upm.GetUserProfile("company\myarlett");

this will list all properties

$userProfile.Properties | sort DisplayName | FT DisplayName,Name,@{Label="Type";Expression={$_.CoreProperty.Type}}

read more options here: http://social.technet.microsoft.com/wiki/contents/articles/20692.sharepoint-2013-get-set-and-copy-user-profile-properties-using-powershell.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.