0

I want to run the following in a c# loop but I just don't know how to pass a multi value for a parameter with a comma. The actual cmdlet would be below and does work in exchange powershell:

Set-CalendarProcessing –ResourceDelegates [email protected],[email protected] -identity [email protected] –AutomateProcessing AutoUpdate

I know my code connection works but it's the "–ResourceDelegates [email protected],[email protected]" I don't know how to pass, shown below:

Sample part of the code is here:

command.AddCommand("Set-CalendarProcessing");
command.AddParameter("-ResourceDelegates", "[email protected],[email protected]");
command.AddParameter("-Identity", "[email protected]");
command.AddParameter("-AutomateProcessing", "AutoUpdate");

Thanks Steve

1 Answer 1

2

Try this instead:

command.AddParameter("ResourceDelegates", new string[] { "[email protected]", "[email protected]" });

Ergo, do not prefix the parameter name with a hyphen and pass an array if you need multiple arguments for the parameter.

Sign up to request clarification or add additional context in comments.

2 Comments

what's the best way to pass an array through as an argument, can you do PassArray(array)?
I don't understand. My example is passing a string[] array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.