?
Solved

Powershell and Sharepoint Hyperlink

Posted on 2011-04-19
2
Medium Priority
?
1,072 Views
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]$ADUser.Properties.sn
      <etc.>
        $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.
0
Comment
Question by:MacGyverSolutions
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
MacGyverSolutions earned 0 total points
ID: 35433780
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
0
 
LVL 2

Author Closing Comment

by:MacGyverSolutions
ID: 35433787
I figured it out, eventually, though it isn't the perfect solution.
0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
Sometimes it necessary to set special permissions on user objects.  For instance when using a Blackberry server, the SendAs permission needs to be set. I see many admins struggle with the setting that permission only to see it disappear within a few…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Loops Section Overview

621 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