簡體   English   中英

查詢獲取名稱以“開頭”的項目。 Project Server 2013

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM