mardi 30 décembre 2014

Creating Enterprise project type in CSOM



I want to create a new EPT (project server 2013) using C# CSOM library. Here is what i have done so far



List<ProjectDetailPageCreationInformation> pages = new List<ProjectDetailPageCreationInformation>();

projContext.Load(projContext.ProjectDetailPages);
projContext.ExecuteQuery();

projContext.Load(projContext.EnterpriseProjectTypes);
projContext.ExecuteQuery();

pages.Add(new ProjectDetailPageCreationInformation() { Id = projContext.ProjectDetailPages[12].Id, IsCreate = false });


CreateEPT("New EPT ", "test desc", "PROJECTSITE#0", pages);

private static void CreateEPT(string strName, string strDescription, string strTemplateName, List<ProjectDetailPageCreationInformation> pages)
{
EnterpriseProjectTypeCreationInformation newProjType = new EnterpriseProjectTypeCreationInformation();
newProjType.Description = strDescription;
newProjType.Id = Guid.NewGuid();
newProjType.IsDefault = false;

newProjType.Name = strName;
newProjType.ProjectDetailPages = pages;

newProjType.ProjectPlanTemplateId = Guid.Empty;
newProjType.WorkflowAssociationId = Guid.Empty;
newProjType.WorkspaceTemplateName = strTemplateName;
newProjType.Order = 1;

projContext.EnterpriseProjectTypes.Add(newProjType);
projContext.EnterpriseProjectTypes.Update();


}


Getting "EnterpriseProjectTypeCreatePDPIsRequired" error. Any idea how to resolve this? or have you created EPT for office 365 project server using CSOM .








0 commentaires:

Enregistrer un commentaire