I have created 2 column in sharepoint list. One field called owner is person or group type column and the other one is website template using choice type column.

The question how to read the value owner and website template column above.

Here is the code so far:

listName ="CustomerList" 

Add-Type -Path "D:\libs\Powershell Office365\Libraries\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "D:\libs\Powershell Office365\Libraries\Microsoft.SharePoint.Client.Runtime.dll" 
Add-Type -Path "D:\libs\Powershell Office365\Libraries\Microsoft.SharePoint.Client.Taxonomy.dll" 

# connect/authenticate to SharePoint Online and get ClientContext object.. 
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword) 
$clientContext.Credentials = $credentials 

if (!$clientContext.ServerObjectIsNull.Value) 
    Write-Host "Connected to SharePoint Online site: '$Url'" -ForegroundColor Red 

$web = $clientContext.Web

$list = $clientContext.Web.Lists.GetByTitle($listName)

$camlQuery = new-object Microsoft.SharePoint.Client.CamlQuery;
$camlQuery.ViewXml = "<View>
       <FieldRef Name='Status' /> 
            <Value Type='Text'>Approve</Value>

$items = $list.GetItems( $camlQuery )
#execute query 

Write-Host "Connecting to SharePoint Online, URL = $rootUrl"
   Connect-SPOService -Url $rootUrl -Credential $credential
   Write-Host "Successfully connected.." -ForegroundColor Green
   Write-Error "Failed to connect to $url - check the credentials and URL!" $_

foreach($item in $items)
    $siteUrl  = "https://contoso.sharepoint.com/sites/"
    $title = $item["Title"]
    $owner = [Microsoft.SharePoint.Client.FieldUserValue]
    $owner = $item["Owner"]
    $siteTemplate =  $item.GetFormattedValue("Website Template")

    Write-host $title, $status, $owner, $siteTemplate


Based on the code above, i unable to display Website Template and Owner column. Any feedbacks or help greatly appreciate.

Thank you

1 Answer 1


Try this to get person type field value:

$owner = new-object Microsoft.SharePoint.Client.FieldUserValue($item["Owner"]).LookupValue

The choice value should work using $item.GetFormattedValue("Website Template"). Make sure the field name is correct.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.