SharePoint 查找字段返回空值

SharePoint lookup field returning null value

我正在使用 CSOM 从 sharePoint 在线检索数据。 我需要从文档库中获取数据。这是我用来检索数据的语法。

List list = clientContext.Web.Lists.GetByTitle("Required Documents");
if (list != null)
{
CamlQuery caml = new CamlQuery();
caml.ViewXml = @"<View>
                  <Query>
                    <Where>
                       <Eq>
                         <FieldRef Name='PONo' />
                         <Value Type='Lookup'>" + poNo + @"</Value>
                        </Eq>
                    </Where>
                 </Query>                                            
                </View>";                                               

ListItemCollection items = list.GetItems(caml);
clientContext.Load<ListItemCollection>(items);
clientContext.ExecuteQuery();

此处 PONo 是对另一个列表项的查找。 所以我尝试获取如下值,但它 returns null.

var itm = item.FieldValues["PONo"] as FieldUserValue;

当这样尝试时,

var itm = item.FieldValues["PONo"];

它returns 需要的值。会有什么问题?

像这样尝试,FieldUserValue 在处理用户时很有用,但在这种情况下你需要 FieldLookupValue

var PONo = item["PONo"] as FieldLookupValue;

if (PONo!= null)
{
    var PONo_Value = PONo.LookupValue;
    var PONo_Id = PONo.LookupId;
}