Query User Field

04/02/2016 08:05

Add-PSSnapin microsoft.sharepoint.powershell -ea 0
$webUrl = "https://yoursitecollection"
$listUrl = "/Lists/Members"
$memberId = 27

#'Member' field is of type SPUser

$web = Get-SPWeb $webUrl

$listUrl = $web.ServerRelativeUrl + $listUrl
$list = $web.GetList($listUrl);
$list.Title

$query = New-Object microsoft.sharepoint.spquery
$query.Query = "<Where><Eq><FieldRef Name='Member' LookupId='True'/><Value Type='Integer'>"+$memberId +"</Value></Eq></Where>"

$items = $list.GetItems($query);

foreach($item in $items)
{
    "ID: {0}" -f $item.ID
    "Title: {0}" -f $item["Title"]
    "======================"
}