在日历上更新多个属性 [英] Updating more than one property on a Calendar
问题描述
是否可以通过一次调用更新CalendarItemType上的多个属性?
这是我要走的路径:
{
UpdateItemType updateItemRequest = new UpdateItemType ();
updateItemRequest.ConflictResolution = ConflictResolutionType .AutoResolve;
updateItemRequest.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType .SendOnlyToAll;
Is it possible to update more than one property on a CalendarItemType with a single call?
This was the path I was going down:
public ItemIdType UpdateCalendarItem(ExchangeServiceBinding binding, List<UnindexedFieldURIType> updatedFields, CalendarItemType calendarWithUpdates, ItemIdType itemToUpdate)
{
UpdateItemType updateItemRequest = new UpdateItemType();
updateItemRequest.ConflictResolution = ConflictResolutionType.AutoResolve;
updateItemRequest.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendOnlyToAll;
updateItemRequest.SendMeetingInvitationsOrCancellationsSpecified = true ;
updateItemRequest.ItemChanges = new ItemChangeType [updatedFields.Count];
updateItemRequest.SendMeetingInvitationsOrCancellationsSpecified = true;
updateItemRequest.ItemChanges = new ItemChangeType[updatedFields.Count];
int i = 0;
foreach ( UnindexedFieldURIType uiURIType in updatedFields)
{
SetItemFieldType setItemField = new SetItemFieldType ( );
setItemField.Item = new PathToUnindexedFieldType ();
(setItemField.Item as PathToUnindexedFieldType )。FieldURI = uiURIType;
ItemChangeType itemChange = new ItemChangeType ();
itemChange.Item = itemToUpdate; < br> itemChange.Updates = new ItemChangeDescriptionType [1];
setItemField.Item1 = calendarWithUpdates;
itemChange。 Updates [0] = setItemField;
updateItemRequest.ItemChanges [i] = itemCha nge;
i ++;
}但是,错误出错了ErrorIncorrectUpdatePropertyCount。
任何指针?
int i = 0;
foreach (UnindexedFieldURIType uiURIType in updatedFields)
{
SetItemFieldType setItemField = new SetItemFieldType();
setItemField.Item = new PathToUnindexedFieldType();
(setItemField.Item as PathToUnindexedFieldType).FieldURI = uiURIType;
ItemChangeType itemChange = new ItemChangeType();
itemChange.Item = itemToUpdate;
itemChange.Updates = new ItemChangeDescriptionType[1];
setItemField.Item1 = calendarWithUpdates;
itemChange.Updates[0] = setItemField;
updateItemRequest.ItemChanges[i] = itemChange;
i++;
}
But that errors out with the ErrorIncorrectUpdatePropertyCount.
Any pointers?
谢谢。
Thanks.
推荐答案
setItemField.Item1 = calendarWithUpdates;
日历项目只能设置1个属性,但是你的属性设置超过1会导致 ErrorIncorrectUpdatePropertyCount。您需要创建一个新的CalendarItemType,并且一次只能设置1个值。
这篇关于在日历上更新多个属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!