是否使用PHP EWS删除定期日历项?
在过去的几天里,我一直在学习使用来阅读/更新/删除日历条目。我已经能够创建单个事件,读取一天的所有日历事件并删除事件。我的问题是,我找不到任何有关删除整个重复事件系列的信息。当我删除一个事件时,我的代码只删除1个事件的条目,而不是所有重复实例 不确定我是否只是向删除代码传递了错误的Id和ChangeKey,或者是否有处理重复事件的特殊代码 我删除事件的代码如下:是否使用PHP EWS删除定期日历项?,php,exchangewebservices,php-ews,Php,Exchangewebservices,Php Ews,在过去的几天里,我一直在学习使用来阅读/更新/删除日历条目。我已经能够创建单个事件,读取一天的所有日历事件并删除事件。我的问题是,我找不到任何有关删除整个重复事件系列的信息。当我删除一个事件时,我的代码只删除1个事件的条目,而不是所有重复实例 不确定我是否只是向删除代码传递了错误的Id和ChangeKey,或者是否有处理重复事件的特殊代码 我删除事件的代码如下: <?php // Define the delete item class $request = new EWSType_Del
<?php
// Define the delete item class
$request = new EWSType_DeleteItemType();
// Send to trash can, or use EWSType_DisposalType::HARD_DELETE instead to bypass the bin directly
$request->DeleteType = EWSType_DisposalType::MOVE_TO_DELETED_ITEMS;
$request->SendMeetingCancellations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_ONLY_TO_ALL;
$items = new EWSType_NonEmptyArrayOfBaseItemIdsType();
foreach ($IDs as $id) {
// Set the item to be deleted
$item = new EWSType_ItemIdType();
$item->Id = $id['Id'];
$item->ChangeKey = $id['ChangeKey'];
$items->ItemId[] = $item;
}
$request->ItemIds = $items;
// Send the request
$response = $this->ews->DeleteItem($request);
?>
LoadTypes()函数只需循环遍历所需的EWSType文件,然后将其包含在内,这样我就不必加载每个类型的文件。您首先需要找到定期序列的主约会ID,然后删除该主约会 我不“做”PHP,但这些是真正的SOAP调用。也许它们能帮助你回到正轨: 从事件中获取定期主ID(和一些数据):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:GetItem>
<mes:ItemShape>
<typ:BaseShape>IdOnly</typ:BaseShape>
<typ:AdditionalProperties>
<typ:FieldURI FieldURI="item:Subject" />
<typ:FieldURI FieldURI="item:Categories" />
<typ:FieldURI FieldURI="item:DateTimeCreated" />
<typ:FieldURI FieldURI="item:LastModifiedTime" />
<typ:FieldURI FieldURI="item:Sensitivity" />
<typ:FieldURI FieldURI="item:ItemClass" />
<typ:FieldURI FieldURI="calendar:Start" />
<typ:FieldURI FieldURI="calendar:End" />
<typ:FieldURI FieldURI="calendar:CalendarItemType" />
<typ:FieldURI FieldURI="calendar:IsRecurring" />
<typ:FieldURI FieldURI="calendar:Recurrence" />
<typ:FieldURI FieldURI="calendar:FirstOccurrence" />
<typ:FieldURI FieldURI="calendar:LastOccurrence" />
<typ:FieldURI FieldURI="calendar:ModifiedOccurrences" />
<typ:FieldURI FieldURI="calendar:DeletedOccurrences" />
</typ:AdditionalProperties>
</mes:ItemShape>
<mes:ItemIds>
<typ:RecurringMasterItemId OccurrenceId="AAMkADkyZT[snip]kgAAEA=="/>
</mes:ItemIds>
</mes:GetItem>
</soapenv:Body>
</soapenv:Envelope>
我只
删除项目:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:DeleteItem DeleteType="HardDelete" SendMeetingCancellations="SendToNone">
<mes:ItemIds>
<!--You have a CHOICE of the next 3 items at this level-->
<typ:ItemId Id="AQMkADkyZTQxNjUzLTcwZTQtNGRlNS04M2VmLWMxYmIBNWJiADUwZTYARgAAA4Kt4mOTlXZJrZx0v5cQm8IHAISmF1hx/2pAhQBTVUBmYgoAAAMhAAAAhKYXWHH/akCFAFNVQGZiCgAB57O2JwAAAA=="/>
<!--typ:OccurrenceItemId RecurringMasterId="?" InstanceIndex="?"/>
<typ:RecurringMasterItemId OccurrenceId="?"/-->
</mes:ItemIds>
</mes:DeleteItem>
</soapenv:Body>
</soapenv:Envelope>
恩美
谢谢你。你让我重回正轨。在做了更多的搜索和查看了你在同一主题上的其他帖子后,我正在用煤气做饭!
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:DeleteItem DeleteType="HardDelete" SendMeetingCancellations="SendToNone">
<mes:ItemIds>
<!--You have a CHOICE of the next 3 items at this level-->
<typ:ItemId Id="AQMkADkyZTQxNjUzLTcwZTQtNGRlNS04M2VmLWMxYmIBNWJiADUwZTYARgAAA4Kt4mOTlXZJrZx0v5cQm8IHAISmF1hx/2pAhQBTVUBmYgoAAAMhAAAAhKYXWHH/akCFAFNVQGZiCgAB57O2JwAAAA=="/>
<!--typ:OccurrenceItemId RecurringMasterId="?" InstanceIndex="?"/>
<typ:RecurringMasterItemId OccurrenceId="?"/-->
</mes:ItemIds>
</mes:DeleteItem>
</soapenv:Body>
</soapenv:Envelope>