Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow get not deployed to Content Type #1135

Open
EA12 opened this issue Apr 30, 2019 · 2 comments
Open

Workflow get not deployed to Content Type #1135

EA12 opened this issue Apr 30, 2019 · 2 comments
Assignees
Labels

Comments

@EA12
Copy link

EA12 commented Apr 30, 2019

It should be possible to attach a Workflow to a Content type.

Workflows got deployed to the web but are not attached to the Content type.
Using: CSOM SharePoint Online
SPMeta2 API: v4.0.30319

SPMeta2 model:


var consoleUtils = new ConsoleUtils();
	consoleUtils.TraceEvent += consoleUtils_TraceEvent;
	
	consoleUtils.WithO365Context(this.WebUrl, this.O365User, this.O365Pwd, context =>
	{
		CSOMProvisionService provisionService = new CSOMProvisionService();

		consoleUtils.TraceDeploymentProgress(provisionService);
		
		var model = SPMeta2Model.NewWebModel(webmodel =>
		{
			ContentTypeDefinition ct = ContentTypes.GetQMDokument();

			webmodel.AddContentType(ct, contentType =>
			{
				WorkflowAssociationDefinition wfCollect = new WorkflowAssociationDefinition
				{
					TaskListTitle = "Aufgaben",
					HistoryListTitle = "Workflowverlauf",
					AllowManual = true,
					Name = "Kenntnisnahme",
					Description = "Lenkt ein Dokument zum Review. Reviewer müssen die Kenntnisnahme bestätigen. Der Besitzer des Dokuments wird informiert, wenn der Workflow abgeschlossen ist.",
					WorkflowTemplateName = BuiltInWorkflowNames.CollectFeedbackSharePoint2010,
					AssociationData = "<dfs:myFields xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:dms=\"http://schemas.microsoft.com/office/2009/documentManagement/types\" xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:q=\"http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields\" xmlns:d=\"http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields\" xmlns:ma=\"http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes\" xmlns:pc=\"http://schemas.microsoft.com/office/infopath/2007/PartnerControls\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dfs:queryFields></dfs:queryFields><dfs:dataFields><d:SharePointListItem_RW><d:Reviewers><d:Assignment><d:Assignee><pc:Person><pc:DisplayName>QM Reviewer</pc:DisplayName><pc:AccountId>QM Reviewer</pc:AccountId><pc:AccountType>SharePointGroup</pc:AccountType></pc:Person></d:Assignee><d:Stage xsi:nil=\"true\" /><d:AssignmentType>Parallel</d:AssignmentType></d:Assignment></d:Reviewers><d:ExpandGroups>true</d:ExpandGroups><d:NotificationMessage>Bitte lesen Sie das Dokument und bestätigen Sie die Kenntnisnahme!</d:NotificationMessage><d:DueDateforAllTasks xsi:nil=\"true\" /><d:DurationforSerialTasks>5</d:DurationforSerialTasks><d:DurationUnits>Day</d:DurationUnits><d:CC /><d:CancelonChange>true</d:CancelonChange></d:SharePointListItem_RW></dfs:dataFields></dfs:myFields>"
				};
				contentType.AddWorkflowAssociation(wfCollect);

				WorkflowAssociationDefinition wfApproval = new WorkflowAssociationDefinition
				{
					TaskListTitle = "Aufgaben",
					HistoryListTitle = "Workflowverlauf",
					AllowManual = true,
					Name = "Genehmigung",
					Description = "Lenkt ein Dokument zur Genehmigung. Der Besitzer des Dokuments wird informiert, wenn der Workflow abgeschlossen ist.",
					WorkflowTemplateName = BuiltInWorkflowNames.ApprovalSharePoint2010,
					//AssociationData = "<dfs:myFields xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:dms=\"http://schemas.microsoft.com/office/2009/documentManagement/types\" xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:q=\"http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields\" xmlns:d=\"http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields\" xmlns:ma=\"http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes\" xmlns:pc=\"http://schemas.microsoft.com/office/infopath/2007/PartnerControls\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dfs:queryFields></dfs:queryFields><dfs:dataFields><d:SharePointListItem_RW><d:Approvers><d:Assignment><d:Assignee><pc:Person><pc:DisplayName>QM Genehmiger</pc:DisplayName><pc:AccountId>QM Genehmiger</pc:AccountId><pc:AccountType>SharePointGroup</pc:AccountType></pc:Person></d:Assignee><d:Stage xsi:nil=\"true\" /><d:AssignmentType>Parallel</d:AssignmentType></d:Assignment></d:Approvers><d:ExpandGroups>true</d:ExpandGroups><d:NotificationMessage>Bitte prüfen und genehmigen Sie das Dokument.</d:NotificationMessage><d:DueDateforAllTasks xsi:nil=\"true\" /><d:DurationforSerialTasks>5</d:DurationforSerialTasks><d:DurationUnits>Day</d:DurationUnits><d:CC /><d:CancelonRejection>true</d:CancelonRejection><d:CancelonChange>true</d:CancelonChange><d:EnableContentApproval>false</d:EnableContentApproval></d:SharePointListItem_RW></dfs:dataFields></dfs:myFields>"
				};
				contentType.AddWorkflowAssociation(wfApproval);
			});
		});

		provisionService.DeployWebModel(context, model);
	});

All related Artifacts are deployed before that model and the Content Type will be attached to a library afterwards.

From the Settings pages of Site-Content-Type and library I can see that no Workflow is attached but the WorkflowAssosiation is deployed to the web.

Side-Note: custom description of the WorkflowAssociationDefinition will be overidden with the default description of the provided WorkflowTemplateName.

Is related to following Yammer post: https://www.yammer.com/spmeta2feedback/#/Threads/show?threadId=974786701

@SubPointSupport
Copy link
Contributor

Looking into this.

No exception is raised, it just deployed with no errors and bindings?

@SubPointSupport SubPointSupport self-assigned this May 5, 2019
@EA12
Copy link
Author

EA12 commented May 6, 2019

Yep, no erros. If I navigate to the Workflow-Details, I can see that the Template-Field has no Workflow-Templates listed. It should be as in following screenshot but is empty:
wf

So, may be there is something wrong with WorkflowTemplateName = BuiltInWorkflowNames.CollectFeedbackSharePoint2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants