1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;
using Microsoft.Office.Workflow.Utility;
namespace SharePointWorkflow5
{
public sealed partial class Workflow1 : SequentialWorkflowActivity
{
public Workflow1()
{
InitializeComponent();
}
public Guid workflowId = default(System.Guid);
public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
public SPWorkflowTaskProperties createTaskWithContentType1_TaskProperties1 = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
public Guid createTaskWithContentType1_TaskId1 = default(System.Guid);
//declaration de l'id de la tache type de contenue qui est une feature // ceéé et déployer sur mon site
public static string idtest5 = "0x01080100E0AFEB61A91C4de19FB9659BB154241B";
private void createTaskWithContentType1_MethodInvoking(object sender, EventArgs e)
{
this.createTaskWithContentType1_TaskId1 = new Guid() ;
if (this.workflowProperties.TaskList.ContentTypesEnabled != true)
{
workflowProperties.TaskList.ContentTypesEnabled = true;
}
SPContentTypeId myContentTypeID = new SPContentTypeId(createTaskWithContentType1.ContentTypeId);
SPContentType myContentType = workflowProperties.Site.RootWeb.ContentTypes[myContentTypeID] ;
bool contenTypeExist = false ;
foreach (SPContentType contentType in workflowProperties.TaskList.ContentTypes)
{
if (contentType.Name == myContentType.Name)
{
contenTypeExist = true ;
break;
}
}
if (contenTypeExist!= true)
{
workflowProperties.TaskList.ContentTypes.Add(myContentType);
}
createTaskWithContentType1_TaskProperties1.Title = "Le-titre-de-la-tache ";
}
}
} |
Partager