CS documentation on settings scope on VariableResource

Hey guys,

I am having issues tracking down documentation on settings the scope on a VariableResource… I found the powershell way

However getting

$newVariable.Scope.Add([Octopus.Platform.Model.ScopeField]::Environment, (New-Object Octopus.Platform.Model.ScopeValue "Environments-1")) 

to translate is not working well.

In my code I am

            [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)]
            public ScopeValue envScope { get; set; }

            VariableResource internalVar = new VariableResource(); 

                    if (internalVar == null)

                        internalVar.Name = Name;
                        internalVar.Value = Value;

                        if (envScope != null)
                        internalVar.Scope.Add([ScopeField]::Environment, envScope);

Any help would be great.

Oh… for someone else…
internalVar.Scope.Add(ScopeField.Environment, envScope)


Thanks for getting in touch and glad to hear you got it worked out.