public int SetMailboxAdvancedSettings(int itemId, int accountId, bool enablePOP,
                                       bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync,
                                       int issueWarningKB, int prohibitSendKB, int prohibitSendReceiveKB, int keepDeletedItemsDays)
 {
     return(ExchangeServerController.SetMailboxAdvancedSettings(itemId, accountId, enablePOP,
                                                                enableIMAP, enableOWA, enableMAPI, enableActiveSync,
                                                                issueWarningKB, prohibitSendKB, prohibitSendReceiveKB, keepDeletedItemsDays));
 }
Exemple #2
0
 public ExchangeAccountsPaged GetAccountsPaged(int itemId, string accountTypes,
                                               string filterColumn, string filterValue, string sortColumn,
                                               int startRow, int maximumRows, bool archiving)
 {
     return(ExchangeServerController.GetAccountsPaged(itemId, accountTypes,
                                                      filterColumn, filterValue, sortColumn,
                                                      startRow, maximumRows, archiving));
 }
Exemple #3
0
 public int SetDistributionListGeneralSettings(int itemId, int accountId, string displayName,
                                               bool hideAddressBook, string managerAccount, string[] memberAccounts,
                                               string notes)
 {
     return(ExchangeServerController.SetDistributionListGeneralSettings(itemId, accountId, displayName,
                                                                        hideAddressBook, managerAccount, memberAccounts,
                                                                        notes));
 }
        public int CreateMailbox(int itemId, int accountId, ExchangeAccountType accountType, string accountName, string displayName,
                                 string name, string domain, string password, bool sendSetupInstructions, string setupInstructionMailAddress, int mailboxPlanId,
                                 int archivedPlanId, string subscriberNumber, bool EnableArchiving)
        {
            int res = ExchangeServerController.CreateMailbox(itemId, accountId, accountType, accountName, displayName, name, domain, password,
                                                             sendSetupInstructions, setupInstructionMailAddress, mailboxPlanId, archivedPlanId, subscriberNumber, EnableArchiving);

            return(res);
        }
Exemple #5
0
 public List <ExchangeAccount> SearchAccounts(int itemId,
                                              bool includeMailboxes, bool includeContacts, bool includeDistributionLists,
                                              bool includeRooms, bool includeEquipment, bool includeSecurityGroups,
                                              string filterColumn, string filterValue, string sortColumn)
 {
     return(ExchangeServerController.SearchAccounts(itemId,
                                                    includeMailboxes, includeContacts, includeDistributionLists,
                                                    includeRooms, includeEquipment, includeSecurityGroups,
                                                    filterColumn, filterValue, sortColumn));
 }
Exemple #6
0
        public void CalculateDiskspace()
        {
            // get all space organizations recursively
            List <Organization> items = ExchangeServerController.GetExchangeOrganizations(TaskManager.TopTask.PackageId, true);

            foreach (Organization item in items)
            {
                ExchangeServerController.CalculateOrganizationDiskspaceInternal(item.Id);
            }
        }
Exemple #7
0
 public int SetMailboxMailFlowSettings(int itemId, int accountId,
                                       bool enableForwarding, string forwardingAccountName, bool forwardToBoth,
                                       string[] sendOnBehalfAccounts, string[] acceptAccounts, string[] rejectAccounts,
                                       bool requireSenderAuthentication)
 {
     return(ExchangeServerController.SetMailboxMailFlowSettings(itemId, accountId,
                                                                enableForwarding, forwardingAccountName, forwardToBoth,
                                                                sendOnBehalfAccounts, acceptAccounts, rejectAccounts,
                                                                requireSenderAuthentication));
 }
Exemple #8
0
 public int SetActiveSyncPolicy(int itemId, bool allowNonProvisionableDevices,
                                bool attachmentsEnabled, int maxAttachmentSizeKB, bool uncAccessEnabled, bool wssAccessEnabled,
                                bool devicePasswordEnabled, bool alphanumericPasswordRequired, bool passwordRecoveryEnabled,
                                bool deviceEncryptionEnabled, bool allowSimplePassword, int maxPasswordFailedAttempts, int minPasswordLength,
                                int inactivityLockMin, int passwordExpirationDays, int passwordHistory, int refreshInteval)
 {
     return(ExchangeServerController.SetActiveSyncPolicy(itemId, allowNonProvisionableDevices, attachmentsEnabled,
                                                         maxAttachmentSizeKB, uncAccessEnabled, wssAccessEnabled, devicePasswordEnabled, alphanumericPasswordRequired,
                                                         passwordRecoveryEnabled, deviceEncryptionEnabled, allowSimplePassword, maxPasswordFailedAttempts,
                                                         minPasswordLength, inactivityLockMin, passwordExpirationDays, passwordHistory, refreshInteval));
 }
Exemple #9
0
 public int SetContactGeneralSettings(int itemId, int accountId, string displayName, string emailAddress,
                                      bool hideAddressBook, string firstName, string initials,
                                      string lastName, string address, string city, string state, string zip, string country,
                                      string jobTitle, string company, string department, string office, string managerAccountName,
                                      string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
                                      string webPage, string notes, int useMapiRichTextFormat)
 {
     return(ExchangeServerController.SetContactGeneralSettings(itemId, accountId, displayName, emailAddress,
                                                               hideAddressBook, firstName, initials,
                                                               lastName, address, city, state, zip, country,
                                                               jobTitle, company, department, office, managerAccountName,
                                                               businessPhone, fax, homePhone, mobilePhone, pager,
                                                               webPage, notes, useMapiRichTextFormat));
 }
 public int SetMailboxGeneralSettings(int itemId, int accountId, string displayName,
                                      string password, bool hideAddressBook, bool disabled, string firstName, string initials,
                                      string lastName, string address, string city, string state, string zip, string country,
                                      string jobTitle, string company, string department, string office, string managerAccountName,
                                      string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
                                      string webPage, string notes)
 {
     return(ExchangeServerController.SetMailboxGeneralSettings(itemId, accountId, displayName,
                                                               password, hideAddressBook, disabled, firstName, initials,
                                                               lastName, address, city, state, zip, country,
                                                               jobTitle, company, department, office, managerAccountName,
                                                               businessPhone, fax, homePhone, mobilePhone, pager,
                                                               webPage, notes));
 }
Exemple #11
0
        public override void DoWork()
        {
            BackgroundTask topTask = TaskManager.TopTask;

            int daysBeforeNotify;

            // check input parameters
            if (!int.TryParse((string)topTask.GetParamValue(DaysBeforeNotify), out daysBeforeNotify))
            {
                TaskManager.WriteWarning("Specify 'Notify before (days)' task parameter");
                return;
            }

            OrganizationController.DeleteAllExpiredTokens();

            var owner = UserController.GetUser(topTask.EffectiveUserId);

            var packages = PackageController.GetMyPackages(topTask.EffectiveUserId);

            foreach (var package in packages)
            {
                var organizations = ExchangeServerController.GetExchangeOrganizations(package.PackageId, true);

                foreach (var organization in organizations)
                {
                    var usersWithExpiredPasswords = OrganizationController.GetOrganizationUsersWithExpiredPassword(organization.Id, daysBeforeNotify);

                    var generalSettings = OrganizationController.GetOrganizationGeneralSettings(organization.Id);

                    var logoUrl = generalSettings != null ? generalSettings.OrganizationLogoUrl : string.Empty;

                    foreach (var user in usersWithExpiredPasswords)
                    {
                        user.ItemId = organization.Id;

                        if (string.IsNullOrEmpty(user.PrimaryEmailAddress))
                        {
                            TaskManager.WriteWarning(string.Format("Unable to send email to {0} user (organization: {1}), user primary email address is not set.", user.DisplayName, organization.OrganizationId));
                            continue;
                        }

                        OrganizationController.SendUserExpirationPasswordEmail(owner, user, "Scheduler Password Expiration Notification", user.PrimaryEmailAddress, logoUrl);
                    }
                }
            }
        }
Exemple #12
0
        private static void GetLyncUserPlansByUser(int itemId, UserInfo user, ref List <LyncUserPlan> plans)
        {
            if ((user != null))
            {
                List <Organization> orgs = null;

                if (user.UserId != 1)
                {
                    List <PackageInfo> Packages = PackageController.GetPackages(user.UserId);

                    if ((Packages != null) & (Packages.Count > 0))
                    {
                        orgs = ExchangeServerController.GetExchangeOrganizationsInternal(Packages[0].PackageId, false);
                    }
                }
                else
                {
                    orgs = ExchangeServerController.GetExchangeOrganizationsInternal(1, false);
                }

                int OrgId = -1;
                if (itemId > 0)
                {
                    OrgId = itemId;
                }
                else if ((orgs != null) & (orgs.Count > 0))
                {
                    OrgId = orgs[0].Id;
                }

                if (OrgId != -1)
                {
                    List <LyncUserPlan> Plans = ObjectUtils.CreateListFromDataReader <LyncUserPlan>(DataProvider.GetLyncUserPlans(OrgId));

                    foreach (LyncUserPlan p in Plans)
                    {
                        plans.Add(p);
                    }
                }

                UserInfo owner = UserController.GetUserInternally(user.OwnerId);

                GetLyncUserPlansByUser(0, owner, ref plans);
            }
        }
        private void BindMailboxPlans(string orgId)
        {
            cbMailboxPlan.Items.Clear();
            cbMailboxPlan.Items.Add("<not set>");
            cbMailboxPlan.SelectedIndex = 0;

            Organization org = OrganizationController.GetOrganizationById(orgId);

            if (org == null)
            {
                List <Organization> orgs = ExchangeServerController.GetExchangeOrganizations(1, false);
                if (orgs.Count > 0)
                {
                    org = orgs[0];
                }
            }

            if (org != null)
            {
                int itemId = org.Id;
                List <ExchangeMailboxPlan> plans = ExchangeServerController.GetExchangeMailboxPlans(itemId, false);
                cbMailboxPlan.Items.AddRange(plans.ToArray());
            }
        }
Exemple #14
0
 public ResultObject SetPicture(int itemId, int accountId, byte[] picture)
 {
     return(ExchangeServerController.SetPicture(itemId, accountId, picture));
 }
Exemple #15
0
 public int GetExchangeAccountDisclaimerId(int itemId, int AccountID)
 {
     return(ExchangeServerController.GetExchangeAccountDisclaimerId(itemId, AccountID));
 }
Exemple #16
0
 public int SetExchangeAccountDisclaimerId(int itemId, int AccountID, int ExchangeDisclaimerId)
 {
     return(ExchangeServerController.SetExchangeAccountDisclaimerId(itemId, AccountID, ExchangeDisclaimerId));
 }
Exemple #17
0
 public List <ExchangeDisclaimer> GetExchangeDisclaimers(int itemId)
 {
     return(ExchangeServerController.GetExchangeDisclaimers(itemId));
 }
Exemple #18
0
 public ExchangeDisclaimer GetExchangeDisclaimer(int itemId, int exchangeDisclaimerId)
 {
     return(ExchangeServerController.GetExchangeDisclaimer(itemId, exchangeDisclaimerId));
 }
Exemple #19
0
 public int DeleteExchangeDisclaimer(int itemId, int exchangeDisclaimerId)
 {
     return(ExchangeServerController.DeleteExchangeDisclaimer(itemId, exchangeDisclaimerId));
 }
Exemple #20
0
 public int UpdateExchangeDisclaimer(int itemId, ExchangeDisclaimer disclaimer)
 {
     return(ExchangeServerController.UpdateExchangeDisclaimer(itemId, disclaimer));
 }
Exemple #21
0
 public string SetDefaultPublicFolderMailbox(int itemId)
 {
     return(ExchangeServerController.SetDefaultPublicFolderMailbox(itemId));
 }
Exemple #22
0
        private static void PopulateOrganizationStatisticsReport(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
        {
            OrganizationStatisticsRepotItem item = new OrganizationStatisticsRepotItem();

            PopulateBaseItem(item, org, topReseller);

            if (report.ExchangeReport != null)
            {
                try
                {
                    List <ExchangeMailboxStatistics> mailboxStats =
                        report.ExchangeReport.Items.FindAll(
                            delegate(ExchangeMailboxStatistics stats)
                            { return(stats.OrganizationID == org.OrganizationId); });

                    item.TotalMailboxes = mailboxStats.Count;
                    foreach (ExchangeMailboxStatistics current in mailboxStats)
                    {
                        item.TotalMailboxesSize += current.TotalSize;
                    }

                    Providers.Exchange.ExchangeServer exchange;
                    if (!string.IsNullOrEmpty(org.GlobalAddressList))
                    {
                        try
                        {
                            int exchangeServiceId = GetExchangeServiceID(org.PackageId);
                            exchange =
                                ExchangeServerController.GetExchangeServer(exchangeServiceId, org.ServiceId);
                        }
                        catch (Exception ex)
                        {
                            throw new ApplicationException(
                                      string.Format("Could not get exchange server. PackageId: {0}", org.PackageId), ex);
                        }

                        try
                        {
                            item.TotalPublicFoldersSize = exchange.GetPublicFolderSize(org.OrganizationId, "\\" + org.OrganizationId);
                        }
                        catch (Exception ex)
                        {
                            throw new ApplicationException(
                                      string.Format("Could not get public folder size. OrgId: {0}", org.OrganizationId), ex);
                        }
                    }

                    try
                    {
                        org.DiskSpace = (int)(item.TotalPublicFoldersSize + item.TotalMailboxesSize);
                        PackageController.UpdatePackageItem(org);
                    }
                    catch (Exception ex)
                    {
                        throw new ApplicationException(string.Format("Could not calcualate diskspace. Org Id: {0}", org.Id), ex);
                    }
                }
                catch (Exception ex)
                {
                    TaskManager.WriteError(ex);
                }
            }

            if (report.SharePointReport != null)
            {
                List <SharePointStatistics> sharePoints =
                    report.SharePointReport.Items.FindAll(
                        delegate(SharePointStatistics stats) { return(stats.OrganizationID == org.OrganizationId); });

                item.TotalSharePointSiteCollections = sharePoints.Count;
                foreach (SharePointStatistics current in sharePoints)
                {
                    item.TotalSharePointSiteCollectionsSize += current.SiteCollectionSize;
                }
            }

            if (report.SharePointEnterpriseReport != null)
            {
                List <SharePointEnterpriseStatistics> sharePoints =
                    report.SharePointEnterpriseReport.Items.FindAll(
                        delegate(SharePointEnterpriseStatistics stats) { return(stats.OrganizationID == org.OrganizationId); });

                item.TotalSharePointEnterpriseSiteCollections = sharePoints.Count;
                foreach (SharePointEnterpriseStatistics current in sharePoints)
                {
                    item.TotalSharePointEnterpriseSiteCollectionsSize += current.SiteCollectionSize;
                }
            }



            if (report.CRMReport != null)
            {
                List <CRMOrganizationStatistics> crmOrganizationStatistics =
                    report.CRMReport.Items.FindAll(
                        delegate(CRMOrganizationStatistics stats) { return(stats.OrganizationID == org.OrganizationId); });

                item.TotalCRMUsers = crmOrganizationStatistics.Count;
            }

            item.TotalLyncUsers   = 0;
            item.TotalLyncEVUsers = 0;

            if (report.LyncReport != null)
            {
                List <LyncUserStatistics> lyncOrganizationStatistics =
                    report.LyncReport.Items.FindAll(
                        delegate(LyncUserStatistics stats) { return(stats.OrganizationID == org.OrganizationId); });

                foreach (LyncUserStatistics current in lyncOrganizationStatistics)
                {
                    if (current.EnterpriseVoice)
                    {
                        item.TotalLyncEVUsers++;
                    }
                }

                item.TotalLyncUsers = lyncOrganizationStatistics.Count;
            }

            report.OrganizationReport.Items.Add(item);
        }
Exemple #23
0
 public int DeleteOrganization(int itemId)
 {
     return(ExchangeServerController.DeleteOrganization(itemId));
 }
Exemple #24
0
 public BytesResult GetPicture(int itemId, int accountId)
 {
     return(ExchangeServerController.GetPicture(itemId, accountId));
 }
Exemple #25
0
 public OrganizationStatistics GetOrganizationStatisticsByOrganization(int itemId)
 {
     return(ExchangeServerController.GetOrganizationStatisticsByOrganization(itemId));
 }
Exemple #26
0
 public int AddPublicFolderEmailAddress(int itemId, int accountId, string emailAddress)
 {
     return(ExchangeServerController.AddPublicFolderEmailAddress(itemId, accountId, emailAddress));
 }
Exemple #27
0
 public Organization GetOrganizationStorageLimits(int itemId)
 {
     return(ExchangeServerController.GetOrganizationStorageLimits(itemId));
 }
Exemple #28
0
 public int SetPublicFolderPrimaryEmailAddress(int itemId, int accountId, string emailAddress)
 {
     return(ExchangeServerController.SetPublicFolderPrimaryEmailAddress(itemId, accountId, emailAddress));
 }
Exemple #29
0
        private static void PopulateExchangeReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
        {
            TaskManager.Write("Exchange Report Items " + org.Name);

            //Check if exchange organization
            if (string.IsNullOrEmpty(org.GlobalAddressList))
            {
                return;
            }

            List <ExchangeAccount> mailboxes;

            Providers.Exchange.ExchangeServer exchange;
            try
            {
                mailboxes = ExchangeServerController.GetExchangeMailboxes(org.Id);
            }
            catch (Exception ex)
            {
                TaskManager.WriteError(ex);

                throw new ApplicationException(
                          string.Format("Could not get mailboxes for current organization {0}", org.Id), ex);
            }

            TaskManager.WriteParameter("mailboxes.Count", mailboxes.Count);

            try
            {
                int exchangeServiceId = GetExchangeServiceID(org.PackageId);
                exchange = ExchangeServerController.GetExchangeServer(exchangeServiceId, org.ServiceId);
            }
            catch (Exception ex)
            {
                TaskManager.WriteError(ex);

                throw new ApplicationException(
                          string.Format("Could not get exchange server. PackageId: {0}", org.PackageId), ex);
            }

            ExchangeMailboxStatistics stats;

            foreach (ExchangeAccount mailbox in mailboxes)
            {
                try
                {
                    TaskManager.WriteParameter("mailbox", mailbox.UserPrincipalName);

                    stats = null;
                    try
                    {
                        stats = exchange.GetMailboxStatistics(mailbox.UserPrincipalName);
                    }
                    catch (Exception ex)
                    {
                        TaskManager.WriteError(ex);

                        TaskManager.WriteError(ex, "Could not get mailbox statistics. AccountName: {0}",
                                               mailbox.UserPrincipalName);
                    }


                    if (stats != null)
                    {
                        PopulateBaseItem(stats, org, topReseller);
                        stats.MailboxType = mailbox.AccountType;
                        if (mailbox.AccountType == ExchangeAccountType.Mailbox)
                        {
                            ExchangeAccount a = ExchangeServerController.GetAccount(mailbox.ItemId, mailbox.AccountId);
                            stats.MailboxPlan = a.MailboxPlan;
                        }


                        stats.BlackberryEnabled = BlackBerryController.CheckBlackBerryUserExists(mailbox.AccountId);
                        report.ExchangeReport.Items.Add(stats);

                        TaskManager.Write("Items.Add");
                    }
                }
                catch (Exception ex)
                {
                    TaskManager.WriteError(ex);
                }
            }

            TaskManager.Write("End Populate Exchange Report Items " + org.Name);
        }
Exemple #30
0
 public int DeletePublicFolderEmailAddresses(int itemId, int accountId, string[] emailAddresses)
 {
     return(ExchangeServerController.DeletePublicFolderEmailAddresses(itemId, accountId, emailAddresses));
 }