Why will an email address not populate in a new SharePoint entry?
![](https://techprofile.blob.core.windows.net/images/fhfSqBbqBUejYnGKww8zsA.png?8D915A)
I have a PowerShell script used to decommission servers in our environment. My code is successfully creating the new entry and populating all properties with the exception of the Assigned Tech. This is a "Person or Group" field. I have it set to Work E-Mail. To get the value for assigned tech I am doing the following: $AssignedTech = (Get-ADUser $ENV:UserName -Properties userPrincipalName -Server ServerName.my.company.local | Select UserPrincipalName).UserPrincipalName
I have verified this has my work email in it. I post to the Sharepoint site using the following. I have tried enclosing the $AssignedTech in quotes, also tried using [string]$AssignedTech. It is still blank. The Assigned Tech field name has a space in it so I have verified the field name is actually Assigned_x0020_Tech. Can anyone see why this is not populating? I am banging my head trying to figure this one out.
$params = @{
fields = @{
"Title" = $DecomServer;
"IP_x0020_Address" = "$ip";
"Assigned_x0020_Application" = $Application;
"Domain" = $Domain;
"Machine_x0020_Type" = $MachineType;
"Change_x0020_Ticket_x0020_Number" = $ChangeControl;
"Assigned_x0020_Tech" = $AssignedTech;
"OSVersion" = $OS;
"DateTurnedOff" = Get-Date;
"RemoveDate" = (Get-Date).AddDays(60)
}
}
New-MgSiteListItem -SiteId $siteId -ListId $listId -BodyParameter $params