示例#1
0
        public void SetupViews(bool isBrowser)
        {
            m_isBrowser = isBrowser;
            BaseViewModel.isServer = true;          // because we start out with Server on -- wouldn't get set by command
            IsServerMigration = true;
            IsUserMigration = false;
            savedDomain = "";
            ZimbraValues.GetZimbraValues().ClientVersion = BuildNum;

            m_configViewModelS = new ConfigViewModelS();
            m_configViewModelS.Name = "ConfigViewModelS";
            m_configViewModelS.ViewTitle = "Source";
            m_configViewModelS.lb = lb;
            m_configViewModelS.isBrowser = isBrowser;
            m_configViewModelS.OutlookProfile = "";
            m_configViewModelS.MailServerHostName = "";
            m_configViewModelS.MailServerAdminID = "";
            m_configViewModelS.MailServerAdminPwd = "";

            m_configViewModelU = new ConfigViewModelU();
            m_configViewModelU.Name = "ConfigViewModelU";
            m_configViewModelU.ViewTitle = "Source";
            m_configViewModelU.lb = lb;
            m_configViewModelU.isBrowser = isBrowser;
            m_configViewModelU.OutlookProfile = "";
            m_configViewModelU.PSTFile = "";
            m_configViewModelU.OutlookProfile = "";

            m_configViewModelSDest = new ConfigViewModelSDest();
            m_configViewModelSDest.Name = "ConfigViewModelSDest";
            m_configViewModelSDest.ViewTitle = "Destination";
            m_configViewModelSDest.lb = lb;
            m_configViewModelSDest.isBrowser = isBrowser;
            m_configViewModelSDest.ZimbraServerHostName = "";
            m_configViewModelSDest.ZimbraPort = "";
            m_configViewModelSDest.ZimbraAdmin = "";
            m_configViewModelSDest.ZimbraAdminPasswd = "";
            m_configViewModelSDest.ZimbraSSL = true;

            m_configViewModelUDest = new ConfigViewModelUDest();
            m_configViewModelUDest.Name = "ConfigViewModelUDest";
            m_configViewModelUDest.ViewTitle = "Destination";
            m_configViewModelUDest.lb = lb;
            m_configViewModelUDest.isBrowser = isBrowser;
            m_configViewModelUDest.ZimbraServerHostName = "";
            m_configViewModelUDest.ZimbraPort = "";
            m_configViewModelUDest.ZimbraUser = "";
            m_configViewModelUDest.ZimbraUserPasswd = "";
            m_configViewModelUDest.ZimbraSSL = true;

            m_optionsViewModel = new OptionsViewModel();
            m_optionsViewModel.Name = "OptionsViewModel";
            m_optionsViewModel.ViewTitle = "Options";
            m_optionsViewModel.lb = lb;
            m_optionsViewModel.isBrowser = isBrowser;
            m_optionsViewModel.ImportMailOptions = true;
            m_optionsViewModel.ImportTaskOptions = true;
            m_optionsViewModel.ImportCalendarOptions = true;
            m_optionsViewModel.ImportContactOptions = true;
            m_optionsViewModel.ImportRuleOptions = true;
            m_optionsViewModel.ImportOOOOptions = true;
            m_optionsViewModel.ImportJunkOptions = false;
            m_optionsViewModel.ImportDeletedItemOptions = false;
            m_optionsViewModel.ImportSentOptions = false;
            m_optionsViewModel.LoggingVerbose = false;
            m_optionsViewModel.LogLevel = LogLevel.Info.ToString();
            m_optionsViewModel.MaxThreadCount = 0;
            m_optionsViewModel.MaxErrorCount = 0;
            m_optionsViewModel.OEnableRulesAndOOO = true;
            m_optionsViewModel.OEnableNext = true;
            m_optionsViewModel.MigrateONRAfter = (DateTime.Now.AddMonths(-3)).ToShortDateString();
            m_optionsViewModel.IsMaxMessageSize = false;
            m_optionsViewModel.IsSkipPrevMigratedItems = false;
            m_optionsViewModel.MaxMessageSize = "";
            m_optionsViewModel.IsSkipFolders = false;

            m_scheduleViewModel = new ScheduleViewModel();
            m_scheduleViewModel.Name = "Schedule";
            m_scheduleViewModel.ViewTitle = "Migrate";
            m_scheduleViewModel.lb = lb;
            m_scheduleViewModel.isBrowser = isBrowser;
            m_scheduleViewModel.COS = "default";
            m_scheduleViewModel.DefaultPWD = "";
            m_scheduleViewModel.ScheduleDate = DateTime.Now.ToShortDateString();
            m_scheduleViewModel.EnableProvGB = false;

            m_usersViewModel = new UsersViewModel("", "");
            m_usersViewModel.Name = "Users";
            m_usersViewModel.ViewTitle = "Users";
            m_usersViewModel.lb = lb;
            m_usersViewModel.ZimbraDomain = "";
            m_usersViewModel.isBrowser = isBrowser;
            m_usersViewModel.CurrentUserSelection = -1;
            m_usersViewModel.svm = m_scheduleViewModel;  // LDAP Browser needs to get to ScheduleView to set EnableMigrate

            m_resultsViewModel = new AccountResultsViewModel(m_scheduleViewModel, -1, 0, "", "", "",
            0, "", 0, 0, false);
            m_resultsViewModel.Name = "Results";
            m_resultsViewModel.ViewTitle = "Results";
            m_resultsViewModel.isBrowser = isBrowser;
            m_resultsViewModel.CurrentAccountSelection = -1;
            m_resultsViewModel.OpenLogFileEnabled = false;

            SetupViewModelPtrs();

            TheViews = new ObservableCollection<object>();
            TheViews.Add(this);
        }
示例#2
0
        private void ObjectPicker()
        {
            EnablePopButtons = false;

            CSMigrationWrapper mw = ((IntroViewModel)ViewModelPtrs[(int)ViewType.INTRO]).mw;

            string[] users = mw.GetListFromObjectPicker();
            if(users != null)
            {
            // FBS rewrite -- bug 71646 -- 3/26/12
            for (int i = 0; i < users.Length; i++)
            {
            string[] tokens = users[i].Split('~');
            if (tokens.Length < 5)
            {
                MessageBox.Show("Object picker returned insufficient data", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                EnablePopButtons = true;
                return;
            }
            string uname = "", displayname = "", givenname = "", sn = "", zfp = "";
            for (int j = 0; j < tokens.Length; j += 5)
            {
                uname = tokens.GetValue(j).ToString();
                displayname = tokens.GetValue(j + 1).ToString();
                givenname = tokens.GetValue(j + 2).ToString();
                sn = tokens.GetValue(j + 3).ToString();
                zfp = tokens.GetValue(j + 4).ToString();
            }

            if (uname.IndexOf("@") != -1)
            {
                uname = uname.Substring(0, uname.IndexOf("@"));
            }
            UsersViewModel uvm = new UsersViewModel(displayname, uname);
            uvm.AddOPInfo(new ObjectPickerInfo(displayname, givenname, sn, zfp));
            UsersList.Add(uvm);

            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.SchedList.Add(new SchedUser(Username, false));
            scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
            scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
            EnableNext = (UsersList.Count > 0);
            }
            }
            EnablePopButtons = true;
        }
示例#3
0
        private void UserMap()
        {
            ScheduleViewModel scheduleViewModel =
            ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
            bool bCSV = false;

            Microsoft.Win32.OpenFileDialog fDialog = new Microsoft.Win32.OpenFileDialog();
            fDialog.Filter = "User Map Files|*.xml;*.csv";
            fDialog.CheckFileExists = true;
            fDialog.Multiselect = false;
            if (fDialog.ShowDialog() == true)
            {
            int lastDot = fDialog.FileName.LastIndexOf(".");

            if (lastDot != -1)
            {
                string substr = fDialog.FileName.Substring(lastDot, 4);

                if (substr == ".csv")
                {
                    bCSV = true;

                    /*try
                     * {
                     *  string names = File.ReadAllText(fDialog.FileName);
                     *  string[] nameTokens = names.Split(',');
                     *  foreach (string name in nameTokens)
                     *  {
                     *      UsersList.Add(name);
                     *      scheduleViewModel.SchedList.Add(name);
                     *  }
                     * }
                     * catch (IOException ex)
                     * {
                     *  MessageBox.Show(ex.Message, "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                     * }*/
                    List<string[]> parsedData = new List<string[]>();
                    try
                    {
                        if (File.Exists(fDialog.FileName))
                        {
                            using (StreamReader readFile = new StreamReader(fDialog.FileName)) {
                                string line;

                                string[] row;
                                while ((line = readFile.ReadLine()) != null)
                                {
                                    row = line.Split(',');
                                    parsedData.Add(row);
                                }
                                readFile.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show(
                                "There is no user information stored.Please enter some user info",
                                "Zimbra Migration", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                        }
                    }
                    catch (Exception e)
                    {
                        string message = e.Message;
                    }
                    // for (int i = 1; i < parsedData.Count; i++)
                    {
                        string[] strres = new string[parsedData.Count];

                        Users tempuser = new Users();

                        try
                        {
                            for (int j = 0; j < parsedData.Count; j++)
                            {
                                bool bFoundSharp = false;
                                strres = parsedData[j];
                                int num = strres.Count();
                                for (int k = 0; k < num; k++)
                                {
                                    if (strres[k].Contains("#"))
                                    {
                                        bFoundSharp = true;
                                        break;
                                    }
                                }
                                if (!bFoundSharp)   // FBS bug 71933 -- 3/21/12
                                {
                                    tempuser.UserName = strres[0];
                                    tempuser.MappedName = strres[1];

                                    tempuser.ChangePWD = Convert.ToBoolean(strres[2]);
                                    // tempuser.PWDdefault = strres[3];
                                    // string result = tempuser.UserName + "," + tempuser.MappedName +"," + tempuser.ChangePWD + "," + tempuser.PWDdefault;
                                    string result = tempuser.Username + "," + tempuser.MappedName;

                                    Username = strres[0];
                                    MappedName = strres[1];
                                    UsersViewModel uvm = new UsersViewModel(Username, MappedName);
                                    uvm.MustChangePassword = tempuser.ChangePWD;
                                    UsersList.Add(uvm);
                                    scheduleViewModel.SchedList.Add(new SchedUser(Username, false));
                                }
                            }
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Incorrect .csv file format", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }

                        EnableNext = (UsersList.Count > 0);
                    }
                    scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
                    scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;

                    // /
                    // Domain information is stored in the xml and not in  the usermap.
                    // will have to revisit

                    System.Xml.Serialization.XmlSerializer reader =
                        new System.Xml.Serialization.XmlSerializer(typeof (Config));
                    if (File.Exists(scheduleViewModel.GetConfigFile()))
                    {
                        System.IO.StreamReader fileRead = new System.IO.StreamReader(
                            scheduleViewModel.GetConfigFile());

                        Config Z11 = new Config();

                        Z11 = (Config)reader.Deserialize(fileRead);
                        fileRead.Close();
                        ZimbraDomain = Z11.UserProvision.DestinationDomain;
                        if (DomainList.Count > 0)
                            CurrentDomainSelection = (ZimbraDomain == null) ? 0 :
                                DomainList.IndexOf(ZimbraDomain);

                        else
                            DomainList.Add(ZimbraDomain);
                    }
                    scheduleViewModel.SetUsermapFile(fDialog.FileName);
                }
            }
            if (!bCSV)
                MessageBox.Show("Only CSV files are supported", "Zimbra Migration",
                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
示例#4
0
        private void UserMap()
        {
            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
            bool bCSV = false;

            Microsoft.Win32.OpenFileDialog fDialog = new Microsoft.Win32.OpenFileDialog();
            fDialog.Filter          = "User Map Files|*.xml;*.csv";
            fDialog.CheckFileExists = true;
            fDialog.Multiselect     = false;

            // string delimiter = ",";
            // /
            // Domain information is stored in the xml and not in  the usermap.
            // will have to revisit

            System.Xml.Serialization.XmlSerializer reader =
                new System.Xml.Serialization.XmlSerializer(typeof(Config));
            if (File.Exists(scheduleViewModel.GetConfigFile()))
            {
                System.IO.StreamReader fileRead = new System.IO.StreamReader(
                    scheduleViewModel.GetConfigFile());

                Config Z11 = new Config();

                Z11 = (Config)reader.Deserialize(fileRead);
                fileRead.Close();

                CSVDelimiter = Z11.AdvancedImportOptions.CSVDelimiter;
                if (CSVDelimiter == null)
                {
                    CSVDelimiter = ",";
                }

                ZimbraDomain = Z11.UserProvision.DestinationDomain;
                if (DomainList.Count > 0)
                {
                    CurrentDomainSelection = (ZimbraDomain == null) ? 0 :
                                             DomainList.IndexOf(ZimbraDomain);
                }

                else
                {
                    DomainList.Add(ZimbraDomain);
                }
            }
            if (fDialog.ShowDialog() == true)
            {
                int lastDot = fDialog.FileName.LastIndexOf(".");

                if (lastDot != -1)
                {
                    string substr = fDialog.FileName.Substring(lastDot, 4);

                    if (substr == ".csv")
                    {
                        bCSV = true;

                        /*try
                        * {
                        *  string names = File.ReadAllText(fDialog.FileName);
                        *  string[] nameTokens = names.Split(',');
                        *  foreach (string name in nameTokens)
                        *  {
                        *      UsersList.Add(name);
                        *      scheduleViewModel.SchedList.Add(name);
                        *  }
                        * }
                        * catch (IOException ex)
                        * {
                        *  MessageBox.Show(ex.Message, "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        * }*/
                        List <string[]> parsedData = new List <string[]>();
                        try
                        {
                            if (File.Exists(fDialog.FileName))
                            {
                                using (StreamReader readFile = new StreamReader(fDialog.FileName)) {
                                    string line;

                                    string[] row;
                                    while ((line = readFile.ReadLine()) != null)
                                    {
                                        row = line.Split(CSVDelimiter.ToCharArray());
                                        //row = line.Split(',');
                                        parsedData.Add(row);
                                    }
                                    readFile.Close();
                                }
                            }
                            else
                            {
                                MessageBox.Show(
                                    "There is no user information stored.Please enter some user info",
                                    "Zimbra Migration", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                            }
                        }
                        catch (Exception e)
                        {
                            string message = e.Message;
                        }
                        // for (int i = 1; i < parsedData.Count; i++)
                        {
                            string[] strres = new string[parsedData.Count];

                            Users tempuser = new Users();

                            try
                            {
                                for (int j = 0; j < parsedData.Count; j++)
                                {
                                    bool bFoundSharp = false;
                                    strres = parsedData[j];
                                    int num = strres.Count();
                                    for (int k = 0; k < num; k++)
                                    {
                                        if (strres[k].Contains("#"))
                                        {
                                            bFoundSharp = true;
                                            break;
                                        }
                                    }
                                    if (!bFoundSharp) // FBS bug 71933 -- 3/21/12
                                    {
                                        tempuser.UserName   = strres[0];
                                        tempuser.MappedName = strres[1];

                                        tempuser.ChangePWD = Convert.ToBoolean(strres[2]);
                                        // tempuser.PWDdefault = strres[3];
                                        // string result = tempuser.UserName + "," + tempuser.MappedName +"," + tempuser.ChangePWD + "," + tempuser.PWDdefault;
                                        string result = tempuser.Username + CSVDelimiter /*","*/ + tempuser.MappedName;

                                        Username   = strres[0];
                                        MappedName = strres[1];
                                        UsersViewModel uvm = new UsersViewModel(Username, MappedName);
                                        uvm.MustChangePassword = tempuser.ChangePWD;
                                        UsersList.Add(uvm);
                                        scheduleViewModel.SchedList.Add(new SchedUser(Username, false));
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                MessageBox.Show("Incorrect .csv file format", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                                return;
                            }

                            EnableNext = (UsersList.Count > 0);
                        }
                        scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
                        scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;

                        // /
                        // Domain information is stored in the xml and not in  the usermap.
                        // will have to revisit

                        /* System.Xml.Serialization.XmlSerializer reader =
                         *   new System.Xml.Serialization.XmlSerializer(typeof (Config));
                         * if (File.Exists(scheduleViewModel.GetConfigFile()))
                         * {
                         *   System.IO.StreamReader fileRead = new System.IO.StreamReader(
                         *       scheduleViewModel.GetConfigFile());
                         *
                         *   Config Z11 = new Config();
                         *
                         *   Z11 = (Config)reader.Deserialize(fileRead);
                         *   fileRead.Close();
                         * }*/
                        /* {
                         *   ZimbraDomain = Z11.UserProvision.DestinationDomain;
                         *   if (DomainList.Count > 0)
                         *       CurrentDomainSelection = (ZimbraDomain == null) ? 0 :
                         *           DomainList.IndexOf(ZimbraDomain);
                         *
                         *   else
                         *       DomainList.Add(ZimbraDomain);
                         * }*/
                        scheduleViewModel.SetUsermapFile(fDialog.FileName);
                    }
                }
                if (!bCSV)
                {
                    MessageBox.Show("Only CSV files are supported", "Zimbra Migration",
                                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
示例#5
0
        private void Next()
        {
            if (!ValidateUsersList(true))
            {
                return;
            }
            ZimbraAPI zimbraAPI = new ZimbraAPI(isServer);

            if (ZimbraValues.zimbraValues.AuthToken.Length == 0)
            {
                MessageBox.Show("You must log on to the Zimbra server", "Zimbra Migration",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            SaveDomain();

            UsersViewModel usersViewModel =
                ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.EnableProvGB = false;
            for (int i = 0; i < UsersList.Count; i++)
            {
                string userName = (UsersList[i].MappedName.Length > 0) ? UsersList[i].MappedName :
                                  UsersList[i].Username;
                string acctName = userName + '@' + ZimbraDomain;

                if (zimbraAPI.GetAccount(acctName) == 0)
                {
                    UsersList[i].IsProvisioned = true;
                    scheduleViewModel.SchedList[i].isProvisioned = true; // get (SchedList) in schedule view model will set again
                }
                else if (zimbraAPI.LastError.IndexOf("no such account") != -1)
                {
                    UsersList[i].IsProvisioned = false; // get (SchedList) in schedule view model will set again
                    scheduleViewModel.SchedList[i].isProvisioned = false;
                    if (!scheduleViewModel.EnableProvGB)
                    {
                        scheduleViewModel.EnableProvGB = true;
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("Error accessing account {0}: {1}", acctName,
                                                  zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }
            //Logic to get the index of defaulf COS from CosList.
            for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
            {
                if (scheduleViewModel.CosList[i].CosName == "default")
                {
                    ZimbraValues.GetZimbraValues().DefaultCosIndex = i;
                    break;
                }
            }

            foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
            {
                if (domaininfo.DomainName == usersViewModel.DomainList[usersViewModel.CurrentDomainSelection])
                {
                    if (domaininfo.zimbraDomainDefaultCOSId != "")
                    {
                        for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
                        {
                            if (domaininfo.zimbraDomainDefaultCOSId == scheduleViewModel.CosList[i].CosID)
                            {
                                scheduleViewModel.CurrentCOSSelection = i;
                                break;
                            }
                        }
                    }
                    else
                    {
                        scheduleViewModel.CurrentCOSSelection = ZimbraValues.GetZimbraValues().DefaultCosIndex;
                    }
                    break;
                }
            }
            lb.SelectedIndex = 5;
        }
示例#6
0
        private void Next()
        {
            if ((this.ZimbraServerHostName.Length == 0) || (this.ZimbraPort.Length == 0))
            {
                MessageBox.Show("Please fill in the host name and port", "Zimbra Migration",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            ZimbraAPI zimbraAPI = new ZimbraAPI(true);
            int       stat      = -1;

            try
            {
                stat = zimbraAPI.Logon(this.ZimbraServerHostName, this.ZimbraPort, this.ZimbraAdmin,
                                       this.ZimbraAdminPasswd, this.ZimbraSSL, true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Logon", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (stat == 0)
            {
                string authToken = ZimbraValues.GetZimbraValues().AuthToken;

                if (authToken.Length > 0)
                {
                    UsersViewModel usersViewModel =
                        ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
                    ScheduleViewModel scheduleViewModel =
                        ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
                    PublicfoldersViewModel publicfoldersViewModel =
                        ((PublicfoldersViewModel)ViewModelPtrs[(int)ViewType.PUBFLDS]);


                    string currentDomain = (usersViewModel.DomainInfoList.Count > 0) ?
                                           usersViewModel.DomainInfoList[usersViewModel.CurrentDomainSelection].DomainName : "";

                    currentDomain = (publicfoldersViewModel.DomainInfoList.Count > 0) ?
                                    publicfoldersViewModel.DomainInfoList[publicfoldersViewModel.CurrentDomainSelection].DomainName : "";

                    usersViewModel.DomainInfoList.Clear();
                    usersViewModel.DomainList.Clear();
                    publicfoldersViewModel.DomainInfoList.Clear();
                    publicfoldersViewModel.DomainList.Clear();
                    scheduleViewModel.CosList.Clear();

                    zimbraAPI.GetAllDomains();

                    foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
                    {
                        string dName = domaininfo.DomainName;
                        usersViewModel.DomainInfoList.Add(new DomainInfo(domaininfo.DomainName, domaininfo.DomainID, domaininfo.zimbraDomainDefaultCOSId));
                        usersViewModel.DomainList.Add(dName);

                        publicfoldersViewModel.DomainInfoList.Add(new DomainInfo(domaininfo.DomainName, domaininfo.DomainID, domaininfo.zimbraDomainDefaultCOSId));
                        publicfoldersViewModel.DomainList.Add(dName);

                        if (dName == currentDomain)
                        {
                            usersViewModel.CurrentDomainSelection         = usersViewModel.DomainInfoList.Count;
                            publicfoldersViewModel.CurrentDomainSelection = publicfoldersViewModel.DomainInfoList.Count;
                        }
                    }

                    usersViewModel.DomainsFilledIn         = true;
                    publicfoldersViewModel.DomainsFilledIn = true;

                    zimbraAPI.GetAllCos();

                    foreach (CosInfo cosinfo in ZimbraValues.GetZimbraValues().COSes)
                    {
                        scheduleViewModel.CosList.Add(new CosInfo(cosinfo.CosName, cosinfo.CosID));
                    }
                    lb.SelectedIndex = 3;
                }
            }
            else
            {
                MessageBox.Show(string.Format("Logon Unsuccessful: {0}", zimbraAPI.LastError),
                                "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#7
0
        public void SetupViews(bool isBrowser)
        {
            m_isBrowser            = isBrowser;
            BaseViewModel.isServer = true;      // because we start out with Server on -- wouldn't get set by command
            IsServerMigration      = true;
            IsUserMigration        = false;
            savedDomain            = "";
            ZimbraValues.GetZimbraValues().ClientVersion = BuildNum;

            m_configViewModelS                    = new ConfigViewModelS();
            m_configViewModelS.Name               = "ConfigViewModelS";
            m_configViewModelS.ViewTitle          = "Source";
            m_configViewModelS.lb                 = lb;
            m_configViewModelS.isBrowser          = isBrowser;
            m_configViewModelS.OutlookProfile     = "";
            m_configViewModelS.MailServerHostName = "";
            m_configViewModelS.MailServerAdminID  = "";
            m_configViewModelS.MailServerAdminPwd = "";

            m_configViewModelU                = new ConfigViewModelU();
            m_configViewModelU.Name           = "ConfigViewModelU";
            m_configViewModelU.ViewTitle      = "Source";
            m_configViewModelU.lb             = lb;
            m_configViewModelU.isBrowser      = isBrowser;
            m_configViewModelU.OutlookProfile = "";
            m_configViewModelU.PSTFile        = "";
            m_configViewModelU.OutlookProfile = "";

            m_configViewModelSDest                      = new ConfigViewModelSDest();
            m_configViewModelSDest.Name                 = "ConfigViewModelSDest";
            m_configViewModelSDest.ViewTitle            = "Destination";
            m_configViewModelSDest.lb                   = lb;
            m_configViewModelSDest.isBrowser            = isBrowser;
            m_configViewModelSDest.ZimbraServerHostName = "";
            m_configViewModelSDest.ZimbraPort           = "";
            m_configViewModelSDest.ZimbraAdmin          = "";
            m_configViewModelSDest.ZimbraAdminPasswd    = "";
            m_configViewModelSDest.ZimbraSSL            = true;

            m_configViewModelUDest                      = new ConfigViewModelUDest();
            m_configViewModelUDest.Name                 = "ConfigViewModelUDest";
            m_configViewModelUDest.ViewTitle            = "Destination";
            m_configViewModelUDest.lb                   = lb;
            m_configViewModelUDest.isBrowser            = isBrowser;
            m_configViewModelUDest.ZimbraServerHostName = "";
            m_configViewModelUDest.ZimbraPort           = "";
            m_configViewModelUDest.ZimbraUser           = "";
            m_configViewModelUDest.ZimbraUserPasswd     = "";
            m_configViewModelUDest.ZimbraSSL            = true;

            m_optionsViewModel                          = new OptionsViewModel();
            m_optionsViewModel.Name                     = "OptionsViewModel";
            m_optionsViewModel.ViewTitle                = "Options";
            m_optionsViewModel.lb                       = lb;
            m_optionsViewModel.isBrowser                = isBrowser;
            m_optionsViewModel.ImportMailOptions        = true;
            m_optionsViewModel.ImportTaskOptions        = true;
            m_optionsViewModel.ImportCalendarOptions    = true;
            m_optionsViewModel.ImportContactOptions     = true;
            m_optionsViewModel.ImportRuleOptions        = true;
            m_optionsViewModel.ImportOOOOptions         = true;
            m_optionsViewModel.ImportJunkOptions        = false;
            m_optionsViewModel.ImportDeletedItemOptions = false;
            m_optionsViewModel.ImportSentOptions        = false;
            m_optionsViewModel.LoggingVerbose           = false;
            m_optionsViewModel.LogLevel                 = LogLevel.Info.ToString();
            m_optionsViewModel.MaxThreadCount           = 0;
            m_optionsViewModel.MaxErrorCount            = 0;
            m_optionsViewModel.OEnableRulesAndOOO       = true;
            m_optionsViewModel.OEnableNext              = true;
            m_optionsViewModel.MigrateONRAfter          = (DateTime.Now.AddMonths(-3)).ToShortDateString();
            m_optionsViewModel.IsMaxMessageSize         = false;
            m_optionsViewModel.IsSkipPrevMigratedItems  = false;
            m_optionsViewModel.MaxMessageSize           = "";
            m_optionsViewModel.IsSkipFolders            = false;

            m_scheduleViewModel              = new ScheduleViewModel();
            m_scheduleViewModel.Name         = "Schedule";
            m_scheduleViewModel.ViewTitle    = "Migrate";
            m_scheduleViewModel.lb           = lb;
            m_scheduleViewModel.isBrowser    = isBrowser;
            m_scheduleViewModel.COS          = "default";
            m_scheduleViewModel.DefaultPWD   = "";
            m_scheduleViewModel.ScheduleDate = DateTime.Now.ToShortDateString();
            m_scheduleViewModel.EnableProvGB = false;

            m_usersViewModel                      = new UsersViewModel("", "");
            m_usersViewModel.Name                 = "Users";
            m_usersViewModel.ViewTitle            = "Users";
            m_usersViewModel.lb                   = lb;
            m_usersViewModel.ZimbraDomain         = "";
            m_usersViewModel.isBrowser            = isBrowser;
            m_usersViewModel.CurrentUserSelection = -1;
            m_usersViewModel.svm                  = m_scheduleViewModel; // LDAP Browser needs to get to ScheduleView to set EnableMigrate

            m_resultsViewModel = new AccountResultsViewModel(m_scheduleViewModel, -1, 0, "", "", "",
                                                             0, "", 0, 0, false);
            m_resultsViewModel.Name      = "Results";
            m_resultsViewModel.ViewTitle = "Results";
            m_resultsViewModel.isBrowser = isBrowser;
            m_resultsViewModel.CurrentAccountSelection = -1;
            m_resultsViewModel.OpenLogFileEnabled      = false;

            SetupViewModelPtrs();

            TheViews = new ObservableCollection <object>();
            TheViews.Add(this);
        }
示例#8
0
        // Background thread stuff
        private void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            eventArglist.Add(e);

            int num = (int)e.Argument;

            Log.info(" In Do work for threads for user number", num);
            MigrationAccount        MyAcct                  = new MigrationAccount();
            UsersViewModel          usersViewModel          = ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
            AccountResultsViewModel accountResultsViewModel =
                ((AccountResultsViewModel)ViewModelPtrs[(int)ViewType.RESULTS]); // main one
            string accountname = accountResultsViewModel.AccountResultsList[num].AccountName;
            string accountid   = "";

            if (isServer)
            {
                accountname = accountname + "@" + usersViewModel.ZimbraDomain;
                accountid   = usersViewModel.UsersList[num].Username;

                int idx = accountid.IndexOf("@");

                if (idx != -1)                  // domain would be Exchange domain, not Zimbra domain
                {
                    accountid = accountid.Substring(0, idx);
                }
            }
            else
            {
                ConfigViewModelU sourceModel =
                    ((ConfigViewModelU)ViewModelPtrs[(int)ViewType.USRSRC]);
                ConfigViewModelUDest destModel =
                    ((ConfigViewModelUDest)ViewModelPtrs[(int)ViewType.USRDEST]);

                accountname = ZimbraValues.GetZimbraValues().AccountName;//accountname + "@" + destModel.ZimbraServerHostName;
                accountid   = (sourceModel.IspST) ? sourceModel.PSTFile :
                              sourceModel.ProfileList[sourceModel.CurrentProfileSelection];
            }
            MyAcct.AccountName = accountname;
            MyAcct.AccountID   = accountid;
            MyAcct.AccountNum  = num;
            MyAcct.OnChanged  += new MigrationObjectEventHandler(Acct_OnAcctChanged);

            MigrationFolder MyFolder = new MigrationFolder();

            MyFolder.AccountNum = num;
            MyFolder.OnChanged += new MigrationObjectEventHandler(Folder_OnChanged);

            MyAcct.migrationFolder = MyFolder;

            CSMigrationWrapper mw         = ((IntroViewModel)ViewModelPtrs[(int)ViewType.INTRO]).mw;
            MigrationOptions   importOpts = SetOptions();
            bool isVerbose     = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]).LoggingVerbose;
            bool doRulesAndOOO = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]).OEnableRulesAndOOO;


            if (isVerbose)
            {
                if (importOpts.VerboseOn < LogLevel.Debug)
                {
                    importOpts.VerboseOn = LogLevel.Debug;
                }
            }

            Log.info(" start migration for account ", MyAcct.AccountNum);

            //mw.StartMigration(MyAcct, importOpts, isServer, (isVerbose ? (LogLevel.Debug):(LogLevel.Info)), m_isPreview);
            mw.StartMigration(MyAcct, importOpts, isServer, importOpts.VerboseOn, m_isPreview, doRulesAndOOO);



            // special case to format last user progress message
            int count = accountResultsViewModel.AccountResultsList[num].UserResultsList.Count;

            if (count > 0)
            {
                if (!m_isPreview)
                {
                    string lastmsg      = accountResultsViewModel.AccountResultsList[num].UserResultsList[count - 1].UserProgressMsg;
                    int    len          = lastmsg.Length;
                    bool   isOOOorRules = ((MyFolder.FolderView == "OOO") || (MyFolder.FolderView == "All Rules"));
                    accountResultsViewModel.AccountResultsList[num].UserResultsList[count - 1].UserProgressMsg = FormatTheLastMsg(MyFolder, isOOOorRules);
                    accountResultsViewModel.AccountResultsList[num].PBValue = 100; // to make sure
                    if (accountResultsViewModel.AccountResultsList[num].CurrentItemNum != accountResultsViewModel.AccountResultsList[num].TotalItemsToMigrate)
                    {
                        FormatGlobalMsg(accountResultsViewModel.AccountResultsList[num]);
                    }
                }
                else
                { // For preview, take the "foldername (n items)" message we constructed, extract the n, and make "Total n"
                    string msg      = "";
                    string lastmsg  = accountResultsViewModel.AccountResultsList[num].PBMsgValue;
                    int    idxParen = lastmsg.IndexOf("(");
                    int    idxItems = lastmsg.IndexOf("items");
                    if ((idxParen != -1) && (idxItems != -1))
                    {
                        int    numLen = idxItems - idxParen - 2; // for the paren and the space
                        string numStr = lastmsg.Substring(idxParen + 1, numLen);
                        msg = "Total: " + numStr;
                        accountResultsViewModel.AccountResultsList[num].UserResultsList[count - 1].UserProgressMsg = (msg.Length > 0) ? msg : "";
                    }
                }
            }
            /////

            if (!m_isPreview)
            {
                int tnum = GetThreadNum(MyAcct.AccountNum);
                //Log.info(" in worker_RunWorkerCompleted  for ThreadNum : " + tnum);

                if ((!(MyAcct.IsValid)) && (MyAcct.TotalErrors > 0))
                {
                    Log.info(" in DOWORK -- Migration failed for usernum: " + MyAcct.AccountNum + " and threadnum" + tnum);
                    accountResultsViewModel.AccountResultsList[num].PBMsgValue      = "Migration Failed - Invalid account";
                    accountResultsViewModel.AccountResultsList[num].AcctProgressMsg = "Failed";
                }
                else
                {
                    if ((!(MyAcct.IsCompletedMigration)) && (MyAcct.TotalErrors > 0))
                    {
                        Log.info(" in DOWORK -- Migration Incomplete for usernum: " + MyAcct.AccountNum + " and threadnum" + tnum);
                        accountResultsViewModel.AccountResultsList[num].PBMsgValue      = "Migration Incomplete - Please Re-Run Migration";
                        accountResultsViewModel.AccountResultsList[num].AcctProgressMsg = "Incomplete";
                    }
                    else
                    {
                        Log.info(" in DOWORK -- Migration completed for usernum: " + MyAcct.AccountNum + " and threadnum" + tnum);
                        accountResultsViewModel.AccountResultsList[num].PBMsgValue      = "Migration complete";
                        accountResultsViewModel.AccountResultsList[num].AcctProgressMsg = "Complete";
                    }
                }
            }
            else
            {
                string msg = "Total items: {0}";
                accountResultsViewModel.AccountResultsList[num].PBMsgValue = String.Format(msg, accountResultsViewModel.AccountResultsList[num].TotalItemsToMigrate);
            }

            if (importOpts.IsMaintainenceMode)
            {
                accountResultsViewModel.AccountResultsList[num].PBMsgValue      = "Migration Incomplete";
                accountResultsViewModel.AccountResultsList[num].AcctProgressMsg = "InComplete";
            }
        }
示例#9
0
        public void DoMigrate(bool isPreview)
        {
            bgwlist.Clear();
            if (isServer)
            {
                if (CurrentCOSSelection == -1)
                {
                    CurrentCOSSelection = 0;
                }
                UsersViewModel usersViewModel =
                    ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);

                if (ZimbraValues.zimbraValues.AuthToken.Length == 0)
                {
                    MessageBox.Show("You must log on to the Zimbra server", "Zimbra Migration",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                ConfigViewModelS sourceModel =
                    ((ConfigViewModelS)ViewModelPtrs[(int)ViewType.SVRSRC]);

                if (!sourceModel.IsMailServerInitialized)
                {
                    MessageBox.Show("You must log on to Exchange", "Zimbra Migration",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                string          domainName  = usersViewModel.ZimbraDomain;
                string          defaultPWD  = DefaultPWD;
                string          tempMessage = "";
                bool            bProvision  = false;
                MessageBoxImage mbi         = MessageBoxImage.Information;

                for (int i = 0; i < SchedList.Count; i++)
                {
                    string userName = (usersViewModel.UsersList[i].MappedName.Length > 0) ?
                                      usersViewModel.UsersList[i].MappedName :
                                      usersViewModel.UsersList[i].Username;
                    string accountName = userName + "@" + domainName;

                    if (!SchedList[i].isProvisioned)
                    {
                        if (!isPreview)
                        {
                            bProvision = true;
                            if (defaultPWD.Length == 0)
                            {
                                MessageBox.Show("Please provide an initial password",
                                                "Zimbra Migration", MessageBoxButton.OK,
                                                MessageBoxImage.Exclamation);
                                return;
                            }

                            string    cosID     = CosList[CurrentCOSSelection].CosID;
                            ZimbraAPI zimbraAPI = new ZimbraAPI(isServer);

                            // FBS bug 71646 -- 3/26/12
                            string displayName = "";
                            string givenName   = "";
                            string sn          = "";
                            string zfp         = "";

                            // FBS bug 73395 -- 4/25/12
                            ObjectPickerInfo opinfo = usersViewModel.GetOPInfo();
                            if (opinfo.DisplayName.Length > 0)
                            {
                                displayName = opinfo.DisplayName;
                            }
                            if (opinfo.GivenName.Length > 0)
                            {
                                givenName = opinfo.GivenName;
                            }
                            if (opinfo.Sn.Length > 0)
                            {
                                sn = opinfo.Sn;
                            }
                            if (opinfo.Zfp.Length > 0)
                            {
                                zfp = opinfo.Zfp;
                            }
                            // end 73395
                            // end 71646

                            string historyfile = Path.GetTempPath() + accountName.Substring(0, accountName.IndexOf('@')) + "history.log";
                            if (File.Exists(historyfile))
                            {
                                try
                                {
                                    File.Delete(historyfile);
                                }
                                catch (Exception e)
                                {
                                    string msg = "exception in deleteing the Histroy file " + e.Message;
                                    System.Console.WriteLine(msg);
                                }
                            }

                            bool mustChangePW = usersViewModel.UsersList[i].MustChangePassword;
                            if (zimbraAPI.CreateAccount(accountName, displayName, givenName, sn, zfp, defaultPWD, mustChangePW, cosID) == 0)
                            {
                                tempMessage += string.Format("{0} Provisioned", userName) + "\n";
                                // MessageBox.Show(string.Format("{0} Provisioned", userName), "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Information);
                            }
                            else
                            {
                                // MessageBox.Show(string.Format("Provision unsuccessful for {0}: {1}", userName, zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                                tempMessage += string.Format("Provision unsuccessful for {0}: {1}",
                                                             userName, zimbraAPI.LastError) + "\n";
                                mbi = MessageBoxImage.Error;
                            }
                        }
                    }
                }
                if (bProvision)
                {
                    MessageBox.Show(tempMessage, "Zimbra Migration", MessageBoxButton.OK, mbi);
                }
                if (mbi == MessageBoxImage.Error)
                {
                    return;
                }
                lb.SelectedIndex = 6;
            }
            else
            {
                lb.SelectedIndex = 4;
            }

            AccountResultsViewModel accountResultsViewModel =
                ((AccountResultsViewModel)ViewModelPtrs[(int)ViewType.RESULTS]);

            accountResultsViewModel.AccountResultsList.Clear();
            if (isServer)
            {
                EnableMigrate = false;
                EnablePreview = false;
            }
            else
            {
                ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]).OEnableNext = false;
            }
            accountResultsViewModel.EnableStop = !EnableMigrate;

            int num = 0;

            foreach (SchedUser su in SchedList)
            {
                accountResultsViewModel.AccountResultsList.Add(new AccountResultsViewModel(this,
                                                                                           num++, 0, "", "", su.username, 0, "", 0, 0,
                                                                                           accountResultsViewModel.EnableStop));
            }
            accountResultsViewModel.OpenLogFileEnabled = true;

            // FBS bug 71048 -- 4/16/12 -- use the correct number of threads.
            // If MaxThreadCount not specified, default to 4.  If fewer users than MaxThreadCount, numThreads = numUsers
            OptionsViewModel ovm = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]);
            int maxThreads       = (ovm.MaxThreadCount > 0) ? ovm.MaxThreadCount : 4;

            maxThreads = Math.Min(maxThreads, 8); // let's make 8 the limit for now
            int numUsers   = SchedList.Count;
            int numThreads = Math.Min(numUsers, maxThreads);

            for (int i = 0; i < numUsers; i++)
            {
                Log.info("Schedule bachground workers with numusers :" + numUsers + " and maxthreads are :" + numThreads);
                if (i < numThreads)
                {
                    UserBW bgw = new UserBW(i);
                    bgw.DoWork          += new System.ComponentModel.DoWorkEventHandler(worker_DoWork);
                    bgw.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(
                        worker_ProgressChanged);
                    bgw.WorkerReportsProgress      = true;
                    bgw.WorkerSupportsCancellation = true;
                    bgw.RunWorkerCompleted        += new System.ComponentModel.RunWorkerCompletedEventHandler(
                        worker_RunWorkerCompleted);
                    bgw.usernum = i;
                    bgw.RunWorkerAsync(i);
                    bgwlist.Add(bgw);
                    Log.info("Background worker started number :", bgw.threadnum);
                }
                else
                {
                    Log.info("adding user number to overflow list", i);
                    overflowList.Add(i);
                }
            }
            ;
        }
示例#10
0
        public void SetupViews(bool isBrowser)
        {
            using (LogBlock logblock = Log.NotTracing()?null: new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                m_isBrowser = isBrowser;

                BaseViewModel.isServer = true;      // because we start out with Server on -- wouldn't get set by command

                rbServerMigration = true;
                rbUserMigration   = false;

                savedDomain = "";
                ZimbraValues.GetZimbraValues().ClientVersion = BuildNum;

                // ------------------------------------------------------------
                // Source pages
                // ------------------------------------------------------------

                // Server mig version
                m_configViewModelS                    = new ConfigViewModelS();
                m_configViewModelS.Name               = "ConfigViewModelS";
                m_configViewModelS.ViewTitle          = "Source";
                m_configViewModelS.lb                 = lb;
                m_configViewModelS.isBrowser          = isBrowser;
                m_configViewModelS.OutlookProfile     = "";
                m_configViewModelS.MailServerHostName = "";
                m_configViewModelS.MailServerAdminID  = "";
                m_configViewModelS.MailServerAdminPwd = "";

                // User mig version
                m_configViewModelU                = new ConfigViewModelU();
                m_configViewModelU.Name           = "ConfigViewModelU";
                m_configViewModelU.ViewTitle      = "Source";
                m_configViewModelU.lb             = lb;
                m_configViewModelU.isBrowser      = isBrowser;
                m_configViewModelU.OutlookProfile = "";
                m_configViewModelU.PSTFile        = "";
                m_configViewModelU.OutlookProfile = "";

                // ZD mig version
                m_configViewModelZU                = new ConfigViewModelZU();
                m_configViewModelZU.Name           = "ConfigViewModelZU";
                m_configViewModelZU.ViewTitle      = "Source";
                m_configViewModelZU.lb             = lb;
                m_configViewModelZU.isBrowser      = isBrowser;
                m_configViewModelZU.OutlookProfile = "";
                m_configViewModelZU.PSTFile        = "";
                m_configViewModelZU.OutlookProfile = "";


                // ------------------------------------------------------------
                // Destination pages
                // ------------------------------------------------------------

                // Server mig version
                m_configViewModelSDest                      = new ConfigViewModelSDest();
                m_configViewModelSDest.Name                 = "ConfigViewModelSDest";
                m_configViewModelSDest.ViewTitle            = "Destination";
                m_configViewModelSDest.lb                   = lb;
                m_configViewModelSDest.isBrowser            = isBrowser;
                m_configViewModelSDest.ZimbraServerHostName = "";
                m_configViewModelSDest.ZimbraPort           = "";
                m_configViewModelSDest.ZimbraAdmin          = "";
                m_configViewModelSDest.ZimbraAdminPasswd    = "";
                m_configViewModelSDest.ZimbraSSL            = true;

                // User mig version
                m_configViewModelUDest                      = new ConfigViewModelUDest();
                m_configViewModelUDest.Name                 = "ConfigViewModelUDest";
                m_configViewModelUDest.ViewTitle            = "Destination";
                m_configViewModelUDest.lb                   = lb;
                m_configViewModelUDest.isBrowser            = isBrowser;
                m_configViewModelUDest.ZimbraServerHostName = "";
                m_configViewModelUDest.ZimbraPort           = "";
                m_configViewModelUDest.ZimbraUser           = "";
                m_configViewModelUDest.ZimbraUserPasswd     = "";
                m_configViewModelUDest.ZimbraSSL            = true;

                // ZD mig version
                // (No dest page for ZD)

                // ------------------------------------------------------------
                // Option page
                // ------------------------------------------------------------
                m_optionsViewModel                          = new OptionsViewModel();
                m_optionsViewModel.Name                     = "OptionsViewModel";
                m_optionsViewModel.ViewTitle                = "Options";
                m_optionsViewModel.lb                       = lb;
                m_optionsViewModel.isBrowser                = isBrowser;
                m_optionsViewModel.ImportMailOptions        = true;
                m_optionsViewModel.ImportTaskOptions        = true;
                m_optionsViewModel.ImportCalendarOptions    = true;
                m_optionsViewModel.ImportContactOptions     = true;
                m_optionsViewModel.ImportRuleOptions        = true;
                m_optionsViewModel.ImportOOOOptions         = true;
                m_optionsViewModel.ImportJunkOptions        = false;
                m_optionsViewModel.ImportDeletedItemOptions = false;
                m_optionsViewModel.ImportSentOptions        = false;

                m_optionsViewModel.MaxThreadCount          = 0;
                m_optionsViewModel.MaxErrorCount           = 0;
                m_optionsViewModel.OEnableRulesAndOOO      = true;
                m_optionsViewModel.OEnablePF               = true;
                m_optionsViewModel.OEnableNext             = true;
                m_optionsViewModel.MigrateONRAfter         = (DateTime.Now.AddMonths(-3)).ToShortDateString();
                m_optionsViewModel.IsMaxMessageSize        = false;
                m_optionsViewModel.IsSkipPrevMigratedItems = false;
                m_optionsViewModel.MaxMessageSize          = "";
                m_optionsViewModel.IsSkipFolders           = false;

                // ------------------------------------------------------------
                // Scedule page
                // ------------------------------------------------------------
                m_scheduleViewModel              = new ScheduleViewModel();
                m_scheduleViewModel.Name         = "Schedule";
                m_scheduleViewModel.ViewTitle    = "Migrate";
                m_scheduleViewModel.lb           = lb;
                m_scheduleViewModel.isBrowser    = isBrowser;
                m_scheduleViewModel.COS          = "default";
                m_scheduleViewModel.DefaultPWD   = "";
                m_scheduleViewModel.ScheduleDate = DateTime.Now.ToShortDateString();
                m_scheduleViewModel.EnableProvGB = false;

                // ------------------------------------------------------------
                // Users page
                // ------------------------------------------------------------
                m_usersViewModel                      = new UsersViewModel("", "");
                m_usersViewModel.Name                 = "Users";
                m_usersViewModel.ViewTitle            = "Users";
                m_usersViewModel.lb                   = lb;
                m_usersViewModel.ZimbraDomain         = "";
                m_usersViewModel.isBrowser            = isBrowser;
                m_usersViewModel.CurrentUserSelection = -1;
                m_usersViewModel.svm                  = m_scheduleViewModel;    // LDAP Browser needs to get to ScheduleView to set EnableMigrate

                // ------------------------------------------------------------
                // Public folders page
                // ------------------------------------------------------------
                m_publicfoldersViewModel              = new PublicfoldersViewModel("", "");
                m_publicfoldersViewModel.Name         = "PublicFolders";
                m_publicfoldersViewModel.ViewTitle    = "Public Folders";
                m_publicfoldersViewModel.lb           = lb;
                m_publicfoldersViewModel.ZimbraDomain = "";
                m_publicfoldersViewModel.isBrowser    = isBrowser;
                m_publicfoldersViewModel.svm          = m_scheduleViewModel;    // LDAP Browser needs to get to ScheduleView to set EnableMigrate

                // ------------------------------------------------------------
                // Results page
                // ------------------------------------------------------------
                m_resultsViewModel           = new AccountResultsViewModel(m_scheduleViewModel, -1, "", false);
                m_resultsViewModel.Name      = "Results";
                m_resultsViewModel.ViewTitle = "Results";
                m_resultsViewModel.isBrowser = isBrowser;
                m_resultsViewModel.CurrentAccountSelection = -1;
                m_resultsViewModel.OpenLogFileEnabled      = false;

                SetupViewModelPtrs();

                TheViews = new ObservableCollection <object>();
                TheViews.Add(this);
            }
        }