找不到 PeopleManager 和 SiteUserInfoList 未返回所有用户

Can't find PeopleManager and SiteUserInfoList not returning all users

我想使用 PeopleManager 但由于某些原因我没有。我刚刚得到

CS0246 The type or namespace name 'PeopleManager' could not be found (are you missing a using directive or an assembly reference?)

我正在使用 Microsoft.SharePoint.ClientMicrosoft.SharePoint.Client.RunTime V4.0.30319

为什么我找不到人事经理?

我目前正在让所有用户使用此代码:

var web = clientContext.Web;
var list = clientContext.Web.SiteUserInfoList;
var users = list.GetItems(new CamlQuery());
clientContext.Load(users, includes => includes.Include(
    f => f["GUID"],
    f => f["FirstName"],
    f => f["LastName"],
    f => f["UserName"],
    f => f.DisplayName));

try
{
    clientContext.ExecuteQuery();
}
catch (Exception e)
{
    Trace.TraceError(e.Message);
    Trace.TraceError(e.StackTrace);
    throw;
}

但缺少一些用户。感谢任何帮助。

你现在可能已经明白了,但你必须在你的使用指令中包含 SharePoint.Client.UserProfiles。

如果没有,请下载 NuGet Package