Invoke-KFTemplate

Syntax

Invoke-KFTemplate
  [-Template] <string>
  [[-LocalConfig] <powershell-hashtable-object>]
  [-Item <sharepoint-list-item-object>]
  [-ThrowResolveErrors[:$false]]
  [-ThrowErrors[:$true]]

Support

>= kenaflow 1.0.0

Return

String.

Description

This Cmdlet can be used to create template strings with concrete contents which comes from the workflow Config List or the current or per item specified list item, or from a local configuration object that can optionally be transferred with -LocalConfig.

Please read the article "Templates" for details.

When using -ThrowResolveErrors:$false you can suppress exceptions resulting from not existing placeholders.

Parameters

`[-Template]

The template string.

`[[-LocalConfig] ]

The "local config" object that can be used to pass in data as Hashtable to replace placesholders of the format ((xxx)). This is optional.

`[-Item ]

In case of SharePoint workflow you can specify a list item here. In case of list and state machine workflow the currently processed item is used by default.

[-ThrowResolveErrors[:$false]]

Templates normally contain placeholders. Sometimes they are missing or there is an error while replacing the placeholder. In this case and without this parameter an exception is thrown and the script maybe stops. If you specify this parameter the missing or wrong interpreted placeholders are ignored. !This could lead to format or content errors!

[-ThrowErrors[:$true]]

Examples

$item = Get-PnpListItem -List "Custom List" -Id 1
Invoke-KFTemplate "<html><body><span>{{Author}}</span></body></html>" -Item $item -ThrowResolveErrors:$false

Discussion