Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            Exception ex = null;

            this.Initialize(context.Response);
            try
            {
                OwaServerTraceLogger.AppendToLog(new TraceLogEvent("GrEsProcReq", null, "GroupSubscriptionHandler.ProcessRequest", "Started processing request: " + context.Request.RawUrl));
                OWAService         owaservice  = new OWAService();
                CallContext        callContext = GroupSubscriptionHandler.CreateAndSetCallContext(context);
                IExchangePrincipal mailboxIdentityPrincipal = callContext.MailboxIdentityPrincipal;
                try
                {
                    this.SetPreferredCulture(mailboxIdentityPrincipal);
                    this.ValidateRequestMadeToGroupMailbox(callContext);
                    string action = this.ValidateAndGetActionString(context);
                    this.ParseEscalateOperationType(action);
                    if (this.RedirectToOwaGroupPageIfPossible(mailboxIdentityPrincipal, callContext, context.Response))
                    {
                        return;
                    }
                    this.BuildGroupHeaderDiv(mailboxIdentityPrincipal);
                    SetModernGroupMembershipJsonRequest modernGroupMembership = new SetModernGroupMembershipJsonRequest
                    {
                        GroupSmtpAddress = mailboxIdentityPrincipal.MailboxInfo.PrimarySmtpAddress.ToString(),
                        OperationType    = this.operationType.Value
                    };
                    SetModernGroupMembershipJsonResponse ewsresponse = owaservice.SetModernGroupMembership(modernGroupMembership);
                    this.ValidateEwsResponse(ewsresponse);
                    this.WriteSuccessfulResponse(context);
                }
                finally
                {
                    GroupSubscriptionHandler.DisposeContext(callContext);
                }
            }
            catch (ExceededMaxSubscribersException)
            {
                this.WriteErrorResponse(context, ClientStrings.GroupSubscriptionPageSubscribeFailedMaxSubscribers(this.encodedGroupDisplayName));
            }
            catch (NotAMemberException)
            {
                this.WriteErrorResponse(context, ClientStrings.GroupSubscriptionPageSubscribeFailedNotAMember(this.encodedGroupDisplayName));
            }
            catch (Exception ex2)
            {
                this.WriteErrorResponse(context, ClientStrings.GroupSubscriptionPageRequestFailedInfo);
                ex = ex2;
            }
            if (ex != null)
            {
                OwaServerTraceLogger.AppendToLog(new TraceLogEvent("GrEsProcReq", null, "GroupSubscriptionHandler.ProcessRequest", "Error processing request: " + ex.ToString()));
            }
        }