我正在使用EWS Exchange Sync,在我的一种方法中,这就是说我超出了可以在单个请求中删除的1000个项目的最大数量。是否可以解决此问题,而不是从日历中删除所有内容,而只从今天起删除,而不是及时删除?
导致错误的方法在这里:
public void DeleteAllSafeAppointments(SCDriftConnection conn, ExchangeService service, SAFEAgent agent) {
if(conn == null)
throw new ArgumentNullException("conn");
if(service == null)
throw new ArgumentNullException("service");
if(agent == null)
throw new ArgumentNullException("agent");
try {
var calendar = GetAgentCalendar(service, agent);
service.DeleteItems(GetAllSafeAppointments(calendar).Select(a => a.Id), DeleteMode.HardDelete, SendCancellationsMode.SendToNone, null);
var scheduledActivitiesOnAgent = ScheduledActivity.GetScheduleToExchange(new QueryParameters<ScheduledActivity>(s => s.Initials == agent.Initials && s.ExchangeId != null));
foreach(var schedAct in scheduledActivitiesOnAgent) {
schedAct.ExchangeId = null;
schedAct.Save(conn);
}
ResetAgentSyncState(calendar, agent);
} catch(Exception ex) {
throw new Exception("An error occured while clearing exchange calendar for " + agent.Initials, ex);
}
agent.ExchangeSyncronizationSettings.LastSync = DateTime.Now;
agent.ExchangeSyncronizationSettings.Save(conn);
}
LEATH
暮色呼如
相关分类