В настоящее время я создаю приложение для автоматизации некоторых операций Exchange 2010 с веб-сайта ASP.NET MVC.
Прямо сейчас я столкнулся с ParameterBindingException при попытке вызвать команду New-AddressList.
Я пытаюсь создать следующий вызов (который работает):
new-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"
Я делаю это следующим образом:
var NewAddressList = new Command("New-AddressList");
NewAddressList.Parameters.Add("Name", "7 AL");
NewAddressList.Parameters.Add("RecipientContainer", "myDomain.local/Customers/7");
NewAddressList.Parameters.Add("IncludedRecipients", "AllRecipients");
NewAddressList.Parameters.Add("Container", @"\");
NewAddressList.Parameters.Add("DisplayName", "7 AL");
CommandsList.Add(NewAddressList);
Этот список команд предоставляетсяконвейер, который я вызываю, выдавая следующую ошибку:
New-AddressList: входной объект не может быть привязан ни к каким параметрам для команды, потому что команда не принимает входные данные конвейера или ввод, а ее свойства делаютне соответствует ни одному из параметров, принимающих конвейерный ввод.
- CategoryInfo: InvalidArgument: (7: PSObject) [New-AddressList], ParameterBindingException
- FullyQualifiedErrorId: InputObjectNotBound, Microsoft.Exchange.Management.SystemConfigurationTasks.NewAddressList
Любые подсказки, что может вызвать это?
Вывод с помощью команды трассировки дает:
PS C:\Users\ext_kefu> Trace-Command -Name parameterbinding -Expression {New-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"} -PSHost
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [New-AddressList]
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to parameter [Name]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to param [Name] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [myDomain.local/Customers/7] to parameter [RecipientContainer]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter]
DEBUG: ParameterBinding Information: 0 : Trying to convert argument value from System.String to Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter
DEBUG: ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [myDomain.local/Customers/7]
DEBUG: ParameterBinding Information: 0 : BIND arg [myDomain.local/Customers/7] to param [RecipientContainer] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [AllRecipients] to parameter [IncludedRecipients]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Nullable[Microsoft.Exchange.Data.Directory.Recipient.WellKnownRecipientType]]
DEBUG: ParameterBinding Information: 0 : Trying to convert argument value from System.String to System.Nullable[Microsoft.Exchange.Data.Directory.Recipient.WellKnownRecipientType]
DEBUG: ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [AllRecipients]
DEBUG: ParameterBinding Information: 0 : BIND arg [AllRecipients] to param [IncludedRecipients] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [\] to parameter [Container]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [Microsoft.Exchange.Configuration.Tasks.AddressListIdParameter]
DEBUG: ParameterBinding Information: 0 : Trying to convert argument value from System.String to Microsoft.Exchange.Configuration.Tasks.AddressListIdParameter
DEBUG: ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [\]
DEBUG: ParameterBinding Information: 0 : BIND arg [\] to param [Container] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to parameter [DisplayName]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to param [DisplayName] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [New-AddressList]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [New-AddressList]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
Name DisplayName RecipientFilter
---- ----------- ---------------
7 AL 7 AL Alias -ne $null