I have created user profile application successfully and also I got all user profiles to Central Administration from AD. but now how do I save these all user profiles details into list in subsite.
I am looking for any solution COM/SOM.
I got some solution by PowerShell:
#Add SharePoint PowerShell SnapIn if not already added
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$site = new-object Microsoft.SharePoint.SPSite("http://abcd01:9999/");
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);
#Get UserProfileManager from the My Site Host Site context
$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
$AllProfiles = $ProfileManager.GetEnumerator()
#Open SharePoint List
$SPServer="http://abcd01:9999/"
$SPAppList="/Lists/UPList/"
$spWeb = Get-SPWeb $SPServer
$spData = $spWeb.GetList($SPAppList)
foreach($profile in $AllProfiles)
{
#Create a new item
$newItem = $spData.Items.Add()
#Add properties to this list item
$DisplayName = $profile.DisplayName
$AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value
$newItem["DispName"] = $DisplayName
$newItem["AccName"] = $AccountName
write-host "Profile for account ", $AccountName
$newItem.Update()
}
write-host "Finished."
$site.Dispose()
But in User profile service application showing 1700+ number of user profiles but I got 93 profiles to my list.
Anyone know why? How do I get remaining?