protected void btnSaveToken_Click(object sender, EventArgs e) { trFormError.Visible = false; mvStep1.ActiveViewIndex = -1; mvStep2.ActiveViewIndex = -1; try { Service service = new Service(AppsNameTable.GAppsService, "sherpadesk"); string token = string.Empty; if (trGoogleDomain.Visible) { string googleDomain = txtGoogleDomain.Text; AppsService appService = new AppsService(googleDomain, txtGoogleEmail.Text, txtGooglePassword.Text); GroupFeed groups = appService.Groups.RetrieveAllGroups(); EmailSuffixProvider.InsertEmailSuffixName(UserContext.Current.OrganizationId, null, ref googleDomain); FillDomains(); } service.setUserCredentials(txtGoogleEmail.Text, txtGooglePassword.Text); token = service.QueryClientLoginToken(); OrganizationProvider.UpdateOrganizationGoogleAdminAuthToken(UserContext.Current.OrganizationId, token); mvConnectionSettings.SetActiveView(vwToken); } catch (AppsException a) { lblFromError.Text = string.Format(CultureInfo.CurrentCulture, Resources.GoogleIntegrationControl_GoogleAppsError_Text, a.ErrorCode, a.InvalidInput, a.Reason); trFormError.Visible = true; } catch (Exception ex) { lblFromError.Text = ex.Message; trFormError.Visible = true; } }