加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

exchange webservices日程修改

发布时间:2020-12-17 00:03:06 所属栏目:安全 来源:网络整理
导读:说明:每一个字段的修改的要设置一遍, ? 将UnindexedFieldURIType.calendarViewType不知道可不可以只用一个对象;谁知到你分享一下 protected Hashtable UpdateItem(String userid,String Id,String changeKey) ??? { ??????? Exchange ec = new Exchange();

说明:每一个字段的修改的要设置一遍, ? 将UnindexedFieldURIType.calendarViewType不知道可不可以只用一个对象;谁知到你分享一下

protected Hashtable UpdateItem(String userid,String Id,String changeKey)

??? {
??????? Exchange ec = new Exchange();
??????? Hashtable ht = new Hashtable();
??????? assistant.initESB(userid,ec);
??????? // Create calendar items to contain each non-deletion update.
??????? CalendarItemType updateAddress = new CalendarItemType();
??????? CalendarItemType updatesubject = new CalendarItemType();
??????? CalendarItemType updateBody = new CalendarItemType();
??????? CalendarItemType updateStartTime = new CalendarItemType();
??????? CalendarItemType updateEndTime = new CalendarItemType();
??????? //CalendarItemType updatestatus = new CalendarItemType();
??????? //CalendarItemType updateImportance = new CalendarItemType();
??????? //CalendarItemType updateType = new CalendarItemType();

??????? updateAddress.Location = Address.Text;
??????? updatesubject.Subject = EventName.Text;
??????? updateBody.Body = new BodyType();
??????? updateBody.Body.BodyType1 = BodyTypeType.Text;
??????? updateBody.Body.Value = Content.Text;
??????? updateStartTime.Start = Convert.ToDateTime(StartTime.Text);
??????? updateStartTime.StartSpecified = true;
??????? updateEndTime.End = Convert.ToDateTime(EndTime.Text);
??????? updateEndTime.EndSpecified = true;
??????? //updateStartTime.Start = Convert.ToDateTime(StartTime.Text);
??????? //updateEndTime.End = Convert.ToDateTime(EndTime.Text);

??????? PathToUnindexedFieldType modAddress = new PathToUnindexedFieldType();
??????? PathToUnindexedFieldType modsubject = new PathToUnindexedFieldType();
??????? PathToUnindexedFieldType modBody = new PathToUnindexedFieldType();
??????? PathToUnindexedFieldType modStartTime = new PathToUnindexedFieldType();
??????? PathToUnindexedFieldType modEndTime = new PathToUnindexedFieldType();

??????? modAddress.FieldURI = UnindexedFieldURIType.calendarLocation; ??????? modsubject.FieldURI = UnindexedFieldURIType.itemSubject; ??????? modBody.FieldURI = UnindexedFieldURIType.itemBody; ??????? modStartTime.FieldURI = UnindexedFieldURIType.calendarStart; ??????? modEndTime.FieldURI = UnindexedFieldURIType.calendarEnd; ??????? SetItemFieldType setAddress = new SetItemFieldType(); ??????? SetItemFieldType setsubject = new SetItemFieldType(); ??????? SetItemFieldType setBody = new SetItemFieldType(); ??????? SetItemFieldType setStartTime = new SetItemFieldType(); ??????? SetItemFieldType setEndTime = new SetItemFieldType(); ??????? setAddress.Item = modAddress; ??????? setAddress.Item1 = updateAddress; ??????? setsubject.Item = modsubject; ??????? setsubject.Item1 = updatesubject; ??????? setBody.Item = modBody; ??????? setBody.Item1 = updateBody; ??????? setStartTime.Item = modStartTime; ??????? setStartTime.Item1 = updateStartTime; ??????? setEndTime.Item = modEndTime; ??????? setEndTime.Item1 = updateEndTime; ??????? // Create the identifier of the item to update. ??????? ItemIdType itemId = new ItemIdType(); ??????? itemId.Id = Id; ??????? itemId.ChangeKey = changeKey; ??????? // Create and populate the request. ??????? UpdateItemType request = new UpdateItemType(); ??????? request.ItemChanges = new ItemChangeType[1] { new ItemChangeType() }; ??????? request.ItemChanges[0].Item = itemId; ??????? request.ItemChanges[0].Updates = new ItemChangeDescriptionType[5]; ??????? request.ItemChanges[0].Updates[0] = setAddress; ??????? request.ItemChanges[0].Updates[1] = setsubject; ??????? request.ItemChanges[0].Updates[2] = setBody; ??????? request.ItemChanges[0].Updates[3] = setStartTime; ??????? request.ItemChanges[0].Updates[4] = setEndTime; ??????? request.ConflictResolution = ConflictResolutionType.AutoResolve; ??????? request.SendMeetingInvitationsOrCancellations = CalendarItemUpdateOperationType.SendToAllAndSaveCopy; ??????? request.SendMeetingInvitationsOrCancellationsSpecified = true; ??????? // Send the update request and receive the response. ??????? UpdateItemResponseType response = ec.exchangeServer.UpdateItem(request); ??????? ArrayOfResponseMessagesType aormt = response.ResponseMessages; ??????? ResponseMessageType[] rmta = aormt.Items; ??????? assistant.WriteFile("C:DEBUG.txt",rmta.Length.ToString()); ??????? if(rmta.Length>0) ??????? foreach (ResponseMessageType rmt in rmta) ??????? { ??????????? ItemInfoResponseMessageType respMsg = (rmt as ItemInfoResponseMessageType); ??????????? if (null != respMsg && null != respMsg.Items && null != respMsg.Items.Items) ??????????? foreach (ItemType item in respMsg.Items.Items) ??????????? { ??????????????????? ht.Add(item.ItemId.Id,item.ItemId.ChangeKey); ??????????????? assistant.WriteFile("C:DEBUG.txt",item.ItemId.Id + "n" + item.ItemId.ChangeKey); ??????????? } ??????? } ??????? return ht; ??? }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读