2015-10-05 45 views
0

我想删除前一段时间创建的日历事件。当我尝试删除由我创建的日历事件时,Exchange Web服务(EWS)说“接受拒绝”

案例1:

  • 我打电话EWS使用域用户[email protected]的凭据在一些房间提供房间的电子邮件地址创建一个日历事件,然后我得到了事件的ID
  • 然后,我通过调用EWS,并提供身份证和ChangeKey删除的事件,所有的罚款 - 会议被删除

案例2

  • 我创建事件相同的方式就像在案例1
  • 我得到日历事件的列表这个房间。现在事件的ID具有HexEntryId格式。所以我用ConvertId方法给它EwsLegacyId由DeleteItem方法所需
  • 我称之为DeleteItem方法与ConvertId方法提供事件的ID,但没有ChangeKey(我没有它)
  • DeleteItemResponse说转换“访问被拒绝检查凭据并重试。“

为什么我可以删除案例1中的事件而我不能案例2中?我应该怎么做才能删除事件(如情况2)?


下面是请求的详细信息和响应:

Case 1: 

I call EWS to create a calendar event using credentials of domain user [email protected] in some room by providing email address of the room – a meeting like this: 
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"> 
     <soap:Body> 
      <CreateItem xmlns=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" SendMeetingInvitations=\"SendToAllAndSaveCopy\" > 
        <SavedItemFolderId> 
         <t:DistinguishedFolderId Id=\"calendar\"/> 
        </SavedItemFolderId> 
        <Items> 
         <t:CalendarItem xmlns=\"http://schemas.microsoft.com/exchange/services/2006/types\"> 
           <Subject>Instant Meeting</Subject> 
           <Body BodyType=\"Text\">Generated By mycompany Room Booker</Body> 
           <ReminderIsSet>false</ReminderIsSet> 
           <ReminderMinutesBeforeStart>60</ReminderMinutesBeforeStart> 
           <Start>2015-10-01T10:26:02.000Z</Start> 
           <End>2015-10-01T10:41:02.000Z</End> 
           <IsAllDayEvent>false</IsAllDayEvent> 
           <LegacyFreeBusyStatus>Busy</LegacyFreeBusyStatus> 
           <RequiredAttendees> 
            <Attendee> 
              <Mailbox> 
               <EmailAddress>[email protected]</EmailAddress> 
              </Mailbox> 
            </Attendee> 
           </RequiredAttendees> 
         </t:CalendarItem> 
        </Items> 
      </CreateItem> 
     </soap:Body> 
</soap:Envelope> 

then meeting is accepted and I get ItemID like: 

state.ChangeKey: "DwAAABYAAADw3LMNr7pMRqtEFFAbr0MeAAAAhxz0"   
state.Id: "AAASAGJyb29tQGluZnVzaW9uLmNvbQBGAAAAAAB5mlhabHe9S4yVHCob9IbcBwDw3LMNr7pMRqtEFFAbr0MeAAAAOdnlAADw3LMNr7pMRqtEFFAbr0MeAAAAhrdWAAA="     

Then I delete the event by calling EWS and providing Id and ChangeKey: 

<?xml version=\"1.0\" encoding=\"utf-8\"?> 
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> 
     <soap:Header/> 
     <soap:Body> 
      <m:DeleteItem DeleteType=\"MoveToDeletedItems\" SendMeetingCancellations=\"SendToAllAndSaveCopy\"> 
        <m:ItemIds> 
         <t:ItemId Id=\"AAASAGJyb29tQGluZnVzaW9uLmNvbQBGAAAAAAB5mlhabHe9S4yVHCob9IbcBwDw3LMNr7pMRqtEFFAbr0MeAAAAOdnlAADw3LMNr7pMRqtEFFAbr0MeAAAAhrdWAAA=\" ChangeKey=\"DwAAABYAAADw3LMNr7pMRqtEFFAbr0MeAAAAhxz0\"/> 
        </m:ItemIds> 
      </m:DeleteItem> 
     </soap:Body> 
</soap:Envelope> 

and all is fine. The event is deleted. 

Case 2: 

But when I create event the same way and get response like this: 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
    <h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="235" MinorBuildNumber="1" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> 
    </s:Header> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <m:CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
     <m:ResponseMessages> 
     <m:CreateItemResponseMessage ResponseClass="Success"> 
      <m:ResponseCode>NoError</m:ResponseCode> 
      <m:Items> 
      <t:CalendarItem> 
       <t:ItemId Id="AAASAGJyb29tQGluZnVzaW9uLmNvbQBGAAAAAAB5mlhabHe9S4yVHCob9IbcBwDw3LMNr7pMRqtEFFAbr0MeAAAAOdnlAADw3LMNr7pMRqtEFFAbr0MeAAAAhrdYAAA=" ChangeKey="DwAAABYAAADw3LMNr7pMRqtEFFAbr0MeAAAAhx08" /> 
      </t:CalendarItem> 
      </m:Items> 
     </m:CreateItemResponseMessage> 
     </m:ResponseMessages> 
    </m:CreateItemResponse> 
    </s:Body> 
</s:Envelope> 

and when I list calendar events for this room like below: 
<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
     <soap:Header> 
      <t:RequestServerVersion Version="Exchange2010_SP2" /> 
     </soap:Header> 
     <soap:Body> 
      <GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> 
        <TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
         <Bias>300</Bias> 
         <StandardTime> 
           <Bias>0</Bias> 
           <Time>02:0:00</Time> 
           <DayOrder>1</DayOrder> 
           <Month>10</Month> 
           <DayOfWeek>Sunday</DayOfWeek> 
         </StandardTime> 
         <DaylightTime> 
           <Bias>-60</Bias> 
           <Time>02:00:00</Time> 
           <DayOrder>2</DayOrder> 
           <Month>3</Month> 
           <DayOfWeek>Sunday</DayOfWeek> 
         </DaylightTime> 
        </TimeZone> 
        <MailboxDataArray> 
         <MailboxData xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
           <Email> 
            <Name/> 
            <Address>[email protected]</Address> 
            <RoutingType>SMTP</RoutingType> 
           </Email> 
           <AttendeeType>Room</AttendeeType> 
           <ExcludeConflicts>false</ExcludeConflicts> 
         </MailboxData> 
        </MailboxDataArray> 
        <FreeBusyViewOptions xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
         <TimeWindow> 
           <StartTime>2015-10-01T06:34:09</StartTime> 
           <EndTime>2015-10-01T23:59:59</EndTime> 
         </TimeWindow> 
         <MergedFreeBusyIntervalInMinutes>60</MergedFreeBusyIntervalInMinutes> 
         <RequestedView>Detailed</RequestedView> 
        </FreeBusyViewOptions> 
      </GetUserAvailabilityRequest> 
     </soap:Body> 
</soap:Envelope> 

I get response with IDs in some other format (HexEntryId): 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
<s:Header> 
    <h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="235" MinorBuildNumber="1" Version="Exchange2010_SP2" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> 
</s:Header> 
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <GetUserAvailabilityResponse xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> 
    <FreeBusyResponseArray> 
     <FreeBusyResponse> 
     <ResponseMessage ResponseClass="Success"> 
      <ResponseCode>NoError</ResponseCode> 
     </ResponseMessage> 
     <FreeBusyView> 
      <FreeBusyViewType xmlns="http://schemas.microsoft.com/exchange/services/2006/types">Detailed</FreeBusyViewType> 
      <CalendarEventArray xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
      <CalendarEvent> 
       <StartTime>2015-10-01T06:36:51</StartTime> 
       <EndTime>2015-10-01T06:51:51</EndTime> 
       <BusyType>Busy</BusyType> 
         <CalendarEventDetails> 
         <ID>00000000B23AEBAC6379B34DBBBA0B525D2BBFD70700C26EC63E0E9E2A49B110258061BF491D000000FDECCA0000C26EC63E0E9E2A49B110258061BF491D0000D9385B8C0000</ID> 
         <Subject>Boardroom Tablet </Subject> 
         <IsMeeting>true</IsMeeting> 
         <IsRecurring>false</IsRecurring> 
         <IsException>false</IsException> 
         <IsReminderSet>false</IsReminderSet> 
         <IsPrivate>false</IsPrivate> 
         </CalendarEventDetails> 
      </CalendarEvent> 
      </CalendarEventArray> 
      <WorkingHours xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
      <TimeZone> 
       <Bias>300</Bias> 
       <StandardTime> 
       <Bias>0</Bias> 
       <Time>02:00:00</Time> 
       <DayOrder>1</DayOrder> 
       <Month>11</Month> 
       <DayOfWeek>Sunday</DayOfWeek> 
       </StandardTime> 
       <DaylightTime> 
       <Bias>-60</Bias> 
       <Time>02:00:00</Time> 
       <DayOrder>2</DayOrder> 
       <Month>3</Month> 
       <DayOfWeek>Sunday</DayOfWeek> 
       </DaylightTime> 
      </TimeZone> 
      <WorkingPeriodArray> 
       <WorkingPeriod> 
       <DayOfWeek>Monday Tuesday Wednesday Thursday Friday</DayOfWeek> 
       <StartTimeInMinutes>480</StartTimeInMinutes> 
       <EndTimeInMinutes>1140</EndTimeInMinutes> 
       </WorkingPeriod> 
      </WorkingPeriodArray> 
      </WorkingHours> 
     </FreeBusyView> 
     </FreeBusyResponse> 
    </FreeBusyResponseArray> 
    </GetUserAvailabilityResponse> 
</s:Body> 
</s:Envelope> 

To be able to call DeleteItem I need this Id in EwsLegacyId format instead of HexEntryId format, so I call ConvertId method: 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
     <soap:Header> 
      <t:RequestServerVersion Version="Exchange2010" /> 
     </soap:Header> 
     <soap:Body> 
      <m:ConvertId DestinationFormat="EwsLegacyId"> 
        <m:SourceIds> 
         <t:AlternateId Format="HexEntryId" Id="00000000B23AEBAC6379B34DBBBA0B525D2BBFD70700C26EC63E0E9E2A49B110258061BF491D000000FDECCA0000C26EC63E0E9E2A49B110258061BF491D0000D9385B940000" Mailbox="[email protected]" /> 
        </m:SourceIds> 
      </m:ConvertId> 
     </soap:Body> 
</soap:Envelope> 

and I get 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
     <s:Header> 
      <h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="235" MinorBuildNumber="1" Version="Exchange2010_SP2" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> 
     </s:Header> 
     <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
      <m:ConvertIdResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
        <m:ResponseMessages> 
         <m:ConvertIdResponseMessage ResponseClass="Success"> 
           <m:ResponseCode>NoError</m:ResponseCode> 
           <m:AlternateId xsi:type="t:AlternateIdType" Format="EwsLegacyId" Id="AAAbAEJSRE5ZQy1Db2xsYWIyQGluZnVzaW9uLmNvbQBGAAAAAACyOuusY3mzTbu6C1JdK7/XBwDCbsY+Dp4qSbEQJYBhv0kdAAAA/ezKAADCbsY+Dp4qSbEQJYBhv0kdAADZOFuUAAA=" Mailbox="[email protected]" /> 
         </m:ConvertIdResponseMessage> 
        </m:ResponseMessages> 
      </m:ConvertIdResponse> 
     </s:Body> 
</s:Envelope> 

And when I try to call DeleteItem on this Id like this: 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
     <soap:Header/> 
     <soap:Body> 
      <m:DeleteItem DeleteType="MoveToDeletedItems" SendMeetingCancellations="SendToAllAndSaveCopy"> 
        <m:ItemIds> 
         <t:ItemId Id="AAAbAEJSRE5ZQy1Db2xsYWIyQGluZnVzaW9uLmNvbQBGAAAAAACyOuusY3mzTbu6C1JdK7/XBwDCbsY+Dp4qSbEQJYBhv0kdAAAA/ezKAADCbsY+Dp4qSbEQJYBhv0kdAADZOFuUAAA=" /> 
        </m:ItemIds> 
      </m:DeleteItem> 
     </soap:Body> 
</soap:Envelope> 

I get 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
    <h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="235" MinorBuildNumber="1" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> 
    </s:Header> 
    <s:Body> 
    <m:DeleteItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
     <m:ResponseMessages> 
     <m:DeleteItemResponseMessage ResponseClass="Error"> 
      <m:MessageText>Access is denied. Check credentials and try again.</m:MessageText> 
      <m:ResponseCode>ErrorAccessDenied</m:ResponseCode> 
      <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey> 
     </m:DeleteItemResponseMessage> 
     </m:ResponseMessages> 
    </m:DeleteItemResponse> 
    </s:Body> 
</s:Envelope> 

"Accees denied. Check credentials and try again" 

回答

1

在案例1中删除您从您的日历约会,你必须完全访问。在案例2中,它看起来像试图从房间邮箱中删除约会,您可能拥有或可能没有完整的权限(即使您是约会的组织者,您需要权限的日历本身也是默认值) 。如果您的预约的组织者您最好在日历中取消预约,并将取消通知发送到房间邮箱,并让房间邮箱过程自动接受,并以此方式执行删除或您需要分配试图对有问题的Room邮箱执行Delete Full访问的邮箱。

干杯 格伦

+0

确实,你是对的。我需要在我自己的(作为组织者)日历中找到所需的会议,然后将其删除。谢谢!但是,要找出要删除的会议并不容易。我需要比较事件的地点和时间。我无法基于ID进行搜索。 –

相关问题