Edit

VariableUtility.ExpandVariables Method

Definition

Overloads

ExpandVariables(JToken, IDictionary<String,String>)

Replaces variables by recursively cloning tokens in a JObject or JArray by Walks tokens and uses ExpandVariables(string, vars) to resolve all string tokens

ExpandVariables(JToken, IList<IDictionary<String,String>>)

Replaces multiple variable sets by recursively cloning tokens in a JObject or JArray. Walks tokens and uses ExpandVariables(string, vars) for each set of variables on all string tokens

ExpandVariables(String, IDictionary<String,String>)

An overload method for ExpandVariables Expand variables in the input provided using the dictionary and the machine's environment variables

ExpandVariables(JToken, VariablesDictionary, Boolean)
ExpandVariables(JToken, IDictionary<String,String>, Boolean)

Replaces variables by recursively cloning tokens in a JObject or JArray by Walks tokens and uses ExpandVariables(string, vars) to resolve all string tokens

ExpandVariables(String, VariablesDictionary, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

ExpandVariables(String, IDictionary<String,VariableValue>, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

ExpandVariables(String, IDictionary<String,String>, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

ExpandVariables(String, VariablesDictionary, Boolean, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

ExpandVariables(String, IDictionary<String,VariableValue>, Boolean, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

ExpandVariables(JToken, IDictionary<String,String>)

Replaces variables by recursively cloning tokens in a JObject or JArray by Walks tokens and uses ExpandVariables(string, vars) to resolve all string tokens

public static Newtonsoft.Json.Linq.JToken ExpandVariables(Newtonsoft.Json.Linq.JToken token, System.Collections.Generic.IDictionary<string,string> replacementDictionary);
static member ExpandVariables : Newtonsoft.Json.Linq.JToken * System.Collections.Generic.IDictionary<string, string> -> Newtonsoft.Json.Linq.JToken
Public Shared Function ExpandVariables (token As JToken, replacementDictionary As IDictionary(Of String, String)) As JToken

Parameters

token
Newtonsoft.Json.Linq.JToken

root token must be a JObject or JArray

replacementDictionary
IDictionary<String,String>

key value variables to replace in the $(xxx) format

Returns

Newtonsoft.Json.Linq.JToken

root token of cloned tree

Applies to

ExpandVariables(JToken, IList<IDictionary<String,String>>)

Replaces multiple variable sets by recursively cloning tokens in a JObject or JArray. Walks tokens and uses ExpandVariables(string, vars) for each set of variables on all string tokens

public static Newtonsoft.Json.Linq.JToken ExpandVariables(Newtonsoft.Json.Linq.JToken token, System.Collections.Generic.IList<System.Collections.Generic.IDictionary<string,string>> replacementsList);
static member ExpandVariables : Newtonsoft.Json.Linq.JToken * System.Collections.Generic.IList<System.Collections.Generic.IDictionary<string, string>> -> Newtonsoft.Json.Linq.JToken
Public Shared Function ExpandVariables (token As JToken, replacementsList As IList(Of IDictionary(Of String, String))) As JToken

Parameters

token
Newtonsoft.Json.Linq.JToken

root token must be a JObject or JArray

replacementsList
IList<IDictionary<String,String>>

list of replacement key value pairs in the $(xxx) format

Returns

Newtonsoft.Json.Linq.JToken

root token of cloned tree

Applies to

ExpandVariables(String, IDictionary<String,String>)

An overload method for ExpandVariables Expand variables in the input provided using the dictionary and the machine's environment variables

public static string ExpandVariables(string input, System.Collections.Generic.IDictionary<string,string> additionalVariableReplacements);
static member ExpandVariables : string * System.Collections.Generic.IDictionary<string, string> -> string
Public Shared Function ExpandVariables (input As String, additionalVariableReplacements As IDictionary(Of String, String)) As String

Parameters

input
String
additionalVariableReplacements
IDictionary<String,String>

Returns

Applies to

ExpandVariables(JToken, VariablesDictionary, Boolean)

public static Newtonsoft.Json.Linq.JToken ExpandVariables(Newtonsoft.Json.Linq.JToken token, Microsoft.TeamFoundation.DistributedTask.Pipelines.VariablesDictionary additionalVariableReplacements, bool useMachineVariables);
static member ExpandVariables : Newtonsoft.Json.Linq.JToken * Microsoft.TeamFoundation.DistributedTask.Pipelines.VariablesDictionary * bool -> Newtonsoft.Json.Linq.JToken
Public Shared Function ExpandVariables (token As JToken, additionalVariableReplacements As VariablesDictionary, useMachineVariables As Boolean) As JToken

Parameters

token
Newtonsoft.Json.Linq.JToken
additionalVariableReplacements
VariablesDictionary
useMachineVariables
Boolean

Returns

Newtonsoft.Json.Linq.JToken

Applies to

ExpandVariables(JToken, IDictionary<String,String>, Boolean)

Replaces variables by recursively cloning tokens in a JObject or JArray by Walks tokens and uses ExpandVariables(string, vars) to resolve all string tokens

public static Newtonsoft.Json.Linq.JToken ExpandVariables(Newtonsoft.Json.Linq.JToken token, System.Collections.Generic.IDictionary<string,string> replacementDictionary, bool useMachineVariables = true);
static member ExpandVariables : Newtonsoft.Json.Linq.JToken * System.Collections.Generic.IDictionary<string, string> * bool -> Newtonsoft.Json.Linq.JToken
Public Shared Function ExpandVariables (token As JToken, replacementDictionary As IDictionary(Of String, String), Optional useMachineVariables As Boolean = true) As JToken

Parameters

token
Newtonsoft.Json.Linq.JToken

root token must be a JObject or JArray

replacementDictionary
IDictionary<String,String>

key value variables to replace in the $(xxx) format

useMachineVariables
Boolean

Returns

Newtonsoft.Json.Linq.JToken

root token of cloned tree

Applies to

ExpandVariables(String, VariablesDictionary, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

public static string ExpandVariables(string input, Microsoft.TeamFoundation.DistributedTask.Pipelines.VariablesDictionary additionalVariableReplacements, bool useMachineVariables);
static member ExpandVariables : string * Microsoft.TeamFoundation.DistributedTask.Pipelines.VariablesDictionary * bool -> string
Public Shared Function ExpandVariables (input As String, additionalVariableReplacements As VariablesDictionary, useMachineVariables As Boolean) As String

Parameters

input
String

The value which should be analyzed for environment variables and updated accordingly

additionalVariableReplacements
VariablesDictionary
useMachineVariables
Boolean

Use the machine's environment variables when it is true

Returns

A new value with all variables expanded to their current value based on the environment

Applies to

ExpandVariables(String, IDictionary<String,VariableValue>, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

public static string ExpandVariables(string input, System.Collections.Generic.IDictionary<string,Microsoft.TeamFoundation.DistributedTask.WebApi.VariableValue> additionalVariableReplacements, bool useMachineVariables);
static member ExpandVariables : string * System.Collections.Generic.IDictionary<string, Microsoft.TeamFoundation.DistributedTask.WebApi.VariableValue> * bool -> string
Public Shared Function ExpandVariables (input As String, additionalVariableReplacements As IDictionary(Of String, VariableValue), useMachineVariables As Boolean) As String

Parameters

input
String

The value which should be analyzed for environment variables and updated accordingly

additionalVariableReplacements
IDictionary<String,VariableValue>
useMachineVariables
Boolean

Use the machine's environment variables when it is true

Returns

A new value with all variables expanded to their current value based on the environment

Applies to

ExpandVariables(String, IDictionary<String,String>, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

public static string ExpandVariables(string input, System.Collections.Generic.IDictionary<string,string> additionalVariableReplacements, bool useMachineVariables);
static member ExpandVariables : string * System.Collections.Generic.IDictionary<string, string> * bool -> string
Public Shared Function ExpandVariables (input As String, additionalVariableReplacements As IDictionary(Of String, String), useMachineVariables As Boolean) As String

Parameters

input
String

The value which should be analyzed for environment variables and updated accordingly

additionalVariableReplacements
IDictionary<String,String>
useMachineVariables
Boolean

Use the machine's environment variables when it is true

Returns

A new value with all variables expanded to their current value based on the environment

Applies to

ExpandVariables(String, VariablesDictionary, Boolean, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

public static string ExpandVariables(string input, Microsoft.TeamFoundation.DistributedTask.Pipelines.VariablesDictionary additionalVariableReplacements, bool useMachineVariables, bool maskSecrets = false);
static member ExpandVariables : string * Microsoft.TeamFoundation.DistributedTask.Pipelines.VariablesDictionary * bool * bool -> string
Public Shared Function ExpandVariables (input As String, additionalVariableReplacements As VariablesDictionary, useMachineVariables As Boolean, Optional maskSecrets As Boolean = false) As String

Parameters

input
String

The value which should be analyzed for environment variables and updated accordingly

additionalVariableReplacements
VariablesDictionary
useMachineVariables
Boolean

Use the machine's environment variables when it is true

maskSecrets
Boolean

Returns

A new value with all variables expanded to their current value based on the environment

Applies to

ExpandVariables(String, IDictionary<String,VariableValue>, Boolean, Boolean)

Replaces variable references of the form $(variable) with the corresponding replacement value. Values populated into the environment directly are used first. If no value is found in the automation environment then the machine environment variables will be used as a fall back.

public static string ExpandVariables(string input, System.Collections.Generic.IDictionary<string,Microsoft.TeamFoundation.DistributedTask.WebApi.VariableValue> additionalVariableReplacements, bool useMachineVariables, bool maskSecrets = false);
static member ExpandVariables : string * System.Collections.Generic.IDictionary<string, Microsoft.TeamFoundation.DistributedTask.WebApi.VariableValue> * bool * bool -> string
Public Shared Function ExpandVariables (input As String, additionalVariableReplacements As IDictionary(Of String, VariableValue), useMachineVariables As Boolean, Optional maskSecrets As Boolean = false) As String

Parameters

input
String

The value which should be analyzed for environment variables and updated accordingly

additionalVariableReplacements
IDictionary<String,VariableValue>
useMachineVariables
Boolean

Use the machine's environment variables when it is true

maskSecrets
Boolean

Returns

A new value with all variables expanded to their current value based on the environment

Applies to