Powershell and Sharepoint Hyperlink

Posted on 2011-04-19
Last Modified: 2012-08-13
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]$
        $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.
Question by:MacGyverSolutions
    LVL 2

    Accepted Solution

    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
    LVL 2

    Author Closing Comment

    I figured it out, eventually, though it isn't the perfect solution.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now