Click here to Skip to main content
13,446,770 members (44,754 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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, -identity –AutomateProcessing AutoUpdate

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

Sample part of the code is here:

command.AddParameter("ResourceDelegates", ",");
command.AddParameter("-Identity", "");
command.AddParameter("-AutomateProcessing", "AutoUpdate");
Posted 18-Nov-10 8:40am
Updated 18-Nov-10 15:29pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The answer depends on the type and parameter passing options for the parameters of ResourceDelegates of the function Set-CalendarProcessing, in particular, if the parameter passed from the pipeline and processed correctly. If I can assume that this parameter can accept a list of values, the call will look like
Set-CalendarProcessing –ResourceDelegates @(, -identity –AutomateProcessing AutoUpdate

Another option may or may not be supported by this cmdlet, I just don't know. If this parameter supports a list and if it also has the attribute [Parameter(ValueFromPipeline = $true)], you could use it like this:, | Set-CalendarProcessing -identity –AutomateProcessing AutoUpdate

This is something I just don't know, you need to check it up. Did you write this function? This would be not so trivial. To support a list, the function has to use begin {<# ... #>} process {<# ... #>} end {<# ... #>} statement, or part of it; in this case, the body of process is executed as many times as the length of the list.

Espen Harlinn 30-Dec-12 8:18am
Sergey Alexandrovich Kryukov 30-Dec-12 11:48am
Thank you, Espen.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I haven't tried it, but putting quotes around the parameter with the comma in it may work.
Set-CalendarProcessing –ResourceDelegates "," -identity –AutomateProcessing AutoUpdate

It's a thought, but entirely untested.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04-2016 | 2.8.180318.2 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100