Get-KFSessionStorageData

Syntax

Get-KFSessionStorageData
  [-Key] <key>
  [-RelatedToWorkflow[:$true]]
  [-RelatedToItem[:$true]]
  [-Binary:[$false]]
  [-AdditionalPassPhrase <passphrase>]
  [-ThrowErrors[:$true]]

Support

>= kenaflow 3.0.13

Return

Object or System.Byte[]

Description

This cmdlet retrieves the data persisted with Set-KFSessionStorageData.

The data is read from the session storage of kenaflow. Please read the article about Storage.

When writing data with Set-KFSessionStorageData the workflow developer decides whether the data is encrypted or not. When reading the data with Get-KFSessionStorageData kenaflow reads the from the storage and decrypts it if needed.

If the data was written using an AdditionalPassphrase this must be specified for proper decryption.

If the requested object does not exist, then $null is returned. An exception is not thrown.

-RelatedToWorkflow[:$true] and -RelatedToItem[:$true] can be 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.

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

[-Binary:[$false]]

If NOT specified the cmdlet will return a deserialized object. This requires that data for the given Key was written NOT with -Binary. If specified the cmdlet will return an byte array (System.Byte[]). This requires that data for the given Key was written with -Binary.

[-AdditionalPassPhrase <passphrase>]

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

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