How To Convert SecureString DataType To String DataType In UiPath

Almost all the processes fetch the credentials from Windows Credentials or Orchestrator.

But the Mail activities that the UiPath provide us accepts only the string data type for the password field.

Let’s see how to handle it…!!!

1.Fetch username and password from Windows Credentials.
2.Convert Password from SecureString to String Datatype.

Assuming we have credential saved with the name Robot_Credentials under Windows Credentials as shown below.

SecureString.PNG

Now let us see how to fetch it and convert it SecureString to string data type…



Step 1: Fetch username and password from Windows Credentials

Use Get Secure Credentials Activity

Target: Credentials Name (String)
Results: Status Code (Boolean)
Password: Fetched Password (SecureString)
Username: Fetched Username (String)

Uipath Get Secure Credentials.PNG


Step 2: Convert Password from SecureString to String Datatype

Use Assign Activity

password_String = new System.Net.NetworkCredential(string.Empty, Password).Password

Then we can pass the password_String variable to Mail Activity.

Uipath Get Secure Credentials 2.png

Hope it has helped you… 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: