Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating EPT in project online using CSOM

    • 0
    • 0
    • 0
    • 0
    • 2
    • 0
    • 0
    • 0
    • 895
    Comment on it

    Hello Reader,

    The following code is used to create a new Enterprise Project Type(EPT):

    public void CreateEnterpriseProjectType(Guid eptGuid, string eptName, string eptDescription)
        {
            ProjectContext projectContext = new ProjectContext("http://serverName/pwaName");
            // for project online authentication
            SecureString securePassword = new SecureString();
            foreach (char ch in "adminPassword")
                securePassword.AppendChar(ch);
           
            SharePointOnlineCredentials sharePointOnlineCredentials = new SharePointOnlineCredentials("adminUsername", securePassword);
    
            projectContext.Credentials = sharePointOnlineCredentials;
    
            projectContext.Load(projectContext.EnterpriseProjectTypes);
            projectContext.Load(projectContext.ProjectDetailPages);
            projectContext.ExecuteQuery();
    
            EnterpriseProjectTypeCreationInformation eptInfo = new EnterpriseProjectTypeCreationInformation();
    
    
            eptInfo.Id = eptGuid;
            eptInfo.Name = eptName;
            eptInfo.Description = eptDescription;
            eptInfo.IsDefault = true;
            eptInfo.WorkspaceTemplateName = "PROJECTSITE#0";
            eptInfo.ProjectPlanTemplateId = Guid.Empty;
            eptInfo.WorkflowAssociationId = Guid.Empty;
            eptInfo.Order = 1;
    
            List<ProjectDetailPageCreationInformation> projectDetailPages = new List<ProjectDetailPageCreationInformation>() {new ProjectDetailPageCreationInformation() { Id = projectContext.ProjectDetailPages[1].Id, IsCreate = false }};
            eptData.ProjectDetailPages = projectDetailPages;
    
            EnterpriseProjectType newEpt = projectContext.EnterpriseProjectTypes.Add(eptInfo);
            projectContext.EnterpriseProjectTypes.Update();
            projectContext.ExecuteQuery();
        }

    I hope, it helps.

 2 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: