|
1 |
| -using System.Management.Automation; |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Management.Automation; |
| 4 | + |
2 | 5 | using Microsoft.SharePoint.Client;
|
| 6 | +using Microsoft.SharePoint.Client.WorkflowServices; |
| 7 | + |
3 | 8 | using PnP.PowerShell.CmdletHelpAttributes;
|
4 | 9 | using PnP.PowerShell.Commands.Base.PipeBinds;
|
5 |
| -using Microsoft.SharePoint.Client.WorkflowServices; |
6 |
| -using System.Collections.Generic; |
7 | 10 |
|
8 | 11 | namespace PnP.PowerShell.Commands.Workflows
|
9 | 12 | {
|
10 | 13 | [Cmdlet(VerbsLifecycle.Start, "PnPWorkflowInstance")]
|
11 | 14 | [CmdletHelp("Starts a SharePoint 2010/2013 workflow instance on a list item",
|
12 | 15 | DetailedDescription = "Allows starting a SharePoint 2010/2013 workflow on a list item in a list",
|
| 16 | + OutputType = typeof(Guid), |
| 17 | + OutputTypeDescription = "Returns the GUID of the new workflow instance", |
13 | 18 | Category = CmdletHelpCategory.Workflows,
|
14 | 19 | SupportedPlatform = CmdletSupportedPlatform.All)]
|
15 | 20 | [CmdletExample(
|
@@ -56,11 +61,16 @@ protected override void ExecuteCmdlet()
|
56 | 61 |
|
57 | 62 | var inputParameters = new Dictionary<string, object>();
|
58 | 63 |
|
| 64 | + |
| 65 | + |
59 | 66 | WorkflowServicesManager workflowServicesManager = new WorkflowServicesManager(ClientContext, SelectedWeb);
|
60 | 67 | WorkflowInstanceService instanceService = workflowServicesManager.GetWorkflowInstanceService();
|
61 | 68 |
|
62 |
| - instanceService.StartWorkflowOnListItem(subscription, ListItemID, inputParameters); |
| 69 | + var instanceResult = instanceService.StartWorkflowOnListItem(subscription, ListItemID, inputParameters); |
| 70 | + |
63 | 71 | ClientContext.ExecuteQueryRetry();
|
| 72 | + |
| 73 | + WriteObject(instanceResult.Value); |
64 | 74 | }
|
65 | 75 | }
|
66 | 76 | }
|
0 commit comments