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.

Hi @pcainzos,
Kindly create a variable in Securestring datatype, and assign the below mentioned function to the variable, Find out the below mentioned screenshot for your reference.

= New System.Net.NetworkCredential(“”,stringvalue).securepassword.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.