AutoPopulate fields with userdetails based on UniqueID field

by chakram at 2013-02-26 05:58:09


I have a requirement in the SharePoint 2010 List containing the fields - Unique ID (People picker), FirstName(SingleLineofText), LastName(SingleLineofText) and so on.

Whenever the user fill in the "UniqueID" column, the fields (Firstname and Lastname) should be automatically populated based on the UniqueID.

I need the powershell script for the same

by poshoholic at 2013-02-26 06:54:20
Something like this?
function New-User {
[Parameter(Position=0, Mandatory=$true)]
# First clean up the input (remove leading/trailing whitespace, plus replace any paired spaces with a single space)
$Name = $Name -replace '^\s+|\s+$' -replace '\s+',' '
# Now get the name parts
$NameParts = $Name -split '\s',2
# Finally return an object with the name, firstname, and lastname properties
New-Object -TypeName PSObject -Property @{
Name = $Name
FirstName = $NameParts[0]
LastName = $NameParts[1]

Here’s some output from that command:
PS C:> New-User ‘Kirk Munro’

Name LastName FirstName
---- -------- ---------
Kirk Munro Munro Kirk

PS C:> New-User ‘Miguel de Icaza’

Name LastName FirstName
---- -------- ---------
Miguel de Icaza de Icaza Miguel

PS C:> New-User ‘Joe’

Name LastName FirstName
---- -------- ---------
Joe Joe

PS C:> New-User ’ Too ManySpaces '

Name LastName FirstName
---- -------- ---------
Too ManySpaces ManySpaces Too
by chakram at 2013-02-26 23:02:41
Hi Kirk,

Yes, it is almost same, but i need to get the userid/uniqueid(PeoplePicker) from the list field and it should autopopulate the other fields first and last name based on this unique id, i have attached the screenshot of the requirement, kindly let me know if that is possible through powershell for teh SharePoint 2010 List.


by poshoholic at 2013-02-27 07:16:55
Ah, I thought you were using SharePoint as an example, looking for a script to do that work. I get what you’re looking for now. I’m not a SharePoint guy, so to help you get the right assistance for this I’m going to copy the thread into the PowerShell and SharePoint forum. Someone over there should be able to help you.