简体   繁体   English

查询获取名称以“开头”的项目。 Project Server 2013

[英]Query that get the projects whose name 'starts with'. Project Server 2013

Attempt to obtain projects that begin with a particular word , but I get the following error: "The 'StartsWith' member cannot be used in the expression." 尝试获取以特定单词开头的项目,但出现以下错误:“表达式中不能使用'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();

I'm not too familiar with special queries like that. 我对这样的特殊查询不太熟悉。 But a quick workaround would probably be to get the whole collection and iterate it afterwards. 但是,一种快速的解决方法可能是获取整个集合,然后对其进行迭代。 Hopefully you do not have a million projects in your PWA :) 希望您的PWA中没有一百万个项目:)

projContext.Load(projContext.Projects);
projContext.ExecuteQuery();

foreach (PublishedProject pubProj in projContext.Projects)
{
   if (pubProj.Name.StartsWith("yourString") {
   // Do something
   }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 访问Microsoft Project Server 2013错误中的我的项目详细信息? - Access my projects details in Microsoft Project server 2013 errors? 获取子项目Project Server接口 - Get sub projects Project Server Interface MS Project Server 2013 和 Sharepoint 2010 - MS Project Server 2013 and Sharepoint 2010 如何在Project Server 2013上强制执行Project Center视图? - How to force a Project Center View on Project Server 2013? 在 Project Server 2013 CSOM 中处理草稿项目时出现 CSOMUnknownUser 错误 - CSOMUnknownUser error on working with draft project in Project Server 2013 CSOM 我可以将SharePoint 2013列表与Project Server 2013列表同步吗? C#或JavaScript API? - Can I sync a Sharepoint 2013 List with Project Server 2013 List? C# or JavaScript API? 如何在Microsoft Project Server 2013中创建新任务 - How to create new tasks in Microsoft Project Server 2013 从Project Server 2013工作流消费ProjectData-禁止 - Consume ProjectData from Project Server 2013 Workflow - Forbidden 如何在Project Server 2013(C#VSTO加载项)中更改自定义字段的值 - How to change the value of a custom field in Project Server 2013 (C# VSTO AddIn) 是否有一个REST端点来获取Project Server中项目任务分配的列表? - Is there a REST endpoint to get a list of a project's task assignments in Project Server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM