• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1083
  • Last Modified:

Powershell and Sharepoint Hyperlink

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.
  • 2
1 Solution
MacGyverSolutionsAuthor Commented:
I have somewhat of a solution in case anyone else comes across this. Apparently setting the main variable to the value I want works, sort of. It sets both the URL and description fields to the required value. This isn't the perfect solution but happens to work in my case. For example:

$myItem["Contact Picture"] = [string]$ADUser.Properties.wWWHomePage
MacGyverSolutionsAuthor Commented:
I figured it out, eventually, though it isn't the perfect solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now