[英]CSOMUnknownUser error on working with draft project in Project Server 2013 CSOM
我正在嘗試使用 Project Server 2013 CSOM,我可以進行身份驗證、讀取任何信息、創建新項目等,但是我對草稿項目有疑問,無論如何,當我想對草稿項目執行查詢時,我會收到錯誤消息CSOMUnknownUser
和任何東西。 在我的搜索中,我沒有得到有關此錯誤的特殊信息,並且
這是我的代碼的一部分:
context = GetContext(pwaInstanceUrl);
// Retrieve publish project named "New Project"
// if you know the Guid of project, you can just call context.Projects.GetByGuid()
csom.PublishedProject project = GetProjectByName(projectName, context);
if(project == null)
{
Console.WriteLine("Failed to retrieve expected data, make sure you set up server data right. Press any key to continue....");
return;
}
csom.DraftProject draft = project.CheckOut();
// Retrieve project along with tasks & resources
context.Load(draft, p => p.StartDate,
p => p.Description);
context.Load(draft.Tasks, dt => dt.Where(t => t.Name == taskName));
context.Load(draft.Assignments, da => da.Where(a => a.Task.Name == taskName &&
a.Resource.Name == localResourceName));
context.Load(draft.ProjectResources, dp => dp.Where(r => r.Name == localResourceName));
context.ExecuteQuery();
我在最后一行context.ExecuteQuery()
收到錯誤
執行這些命令時: context.Load(draft.Assignments, da => da.Where(a => a.Task.Name == taskName && a.Resource.Name == localResourceName));
context.Load(draft.ProjectResources, dp => dp.Where(r => r.Name == localResourceName));context.Load(draft.Assignments, da => da.Where(a => a.Task.Name == taskName && a.Resource.Name == localResourceName));
嘗試刪除
context.Load(draft.ProjectResources, dp => dp.Where(r => r.Name == localResourceName));da=>da.Where(r => r.Name == localResourceName)
位並檢查您要查找的資源是否確實存在於Project Server上。 如果有幫助,請告訴我
請在projectcontext中添加用戶憑證,如下所示:
NetworkCredential cred = new NetworkCredential();
cred.Domain = "domain";
cred.UserName = "username";
cred.Password = "password";
context.Credentials = cred;
我有同樣的問題。 問題是我試圖編輯的項目已經簽出。 我用這段代碼來檢查它,然后我嘗試完成剩下的工作。 這是首先檢查它的代碼:
DraftProject draft;
draft = pubPro.Draft;
JobState job1 = projectContext.WaitForQueue(draft.CheckIn(true), 20);
draft = pubPro.CheckOut();
projectContext.Load(draft);
projectContext.ExecuteQuery();
您必須使用提升的權限來簽出草稿項目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.