Powershell and Sharepoint Hyperlink
Posted on 2011-04-19
I have a Powershell script which I normally use to update our colleague directory on our SharePoint Intranet with the users in Active Directory. I would like to add a field in SharePoint which is of type "Hyperlink or Picture" so that the user's picture shows up. However I am getting hung up on setting this property, since (I think) that it's an object. My PowerShell skills are beginner, but my PHP and Perl skills are advanced, so this is new territory but I know code. I'm storing the URL to the user's picture in the AD field for "Web Site" for now.
Code snippet as follows:
$myItem["Title"] = [string]$ADUser.Properties.title
$myItem["First Name"] = [string]$ADUser.Properties.givenname
$myItem["Last Name"] = [string]$ADUser.Properties.sn
$myItem["Contact Picture"].Url = [string]$ADUser.Properties.wWWHomePage
That last line is what is not working. I also tried $myItem["Contact Picture"]["Url"] but this did not work either. What is the proper syntax to set this property? Do I need to create the property first, and how?
Thanks in advance.