public string GetCalendarFolder() { CalendarGroup[] array = new CalendarGroup[] { new CalendarGroup() }; array[0].GroupId = Guid.Empty.ToString(); array[0].GroupType = CalendarGroupType.MyCalendars; array[0].GroupName = string.Empty; array[0].ItemId = new Microsoft.Exchange.Services.Core.Types.ItemId(array[0].GroupId, array[0].GroupId); array[0].Calendars = new CalendarEntry[1]; LocalCalendarEntry localCalendarEntry = new LocalCalendarEntry(); localCalendarEntry.CalendarColor = CalendarColor.Auto; localCalendarEntry.IsDefaultCalendar = true; array[0].Calendars[0] = localCalendarEntry; CalendarFolderType calendarFolderType = new CalendarFolderType(); calendarFolderType.FolderId = IdConverter.GetFolderIdFromStoreId(AnonymousUserContext.Current.PublishedCalendarId, new MailboxId(AnonymousUserContext.Current.ExchangePrincipal.MailboxInfo.MailboxGuid)); localCalendarEntry.ItemId = new Microsoft.Exchange.Services.Core.Types.ItemId("calendarEntryFor" + calendarFolderType.FolderId.Id, "calendarEntryChangeKeyFor" + calendarFolderType.FolderId.ChangeKey); calendarFolderType.DisplayName = AntiXssEncoder.HtmlEncode(AnonymousUserContext.Current.PublishedCalendarName, false); calendarFolderType.ChildFolderCount = new int?(0); calendarFolderType.ChildFolderCountSpecified = true; calendarFolderType.ExtendedProperty = null; calendarFolderType.FolderClass = "IPF.Appointment"; calendarFolderType.EffectiveRights = new EffectiveRightsType(); calendarFolderType.EffectiveRights.CreateAssociated = false; calendarFolderType.EffectiveRights.CreateContents = false; calendarFolderType.EffectiveRights.CreateHierarchy = false; calendarFolderType.EffectiveRights.Delete = false; calendarFolderType.EffectiveRights.Modify = false; calendarFolderType.EffectiveRights.Read = true; calendarFolderType.EffectiveRights.ViewPrivateItemsSpecified = false; localCalendarEntry.CalendarFolderId = calendarFolderType.FolderId; GetCalendarFoldersResponse instance = new GetCalendarFoldersResponse(array, new CalendarFolderType[] { calendarFolderType }); return(SessionDataHandler.EmitPayload("calendarFolders", JsonConverter.ToJSON(instance))); }
public string GetUserConfiguration() { OwaUserConfiguration owaUserConfiguration = new OwaUserConfiguration(); owaUserConfiguration.UserOptions = new UserOptionsType(); owaUserConfiguration.UserOptions.TimeZone = AnonymousUserContext.Current.TimeZone.AlternativeId; owaUserConfiguration.UserOptions.TimeFormat = MailboxRegionalConfiguration.GetDefaultTimeFormat(CultureInfo.CurrentUICulture); owaUserConfiguration.UserOptions.DateFormat = MailboxRegionalConfiguration.GetDefaultDateFormat(CultureInfo.CurrentUICulture); owaUserConfiguration.UserOptions.WorkingHours = new WorkingHoursType(0, 1440, 127, AnonymousUserContext.Current.TimeZone, AnonymousUserContext.Current.TimeZone); owaUserConfiguration.ApplicationSettings = new ApplicationSettingsType(); owaUserConfiguration.ApplicationSettings.AnalyticsEnabled = false; owaUserConfiguration.ApplicationSettings.InferenceEnabled = false; owaUserConfiguration.ApplicationSettings.WatsonEnabled = false; owaUserConfiguration.ApplicationSettings.DefaultTraceLevel = TraceLevel.Off; owaUserConfiguration.ApplicationSettings.InstrumentationSendIntervalSeconds = 0; owaUserConfiguration.SessionSettings = new SessionSettingsType(); owaUserConfiguration.SessionSettings.ArchiveDisplayName = string.Empty; owaUserConfiguration.SessionSettings.CanActAsOwner = false; owaUserConfiguration.SessionSettings.IsExplicitLogon = false; owaUserConfiguration.SessionSettings.IsExplicitLogonOthersMailbox = false; owaUserConfiguration.SessionSettings.UserCulture = AnonymousUserContext.Current.Culture.Name; owaUserConfiguration.SessionSettings.UserDisplayName = AntiXssEncoder.HtmlEncode(AnonymousUserContext.Current.ExchangePrincipal.MailboxInfo.DisplayName, false); owaUserConfiguration.SessionSettings.MaxMessageSizeInKb = 0; owaUserConfiguration.SessionSettings.DefaultFolderIds = new FolderId[1]; owaUserConfiguration.SessionSettings.DefaultFolderIds[0] = IdConverter.GetFolderIdFromStoreId(AnonymousUserContext.Current.PublishedCalendarId, new MailboxId(AnonymousUserContext.Current.ExchangePrincipal.MailboxInfo.MailboxGuid)); owaUserConfiguration.SessionSettings.DefaultFolderNames = new string[] { DefaultFolderType.Calendar.ToString() }; owaUserConfiguration.PolicySettings = new PolicySettingsType(); owaUserConfiguration.PolicySettings.PlacesEnabled = false; owaUserConfiguration.PolicySettings.WeatherEnabled = false; owaUserConfiguration.ViewStateConfiguration = new OwaViewStateConfiguration(); owaUserConfiguration.ViewStateConfiguration.CalendarViewTypeDesktop = 4; owaUserConfiguration.ViewStateConfiguration.CalendarViewTypeNarrow = 1; owaUserConfiguration.ViewStateConfiguration.CalendarViewTypeWide = 4; owaUserConfiguration.SegmentationSettings = new SegmentationSettingsType(0UL); owaUserConfiguration.SegmentationSettings.Calendar = true; return(SessionDataHandler.EmitPayload("owaUserConfig", JsonConverter.ToJSON(owaUserConfiguration))); }