对了,我有一个代码工作位,它允许我创建SharePoint项目在线,但它正在创建为“企业项目”在默认情况下, 我要创造,它作为“的SharePoint任务列表”来代替 。 (这些都是编辑项目时,下面的2个选项在线)
我设法找到的代码的唯一一点就是这个改变它:
// Get the GUID of the specified enterprise project type.
private static Guid GetEptUid(string eptName)
{
Guid eptUid = Guid.Empty;
try
{
// Get the list of EPTs that have the specified name.
// If the EPT name exists, the list will contain only one EPT.
var eptList = projContext.LoadQuery(
projContext.EnterpriseProjectTypes.Where(
ept => ept.Name == eptName));
projContext.ExecuteQuery();
eptUid = eptList.First().Id;
// Alternate routines to find the EPT GUID. Both (a) and (b) download the entire list of EPTs.
// (a) Using a foreach block:
//foreach (EnterpriseProjectType ept in projSvr.EnterpriseProjectTypes)
//{
// if (ept.Name == eptName)
// {
// eptUid = ept.Id;
// break;
// }
//}
// (b) Querying for the EPT list, and then using a lambda expression to select the EPT:
//var eptList = projContext.LoadQuery(projContext.EnterpriseProjectTypes);
//projContext.ExecuteQuery();
//eptUid = eptList.First(ept => ept.Name == eptName).Id;
}
catch (Exception ex)
{
string msg = string.Format("GetEptUid: eptName = \"{0}\"\n\n{1}",
eptName, ex.GetBaseException().ToString());
throw new ArgumentException(msg);
}
return eptUid;
}
从这里引用: https://msdn.microsoft.com/en-us/library/microsoft.projectserver.client.projectcontext.waitforqueue.aspx
从该代码块我已经在通过basicEpt
名称,例如给定的感: private static string basicEpt = "SharePoint Tasks List";
我曾尝试多种EPT的,我已经有杂色山雀设置创建,但我仍然创造一个企业的项目,所以无论是我失去了一些东西?
有可用的样本项目的列表,在这里下载为SharePoint: https://github.com/OfficeDev/Project-Samples
我特别感兴趣的是“创造更新项目样本”。 这会给你一个程序,它马上工作,并希望证明我的问题是什么,所需承滴盘是在上面的函数添加。
感谢这里的任何帮助,它传递正确的GUID上述功能,但它没有被正确保存。