Я пытаюсь обновить некоторые встречи на бирже с помощью управляемого API EWS, но при вызове обновления постоянно получаю следующую ошибку:
Exception: System.Management.Automation.MethodInvocationException: Exception calling "Update" with "1" argument(s): "Set action is invalid for property." ---> Microsoft.Exchange.WebServices.Data.ServiceResponseException: Set action is invalid
for property.
at Microsoft.Exchange.WebServices.Data.ServiceResponse.InternalThrowIfNecessary()
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalUpdateItems(IEnumerable`1 items, FolderId savedItemsDestinationFolderId, ConflictResolutionMode conflictResolution, Nullable`1 messageDisposition, Nullable`1
sendInvitationsOrCancellationsMode, ServiceErrorHandling errorHandling)
at Microsoft.Exchange.WebServices.Data.ExchangeService.UpdateItem(Item item, FolderId savedItemsDestinationFolderId, ConflictResolutionMode conflictResolution, Nullable`1 messageDisposition, Nullable`1
sendInvitationsOrCancellationsMode)
at Microsoft.Exchange.WebServices.Data.Item.InternalUpdate(FolderId parentFolderId, ConflictResolutionMode conflictResolutionMode, Nullable`1 messageDisposition, Nullable`1 sendInvitationsOrCancellationsMode)
at Microsoft.Exchange.WebServices.Data.Item.Update(ConflictResolutionMode conflictResolutionMode)
at CallSite.Target(Closure , CallSite , Object , Object )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Эта ошибка не очень описательная, поэтому я действительно не знаю, с чего начать. Все, что я пытаюсь сделать, это изменить время начала и окончания нескольких встреч. Соответствующий код приведен ниже:
$Items = $service.FindAppointments($Calendar.Id,$CalendarView)
foreach($Item in $Items.Items) {
$Item.Load()
$Item.StartTimeZone = [System.TimeZoneInfo]::Local
if ($Item.Subject -eq '01Mar13 15:00 RECD-MTWRF to 30Sep13 17:00'){
if ($Item.Start.ToString("dddd") -eq 'Friday'){
$Item.Start = $Item.Start.AddHours(1)
}
}
elseif ($Item.Subject -eq '05Mar13 10:00 RECD-TR to 26Sep13 12:00'){
if ($Item.Start.ToString("dddd") -eq 'Tuesday'){
$Item.Start = $Item.Start.AddHours(1)
$Item.End = $Item.End.AddHours(1)
}
}
try {
$Item.Update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AlwaysOverwrite)
}
catch {
$error[0] | fl -force
}
}
Я пытался изменить режим разрешения конфликтов, а также должен был установить свойство Item.StartTimeZone из-за предыдущей ошибки. Любые идеи о том, что может быть не так? Заранее спасибо.
$CalendarView
? - person SliverNinja - MSFT   schedule 09.08.2013