From 419245627031617d8a1827d055e436ea510af7fd Mon Sep 17 00:00:00 2001 From: VoosW Date: Tue, 15 Jan 2013 19:03:41 +0100 Subject: [PATCH 1/6] fix csv-import: needs mailboxplan --- .../ExchangeImport.cs | 55 +++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs b/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs index ac586b4b..77c16c9c 100644 --- a/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs +++ b/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs @@ -92,7 +92,10 @@ namespace WebsitePanel.Import.CsvBulk private int PagerIndex = -1; private int WebPageIndex = -1; private int NotesIndex = -1; + private int PlanIndex = -1; + private int defaultPlanId = -1; + private Dictionary planName2Id = new Dictionary(); public ExchangeImport() { @@ -184,6 +187,8 @@ namespace WebsitePanel.Import.CsvBulk } index = 0; + GetMailboxPlans(orgId); + using (StreamReader sr = new StreamReader(inputFile)) { string line; @@ -210,6 +215,22 @@ namespace WebsitePanel.Import.CsvBulk } } + private void GetMailboxPlans(int orgId) + { + ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(orgId); + foreach (ExchangeMailboxPlan plan in plans) + { + if (!planName2Id.ContainsKey(plan.MailboxPlan)) + { + planName2Id.Add(plan.MailboxPlan, plan.MailboxPlanId); + } + if (plan.IsDefault) + { + defaultPlanId = plan.MailboxPlanId; + } + } + } + private void ShowSummary() { Log.WriteLine(string.Format("{0} line(s) processed", index)); @@ -286,7 +307,9 @@ namespace WebsitePanel.Import.CsvBulk WebPageIndex = i; else if (StringEquals(cells[i], "Notes")) NotesIndex = i; - } + else if (StringEquals(cells[i], "Mailbox Plan")) + PlanIndex = i; + } return true; } //check csv structure @@ -430,6 +453,29 @@ namespace WebsitePanel.Import.CsvBulk string webPage = cells[WebPageIndex]; string notes = cells[NotesIndex]; + int planId; + // do we have plan-column? + if (PlanIndex > -1) + { + string planName = cells[PlanIndex]; + if (!planName2Id.TryGetValue(planName, out planId)) + { + Log.WriteInfo(String.Format("Warning at line {0}: Plan named {1} does not exist!", index + 1, planName)); + // fall back to default plan + planId = defaultPlanId; + } + } + // or not? + else + { + // fall back to default plan + planId = defaultPlanId; + } + if (planId < 0) + { + Log.WriteError(string.Format("Error at line {0}: No valid plan name and/or no valid default plan", index + 1)); + return false; + } @@ -480,7 +526,7 @@ namespace WebsitePanel.Import.CsvBulk //create mailbox using web service if (!CreateMailbox(index, orgId, displayName, emailAddress, password, firstName, middleName, lastName, address, city, state, zip, country, jobTitle, company, department, office, - businessPhone, fax, homePhone, mobilePhone, pager, webPage, notes)) + businessPhone, fax, homePhone, mobilePhone, pager, webPage, notes, planId)) { return false; } @@ -517,7 +563,7 @@ namespace WebsitePanel.Import.CsvBulk /// private bool CreateMailbox(int index, int orgId, string displayName, string emailAddress, string password, string firstName, string middleName, string lastName, string address, string city, string state, string zip, string country, string jobTitle, string company, string department, string office, - string businessPhone, string fax, string homePhone, string mobilePhone, string pager, string webPage, string notes) + string businessPhone, string fax, string homePhone, string mobilePhone, string pager, string webPage, string notes, int planId) { bool ret = false; try @@ -528,7 +574,7 @@ namespace WebsitePanel.Import.CsvBulk //create mailbox //ES.Services.ExchangeServer. string accountName = string.Empty; - int accountId = ES.Services.ExchangeServer.CreateMailbox(orgId, 0, ExchangeAccountType.Mailbox, accountName, displayName, name, domain, password, false, string.Empty, 0, string.Empty); + int accountId = ES.Services.ExchangeServer.CreateMailbox(orgId, 0, ExchangeAccountType.Mailbox, accountName, displayName, name, domain, password, false, string.Empty, planId, string.Empty); if (accountId < 0) { string errorMessage = GetErrorMessage(accountId); @@ -557,7 +603,6 @@ namespace WebsitePanel.Import.CsvBulk mailbox.WebPage = webPage; mailbox.Notes = notes; - //update mailbox /* ES.Services.ExchangeServer.SetMailboxGeneralSettings(orgId, accountId, mailbox.DisplayName, From 50d22d2dee85e203c2d91e2add8eff1607ab4fe5 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 23 Jan 2013 16:12:13 -0500 Subject: [PATCH 2/6] Fix for "Object reference error" with WebSitesHeliconApe --- .../WebSitesHeliconApeControl.ascx.cs | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesHeliconApeControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesHeliconApeControl.ascx.cs index d56ffa5f..ede3f300 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesHeliconApeControl.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesHeliconApeControl.ascx.cs @@ -53,7 +53,20 @@ namespace WebsitePanel.Portal private HeliconApeStatus HeliconApeStatus { - get { return (HeliconApeStatus)ViewState["HeliconApeStatus"]; } + get + { + if (null == ViewState["HeliconApeStatus"]) + { + HeliconApeStatus nullstatus = new HeliconApeStatus(); + return nullstatus; + } + else + { + return (HeliconApeStatus)ViewState["HeliconApeStatus"]; + } + + + } set { ViewState["HeliconApeStatus"] = value; } } @@ -91,17 +104,23 @@ namespace WebsitePanel.Portal // Render a warning message about the automatic site's settings change - if (!HeliconApeStatus.IsEnabled && site.IIs7) + if (site.IIs7) { - // Ensure the message is displayed only when neccessary - if (site.EnableWindowsAuthentication || !site.AspNetInstalled.EndsWith("I") || site.SecuredFoldersInstalled) + if (!HeliconApeStatus.IsEnabled) { - // TODO: show warning, do not force to enable integrated pool - string warningStr = GetLocalizedString("EnableFoldersIIs7Warning.Text"); - // Render a warning only if specified - if (!String.IsNullOrEmpty(warningStr)) - btnToggleHeliconApe.OnClientClick = String.Format("return confirm('{0}')", warningStr); + // Ensure the message is displayed only when neccessary + if (site.EnableWindowsAuthentication || !site.AspNetInstalled.EndsWith("I") || site.SecuredFoldersInstalled) + { + // TODO: show warning, do not force to enable integrated pool + string warningStr = GetLocalizedString("EnableFoldersIIs7Warning.Text"); + // Render a warning only if specified + if (!String.IsNullOrEmpty(warningStr)) + btnToggleHeliconApe.OnClientClick = String.Format("return confirm('{0}')", warningStr); + } + + } + } // toggle ToggleControls(); From e088ad4e903be282366f796e10d8262acaf1fd60 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 23 Jan 2013 16:22:08 -0500 Subject: [PATCH 3/6] Added tag build-2.1.0.24 for changeset 6451e1b56cfe From 8e5d762e44e93920695ee87c3dcf2197bd2c92c6 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 23 Jan 2013 16:45:49 -0500 Subject: [PATCH 4/6] Added tag build-2.1.0.27 for changeset 93f8120c5c80 From 5ea3fbb019c83e2e438d8d82dc658c340f0badc4 Mon Sep 17 00:00:00 2001 From: VoosW Date: Thu, 24 Jan 2013 17:42:51 +0100 Subject: [PATCH 5/6] fixed csv-import - set user properties after creation --- .../ExchangeImport.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs b/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs index 77c16c9c..00c22ee4 100644 --- a/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs +++ b/WebsitePanel/Sources/Tools/WebsitePanel.Import.CsvBulk/ExchangeImport.cs @@ -581,7 +581,8 @@ namespace WebsitePanel.Import.CsvBulk Log.WriteError(string.Format("Error at line {0}: {1}", index + 1, errorMessage)); return false; } - ExchangeMailbox mailbox = ES.Services.ExchangeServer.GetMailboxGeneralSettings(orgId, accountId); + //ExchangeMailbox mailbox = ES.Services.ExchangeServer.GetMailboxGeneralSettings(orgId, accountId); + OrganizationUser mailbox = ES.Services.Organizations.GetUserGeneralSettings(orgId, accountId); mailbox.FirstName = firstName; mailbox.Initials = middleName; @@ -611,7 +612,14 @@ namespace WebsitePanel.Import.CsvBulk mailbox.JobTitle, mailbox.Company, mailbox.Department, mailbox.Office, null, mailbox.BusinessPhone, mailbox.Fax, mailbox.HomePhone, mailbox.MobilePhone, mailbox.Pager, mailbox.WebPage, mailbox.Notes); */ - ret = true; + ES.Services.Organizations.SetUserGeneralSettings(orgId, accountId, mailbox.DisplayName, + null, /*mailbox.HideFromAddressBook*/ false, mailbox.Disabled, mailbox.Locked, mailbox.FirstName, mailbox.Initials, + mailbox.LastName, mailbox.Address, mailbox.City, mailbox.State, mailbox.Zip, mailbox.Country, + mailbox.JobTitle, mailbox.Company, mailbox.Department, mailbox.Office, null, mailbox.BusinessPhone, + mailbox.Fax, mailbox.HomePhone, mailbox.MobilePhone, mailbox.Pager, mailbox.WebPage, mailbox.Notes, + // these are new and not in csv ... + mailbox.ExternalEmail, mailbox.SubscriberNumber); + ret = true; } catch (Exception ex) { @@ -750,13 +758,11 @@ namespace WebsitePanel.Import.CsvBulk user.Notes = notes; //update - /* ES.Services.Organizations.SetUserGeneralSettings(orgId, accountId, user.DisplayName, null, false, user.Disabled, user.Locked, user.FirstName, user.Initials, user.LastName, user.Address, user.City, user.State, user.Zip, user.Country, user.JobTitle, user.Company, user.Department, user.Office, null, user.BusinessPhone, - user.Fax, user.HomePhone, user.MobilePhone, user.Pager, user.WebPage, user.Notes, user.ExternalEmail); - */ + user.Fax, user.HomePhone, user.MobilePhone, user.Pager, user.WebPage, user.Notes, user.ExternalEmail, user.SubscriberNumber); ret = true; } catch (Exception ex) From d1a8c87ebef01debfaa36e85f2dc6a856236cc7e Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Thu, 24 Jan 2013 22:48:24 -0500 Subject: [PATCH 6/6] Added tag build-2.1.0.28 for changeset c274118ae8d0