Invoke-KFSharePointEventSimulation

Syntax

Invoke-KFSharePointEventSimulation 
  -ItemId <id> 
  [-ListTitle <list-title>]
  [-Web <web-url>]
  -SharePointEventType <event-type>
  -Data <hashtable> 
  [-LCID <language-code> (1031)]
  [-SimulatedUserName <username> (the current user)]
  [-ThrowErrors[:$true]]

Support

>= kenaflow 2.0.46

Return

An object of type kenaflow.EventDataSimResult:

public class EventDataSimResult
{
	public RemoteEventSource EventSource { get; set; }

	public object EventData { get; set; }

	public int OutputFormat { get; set; } = 0;
}

RemoteEventSource will have the value RER for this cmdlet.

Description

This cmdlet is used to simulate a SharePoint Remote Event to be able to debug workflow scripts in the event execution context.

Please read Debugging and Remote Event for details!

If the workflow has configured multiple webs and/or lists you can filter the web and/or list using [-ListTitle <list-title>] and/or [-Web <web-url>]. With or without the list and/or web filter at least the first list from the first web will be used as taken from _wfconfig.ps1. So please make sure you use the filter to test the event on the right list of the right web!

The cmdlet can only be used in a script block that is specified for parameter -EventData of cmdlet Invoke-Kenaflow.

The return object of this cmdlet is used by Invoke-Kenaflow to configure the runtime environment for kenaflow to execute the remote event.

Parameters

-ItemId <id>

The id of the SharePoint item the simulared remote event belongs to.

[-ListTitle <list-title>]

In case multiple lists you can filter the list by its title by using this parameter.

[-Web <web-url>]

In case multiple webs you can filter the web by its URL by using this parameter.

-SharePointEventType <event-type>

One of the values ItemAdded and ItemUpdated. It indicates the reason of the SharePoint remote event.

-Data <hashtable>

A SharePoint remove event (XML) structure contains the changed items fields. Here you specify the item field values to be passed to the workflow script as part of the $eventData object. Remember: we simulate a SharePoint remote event here. It's not real!

[-LCID <language-code> (1031)]

This is the language code that is part of the SharePoint remote event structure

[-SimulatedUserName <username> (the current user)]

This is used to simulate an authenticated request. It is passed to the script as part of the $eventData object. It is only used in case of 'Basic' authentication. See parameter -Authentication below. Default is the name of the current user.

[-ThrowErrors[:$true]]

This is a default parameter for all kenaflow cmdlets. If set to $true (default!) the engine will pass exception within the cmdlet to the script for further handling.

Example

Import-Module "C:\Program Files\kenaflow\kenaflow.runtime.dll";

Invoke-Kenaflow -EventData {
		Invoke-KFSharePointEventSimulation `
			-ItemId 1 `
			-EventType ItemUpdated `
			-SimulatedUserName "sharepoint\ingo" `
			-Data @{Title = "kenaflow is cool!"}
}

Discussion