public static ItemOperations.Result DeleteItem(UserContext userContext, StoreObjectId itemId, StoreObjectId folderId) { ItemOperations.Result result = null; ListViewViewState listViewViewState = userContext.LastClientViewState as ListViewViewState; if (listViewViewState != null && folderId.Equals(listViewViewState.FolderId)) { result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Delete, itemId, folderId); } if (Utilities.IsDefaultFolderId(userContext.MailboxSession, folderId, DefaultFolderType.DeletedItems)) { Utilities.DeleteItems(userContext, DeleteItemFlags.SoftDelete, new StoreId[] { itemId }); } else { Utilities.DeleteItems(userContext, DeleteItemFlags.MoveToDeletedItems, new StoreId[] { itemId }); } return(result); }
// Token: 0x06000300 RID: 768 RVA: 0x0001AF0C File Offset: 0x0001910C public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("OwaContext"); } applicationElement = ApplicationElement.NotSet; type = null; state = null; action = null; HttpRequest request = owaContext.HttpContext.Request; UserContext userContext = owaContext.UserContext; if (!Utilities.IsPostRequest(request)) { return(userContext.LastClientViewState.ToPreFormActionResponse()); } string type2 = owaContext.FormsRegistryContext.Type; NavigationModule navigationModuleFromStoreType = MoveItemHelper.GetNavigationModuleFromStoreType(type2); ApplicationElement applicationElementFromStoreType = MoveItemHelper.GetApplicationElementFromStoreType(type2); if ((navigationModuleFromStoreType == NavigationModule.Calendar && !userContext.IsFeatureEnabled(Feature.Calendar)) || (navigationModuleFromStoreType == NavigationModule.Contacts && !userContext.IsFeatureEnabled(Feature.Contacts))) { throw new OwaSegmentationException("The " + type + " feature is disabled"); } StoreObjectId[] storeObjectIdsFromForm = RequestParser.GetStoreObjectIdsFromForm(request, true); StoreObjectId folderIdFromQueryString = RequestParser.GetFolderIdFromQueryString(request, true); StoreObjectId targetFolderIdFromQueryString = RequestParser.GetTargetFolderIdFromQueryString(request, true); string formParameter = Utilities.GetFormParameter(request, "hidt"); string[] array = formParameter.Split(new char[] { ',' }); if (array.Length != storeObjectIdsFromForm.Length) { throw new OwaInvalidRequestException("The counts of the items and their types are not identical."); } ItemOperations.Result result = null; if (navigationModuleFromStoreType == NavigationModule.Mail && applicationElementFromStoreType == ApplicationElement.Item) { result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Delete, storeObjectIdsFromForm[0], folderIdFromQueryString); } if (!MoveItemPreFormAction.DoMove(targetFolderIdFromQueryString, storeObjectIdsFromForm, array, owaContext)) { PreFormActionResponse preFormActionResponse = new PreFormActionResponse(); preFormActionResponse.ApplicationElement = ApplicationElement.Dialog; preFormActionResponse.Type = owaContext.FormsRegistryContext.Type; preFormActionResponse.Action = owaContext.FormsRegistryContext.Action; preFormActionResponse.AddParameter("fid", folderIdFromQueryString.ToBase64String()); return(preFormActionResponse); } if (result != null) { owaContext[OwaContextProperty.InfobarMessage] = null; } userContext.ForceNewSearch = true; return(ItemOperations.GetPreFormActionResponse(userContext, result)); }
public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; state = string.Empty; action = string.Empty; HttpContext httpContext = owaContext.HttpContext; this.userContext = owaContext.UserContext; HttpRequest request = httpContext.Request; if (!Utilities.IsPostRequest(request) && owaContext.FormsRegistryContext.Action != "Prev" && owaContext.FormsRegistryContext.Action != "Next") { return(this.userContext.LastClientViewState.ToPreFormActionResponse()); } this.context = owaContext; StoreId storeId = null; this.itemType = this.context.FormsRegistryContext.Type; string text; string storeObjectId; if (Utilities.IsPostRequest(request)) { text = Utilities.GetFormParameter(request, "hidid", false); if (text == null) { throw new OwaInvalidRequestException("MessageId is not set in the form"); } string formParameter = Utilities.GetFormParameter(request, "hidchk", false); if (formParameter != null) { storeId = Utilities.CreateItemId(this.userContext.MailboxSession, text, formParameter); } storeObjectId = Utilities.GetFormParameter(request, "hidfldid", true); string formParameter2 = Utilities.GetFormParameter(request, "rdoRsp", false); int num; if (!string.IsNullOrEmpty(formParameter2) && int.TryParse(formParameter2, out num)) { this.responseAction = (MeetingPagePreFormAction.ResponseAction)num; } } else { text = Utilities.GetQueryStringParameter(request, "id", false); storeObjectId = Utilities.GetQueryStringParameter(request, "fId", true); } ItemOperations.Result result = null; StoreObjectId storeObjectId2 = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, text); StoreObjectId folderId = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, storeObjectId); string action2; if ((action2 = owaContext.FormsRegistryContext.Action) != null) { if (< PrivateImplementationDetails > { 83F 8DD 10 - 61AE - 4283 - B829 - 2F 464F 055E61 }.$$method0x60002a7 - 1 == null)
public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; state = string.Empty; action = string.Empty; HttpContext httpContext = owaContext.HttpContext; UserContext userContext = owaContext.UserContext; HttpRequest request = httpContext.Request; if (!Utilities.IsPostRequest(request) && owaContext.FormsRegistryContext.Action != "Prev" && owaContext.FormsRegistryContext.Action != "Next") { return(userContext.LastClientViewState.ToPreFormActionResponse()); } string storeObjectId; string storeObjectId2; if (Utilities.IsPostRequest(request)) { storeObjectId = Utilities.GetFormParameter(request, "hidfldid", true); storeObjectId2 = Utilities.GetFormParameter(request, "hidid", true); } else { storeObjectId = Utilities.GetQueryStringParameter(request, "fId", true); storeObjectId2 = Utilities.GetQueryStringParameter(request, "id", true); } StoreObjectId folderId = Utilities.CreateStoreObjectId(userContext.MailboxSession, storeObjectId); StoreObjectId storeObjectId3 = Utilities.CreateStoreObjectId(userContext.MailboxSession, storeObjectId2); ItemOperations.Result result = null; string action2; if ((action2 = owaContext.FormsRegistryContext.Action) != null) { if (!(action2 == "Prev")) { if (!(action2 == "Next")) { if (!(action2 == "Del")) { if (!(action2 == "Junk")) { if (!(action2 == "NotJunk")) { goto IL_1FA; } if (!userContext.IsJunkEmailEnabled) { throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(552277155)); } owaContext[OwaContextProperty.InfobarMessage] = JunkEmailHelper.MarkAsNotJunk(userContext, new StoreObjectId[] { storeObjectId3 }); userContext.ForceNewSearch = true; } else { if (!userContext.IsJunkEmailEnabled) { throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(552277155)); } owaContext[OwaContextProperty.InfobarMessage] = JunkEmailHelper.MarkAsJunk(userContext, new StoreObjectId[] { storeObjectId3 }); userContext.ForceNewSearch = true; } } else { result = ItemOperations.DeleteItem(userContext, storeObjectId3, folderId); userContext.ForceNewSearch = true; } } else { result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Next, storeObjectId3, folderId); } } else { result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Prev, storeObjectId3, folderId); } return(ItemOperations.GetPreFormActionResponse(userContext, result)); } IL_1FA: throw new OwaInvalidRequestException("Unknown command"); }
public static PreFormActionResponse GetPreFormActionResponse(UserContext userContext, ItemOperations.Result result) { if (result == null) { return(userContext.LastClientViewState.ToPreFormActionResponse()); } PreFormActionResponse preFormActionResponse = new PreFormActionResponse(); preFormActionResponse.ApplicationElement = ApplicationElement.Item; preFormActionResponse.AddParameter("id", result.ItemId.ToBase64String()); if (!Utilities.IsDefaultFolderId(userContext.MailboxSession, result.FolderId, DefaultFolderType.JunkEmail)) { using (Item item = Item.Bind(userContext.MailboxSession, result.ItemId, new PropertyDefinition[] { StoreObjectSchema.ItemClass, MessageItemSchema.IsDraft, CalendarItemBaseSchema.IsMeeting, CalendarItemBaseSchema.IsOrganizer })) { preFormActionResponse.Type = item.ClassName; if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName)) { if (ItemUtility.GetProperty <bool>(item, CalendarItemBaseSchema.IsMeeting, false) && !ItemUtility.GetProperty <bool>(item, CalendarItemBaseSchema.IsOrganizer, false)) { preFormActionResponse.Action = "Read"; } else { preFormActionResponse.Action = "Open"; } } else if ((ObjectClass.IsMessage(item.ClassName, false) || ObjectClass.IsMeetingMessage(item.ClassName)) && ItemUtility.GetProperty <bool>(item, MessageItemSchema.IsDraft, false)) { preFormActionResponse.Action = "Open"; preFormActionResponse.State = "Draft"; } } } return(preFormActionResponse); }
public static ItemOperations.Result GetNextViewItem(UserContext userContext, ItemOperations.Action action, StoreObjectId itemId, StoreObjectId folderId) { Folder folder = null; ItemOperations.Result result; try { MessageModuleSearchViewState messageModuleSearchViewState = userContext.LastClientViewState as MessageModuleSearchViewState; SortBy[] sortOrder; if (messageModuleSearchViewState != null) { using (Folder folder2 = Folder.Bind(userContext.MailboxSession, messageModuleSearchViewState.FolderId)) { sortOrder = ItemOperations.GetSortOrder(userContext, folder2); FolderSearch folderSearch = new FolderSearch(); folder = folderSearch.Execute(userContext, folder2, messageModuleSearchViewState.SearchScope, messageModuleSearchViewState.SearchString, userContext.ForceNewSearch, false); userContext.ForceNewSearch = false; goto IL_77; } } folder = Folder.Bind(userContext.MailboxSession, folderId); sortOrder = ItemOperations.GetSortOrder(userContext, folder); IL_77: using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, sortOrder, new PropertyDefinition[] { ItemSchema.Id })) { queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.Id, itemId)); int num = queryResult.CurrentRow; int num2 = queryResult.EstimatedRowCount; int num3 = 0; if (num == num2 || num2 == 1) { result = null; } else { switch (action) { case ItemOperations.Action.Next: if (num + 1 == num2) { return(null); } num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1); break; case ItemOperations.Action.Prev: if (num == 0) { return(null); } num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1); break; case ItemOperations.Action.Delete: if (userContext.UserOptions.NextSelection == NextSelectionDirection.Previous) { if (num == 0) { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1); num3 = 0; } else { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1); } } else if (userContext.UserOptions.NextSelection == NextSelectionDirection.Next) { if (num2 - (num + 1) == 0) { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1); } else { num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1); num3 = 0; } } else if (userContext.UserOptions.NextSelection == NextSelectionDirection.ReturnToView) { return(null); } num2--; break; } num += num3; if (messageModuleSearchViewState != null) { messageModuleSearchViewState.PageNumber = num / userContext.UserOptions.BasicViewRowCount + 1; } else { ListViewViewState listViewViewState = userContext.LastClientViewState as ListViewViewState; if (listViewViewState != null && folderId.Equals(listViewViewState.FolderId)) { listViewViewState.PageNumber = num / userContext.UserOptions.BasicViewRowCount + 1; } } object[][] rows = queryResult.GetRows(1); result = new ItemOperations.Result(((VersionedId)rows[0][0]).ObjectId, folderId); } } } catch (ObjectNotFoundException) { result = null; } finally { if (folder != null) { folder.Dispose(); } } return(result); }