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.


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