尝试获取以特定单词开头的项目,但我收到以下错误:"' StartsWith'成员不能在表达式中使用。"
ProjectContext projContext = new ProjectContext(urlPWA);
projContext.Credentials = new SharePointOnlineCredentials(user,passwordSecurity);
projContext.Load(projContext.Projects, c => c.Where(p => p.Name.StartsWith(name, true, new CultureInfo("es-ES"))).IncludeWithDefaultProperties(f => f.Name, f => f.Tasks, f => f.ProjectResources, f => f.Owner.UserId, f => f.CheckedOutBy.UserId));
projContext.ExecuteQuery();
答案 0 :(得分:0)
我不熟悉那样的特殊查询。但是一个快速的解决方法可能是获得整个集合并在之后迭代它。希望您的PWA中没有一百万个项目:)
projContext.Load(projContext.Projects);
projContext.ExecuteQuery();
foreach (PublishedProject pubProj in projContext.Projects)
{
if (pubProj.Name.StartsWith("yourString") {
// Do something
}
}