Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#Powershell交换多值cmd参数传递_C#_Powershell_Exchange Server - Fatal编程技术网

c#Powershell交换多值cmd参数传递

c#Powershell交换多值cmd参数传递,c#,powershell,exchange-server,C#,Powershell,Exchange Server,我想在c#循环中运行以下内容,但我不知道如何用逗号传递参数的多值。实际的cmdlet如下所示,并且在exchange powershell中工作: 设置日历处理–ResourceDelegatesjonDoe@test.com,johnnydoe@test.com-身份testroom@test.com–自动处理自动更新 我知道我的代码连接可以工作,但它是“–ResourceDelegates”jonDoe@test.com,johnnydoe@test.com“我不知道如何通过,如下所示: 代

我想在c#循环中运行以下内容,但我不知道如何用逗号传递参数的多值。实际的cmdlet如下所示,并且在exchange powershell中工作:

设置日历处理–ResourceDelegatesjonDoe@test.com,johnnydoe@test.com-身份testroom@test.com–自动处理自动更新

我知道我的代码连接可以工作,但它是“–ResourceDelegates”jonDoe@test.com,johnnydoe@test.com“我不知道如何通过,如下所示:

代码的示例部分如下所示:

command.AddCommand("Set-CalendarProcessing");
command.AddParameter("-ResourceDelegates", "userA@test.com,userB@test.com");
command.AddParameter("-Identity", "test@test.com");
command.AddParameter("-AutomateProcessing", "AutoUpdate");
谢谢 史蒂夫

试试这个:

command.AddParameter("ResourceDelegates", new string[] { "a@b.c", "b@d.f" });

因此,如果需要参数的多个参数,请在参数名称前面加上连字符并传递数组。

将数组作为参数传递的最佳方法是什么,可以使用PassArray(数组)吗?我不明白。我的示例是传递字符串[]数组。