Set-KFSessionStorageData

Syntax

Set-KFStorageData
  [-Key] <key>
  [-Data] <data>
  [-Binary[:$false]]
  [-AdditionalPassphase <string>]
  [-RelatedToWorkflow[:$true]] 
  [-RelatedToItem[:$true]]
  [-ThrowErrors[:$true]]

Support

>= kenaflow 1.0.0

Return

Nothing.

Description

This cmdlet can be used to write data to the kenaflow session storage.

Please read the article about Storage.

You can serialize objects using the PowerShell serializer when NOT specifying -Binary.

When using -Binary you must specify an byte array (System.Byte[]) with -Data.

If the requested object exist, it will be overwritten. An exception is not thrown.

By default -RelatedToWorkflow[:$true] and -RelatedToItem[:$true] are used - alone or in combination - to automatically add prefix(es) to your key.

Parameters

[-Key] <string>

The key that is used to read the serialized data.

[-Data] <data>

This is the data to be serialized and persisted.

[-Binary:[$false]]

If NOT specified the cmdlet will store the given object as serialized string. This requires that data for the given Key will NOT be read with -Binary with Get-KFStorageData. If specified the cmdlet requires an byte array (System.Byte[]) with parameter -Data. The binary data is written to the storage. - This requires that data for the given Key will be read with -Binary with Get-KFStorageData.

[-AdditionalPassPhrase <passphrase>]

Workflow developers can specify an additional encryption passphrase. This needs to be specified for retrieving the data with Get-KFStorageData!

[-RelatedToWorkflow[:$true]]

If you do not specify -RelatedToWorkflow:$false the workflow id will be used as prefix for your -Key. This is the default behaviour.

[-RelatedToItem[:$true]]

If you do not specify -RelatedToItem:$false the current item id will be used as prefix for your -Key. This is the default behaviour. The parameter is only available for SharePoint workflows! In SharePoint site workflows there is no item context.

[-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

This writes and reads serialized data to the session storage.

Set-KFSessionStorageData -Key "kenaflow" -Data @{"is" = "a workflow engine for SharePoint, Email and PowerShell"} -RelatedToItem:$false -RelatedToWorkflow:$false -AdditionalPassphare "cool"
Write-KFLog (Get-KFSessionStorageData -Key "kenaflow" -RelatedToItem:$false -RelatedToWorkflow:$false -AdditionalPassphare "cool")
Remove-KFSessionStorageData -Key "kenaflow" -RelatedToItem:$false -RelatedToWorkflow:$false

Discussion