How yo use SecureString


I am trying to use an activity that has a parametrer that typed like SecureString.
I need to assign some string to that parameter, but I can not do it.
I am having the exception “A string vlue can not be converted to SecureString”… or somthing…
Can you please help me?
Thank you

1 Like

Hi @pcainzos

You can convert a string to secure string with this

String plainStr = new System.Net.NetworkCredential(string.Empty, secureStr).Password

see this



Thank you for your help!

This line, System.Net.NetworkCredential(string.Empty, secureStr).Password, returns a String

However, thank to you, I find:

System.Net.NetworkCredential(string.Empty, secureStr).SecurePassword

And it works just fine!
Thank you

1 Like

Hi @pcainzos
There are activities like Get Credential and AddCredentials to deal with credentials.

and if you’re using Assets in Orchestrator, so in that case you can use “Get credential” activity

Very bad and unproficient (!) answer as the question is exactly opposite - How to assign value for parametrer of SecureString type inside UIPath workflow with pre-defined string value.

It seems it is impossible to do this with current set of standard UIpath Activities, as all of them use only string types for input.
I propose UiPath should increase functionality of Assign activity with possibility to assign some string to a parameter of SecureString type.