DocumentServiceProxy.CreateProjectFromTemplate Method

Description

Creates a new project using a customized template that contains specialized data. This custom template can be created using Prolog Manager Administrator. The template file can be uploaded to Prolog Converge using the Prolog Converge Admin Tool or a web service.

Syntax Example

	‘Create Project using the customized template (contains specialized data based on the customer need and it can be created from the Prolog Manager Administrator)
	Dim project As PrologDocument = DocumentServiceProxy.CreateProjectFromTemplate(
		projectDocument,CreationType,TemplateName,BudgetCodeStructure)
 

Parameters

projectDocument

Instantiate the Project Document and provide values for all the required fields.

CreationType

ProjectCreationType.AllTemplateData – Imports all template data from the template.

ProjectCreationType.LookupAndListGroups – Imports only all lookup and list group data.

ProjectCreationType.NoTemplateData – Imports no template data.

TemplateName

The template name is required only while creating the project using the customized template and this template must be available in the Converge database.

BudgetCodeStructure

If a budget code structure value is provided, it is set to the newly created project instead of the budget code structure available in the template.

Return Value

A new project document instance is created using a custom template.

Examples

Dim fileBytes As Byte() = Nothing ‘ Load the file content into fileBytes 

	‘ Upload the template using the below method
	AdminService.AddOrUpdateProjectTemplate(templateName, fileBytes)

	‘Create Project using the customised template (contains specialized data based on the customer need and it can be created from the Prolog Manager Administrator)
		Dim projectsDocument As DocumentData = ProjectService.GetNewDocument()
		projectsDocument.Name = TestProjectName
		projectsDocument.Sequence = TestProjectSequence

		Dim savedProjectDocument = CreateProjectFromTemplate(projectsDocument, Gateway.DocumentService.ProjectCreationType.AllTemplateData, templateName, Nothing)

		projectsDocument = DirectCast(PrologSerializer.ToTypedDocument(savedProjectDocument, GetType(DocumentData)), DocumentData)

	‘Template can be removed from the Converge DB as follows
		AdminService.RemoveProjectTemplate(templateName)
       
	‘Retrieving the list of project template names from the Converge DB.
	AdminServiceProxy.ListProjectTemplates()