Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Reading and Writing Values to SPS-Skills User Profile Service Property

$
0
0

Hi,

I am trying to read a value from SPS-Skills UPS property using the following powershell code:

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
add-type -path "C:\program files\common files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.Office.Server.dll"
$PSSnapIn = Get-PSSnapin|where {$_.Name -like "*sharepoint*"}
if (!($PSSnapIn.Name -like "*sharepoint*"))
{
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}
$Site = Get-SPSite 'https://webapp.rjc.ca' -Limit 1
$ServiceContext = Get-SPServiceContext($Site)
$ProfileManager = New-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
$Profiles = $ProfileManager.GetEnumerator() #Loads the user profiles into an array
$StreamWriter = [System.IO.StreamWriter] "c:\users\sk_admin\desktop\skills.txt"
Foreach ($Profile in $Profiles) 
{
    $CurrentValue = $Profile["SPS-Skills"].Value
    $StreamWriter.WriteLine($CurrentValue)
}
$StreamWriter.close()

However when it returns the result it only shows the first of the list of skills. EG: it only shows Technical Support, when it should show all the below:

Further to the question how would I go about writing more then one skill.


Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>