private IEnumerable <CalendarGroupInfo> GetCalendarGroupInfoList(bool ensureCalendarInfoIsLoaded) { bool flag = false; int num = 0; CalendarGroupInfoList calendarGroupsView; do { num++; calendarGroupsView = this.Scope.XsoFactory.GetCalendarGroupsView(this.Scope.StoreSession); if (!calendarGroupsView.DefaultGroups.ContainsKey(CalendarGroupType.MyCalendars)) { using (ICalendarGroup calendarGroup = this.Scope.XsoFactory.BindToCalendarGroup(this.Scope.StoreSession, CalendarGroupType.MyCalendars)) { calendarGroupsView.Add(calendarGroup.GetCalendarGroupInfo()); flag = true; } } if (!calendarGroupsView.DefaultGroups.ContainsKey(CalendarGroupType.OtherCalendars)) { using (ICalendarGroup calendarGroup2 = this.Scope.XsoFactory.BindToCalendarGroup(this.Scope.StoreSession, CalendarGroupType.OtherCalendars)) { calendarGroupsView.Add(calendarGroup2.GetCalendarGroupInfo()); flag = true; } } }while (ensureCalendarInfoIsLoaded && flag && num < 2); return(calendarGroupsView); }
protected override Calendar OnExecute() { this.Scope.CalendarGroupEntryDataProvider.Validate(base.Entity, true); StoreId storeId = this.Scope.CalendarGroupForNewCalendars.GetStoreId(); Calendar result; using (ICalendarGroup calendarGroup = this.Scope.XsoFactory.BindToCalendarGroup(this.Scope.StoreSession, storeId, null)) { Calendar calendar = this.Scope.CalendarFolderDataProvider.Create(base.Entity); base.Entity.RecordKey = calendar.RecordKey; base.Entity.CalendarFolderStoreId = calendar.StoreId; try { result = this.Scope.CalendarGroupEntryDataProvider.Create(base.Entity, calendarGroup); } catch (LocalizedException ex) { try { this.Scope.CalendarFolderDataProvider.Delete(calendar.StoreId, DeleteItemFlags.HardDelete); } catch (Exception ex2) { throw new AggregateException(new Exception[] { ex, ex2 }); } throw; } } return(result); }
protected override StoreId ResolveReference() { StoreId id; using (ICalendarGroup calendarGroup = base.XsoFactory.BindToCalendarGroup(base.StoreSession, this.calendarGroupType.Value)) { id = calendarGroup.Id; } return(id); }
public virtual Calendar Create(Calendar entity, ICalendarGroup calendarGroup) { this.Validate(entity, true); Calendar result; using (ICalendarGroupEntry calendarGroupEntry = base.XsoFactory.CreateCalendarGroupEntry(base.Session, StoreId.GetStoreObjectId(entity.CalendarFolderStoreId), calendarGroup)) { result = this.Update(entity, calendarGroupEntry, SaveMode.NoConflictResolution); } return(result); }
public ICalendarGroupEntry CreateCalendarGroupEntry(IMailboxSession session, StoreObjectId calendarFolderId, ICalendarGroup parentGroup) { return(CalendarGroupEntry.Create((MailboxSession)session, calendarFolderId, (CalendarGroup)parentGroup)); }
public ICalendarGroupEntry CreateCalendarGroupEntry(IMailboxSession session, string legacyDistinguishedName, ICalendarGroup parentGroup) { return(CalendarGroupEntry.Create((MailboxSession)session, legacyDistinguishedName, (CalendarGroup)parentGroup)); }