![](/img/trans.png)
[英]Access my projects details in Microsoft Project server 2013 errors?
[英]Query that get the projects whose name 'starts with'. Project Server 2013
嘗試獲取以特定單詞開頭的項目,但出現以下錯誤:“表達式中不能使用'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();
我對這樣的特殊查詢不太熟悉。 但是,一種快速的解決方法可能是獲取整個集合,然后對其進行迭代。 希望您的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.