Storing output of GetCredentials in a string array

there are two outputs for “GetCredentials” . can we store these two outputs as a part of a string array .
like 0th position and 1st position

1 Like

Get credentials activity gives us username as string variable and password as secure string variable

and if we want to store them in a array like this
arr_credentials = {usernamevariable, new system.Net.NetworkCredential(string.Empty, passwordvariable).Password}

where arr_credentials is a variable of type array of string
hope this would help you @karges
kindly try this and let know for any queries or clarification


ok here is the thing. i have situation where i need to categorize assets which are credentials and non credential assets. but all the asset values should be in the same dictionary . so i thought i could store “getcredentials” output in a string array pass that as one of the values in the dictionary. u know how to do this ?

yah thats possible
create a dictionary named dict_variable of type system.collections.generic.dictionarry(of string, string) with default value as New Dictionary(of string, string) defined in the variable panel
–now use GET ASSETS to the non credential values and GET CREDENTIALS to get the credential value
–for example if the asset_1 is created in orchestrator and we have used a GET ASSET activity to get that value with a variable named str_asset_1 a string variable
–now use a assign activity like this
dict_variable(“asset_1”) = str_asset_1
this will create a key value pair in the dictionary variable
where asset_1 is the key aand str_asset_1 is the value of that key
–similarly for GET CREDENTIALS
dict_variable(“usernamevariable”) = usernamevariable.ToString
dict_variable(“passwordvariable”) = passwordvariable.ToString

now all will come under one dictionary variable
Hope this would help you
Cheers @karges

in the below screen shot in the output section i had put the array[0] , array[1] . some error came like end of expresion expected. but when i gave separate assign activity. it worked as u said.

we wont be able to mention this in output panel along the properties as the array will be of same type of datatype but the username and password are of different datatypes
so thats why

Cheers @karges