This commit is contained in:
Virtuworks 2012-11-24 13:49:19 -05:00
commit 535b3c7cd1
7 changed files with 87 additions and 61 deletions

View file

@ -767,7 +767,7 @@ namespace WebsitePanel.EnterpriseServer
// load account // load account
ExchangeAccount account = GetAccount(itemId, accountId); ExchangeAccount account = GetAccount(itemId, accountId);
return exchange.GetMailboxStatistics(account.AccountName); return exchange.GetMailboxStatistics(account.UserPrincipalName);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1241,6 +1241,9 @@ namespace WebsitePanel.EnterpriseServer
string CounterStr = "00000"; string CounterStr = "00000";
int counter = 0; int counter = 0;
bool bFound = false; bool bFound = false;
if (!AccountExists(accountName)) return accountName;
do do
{ {
accountName = genSamLogin(name, CounterStr); accountName = genSamLogin(name, CounterStr);
@ -1819,7 +1822,7 @@ namespace WebsitePanel.EnterpriseServer
// delete mailbox // delete mailbox
int serviceExchangeId = GetExchangeServiceID(org.PackageId); int serviceExchangeId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId);
exchange.DisableMailbox(account.AccountName); exchange.DisableMailbox(account.UserPrincipalName);
account.AccountType = ExchangeAccountType.User; account.AccountType = ExchangeAccountType.User;
account.MailEnabledPublicFolder = false; account.MailEnabledPublicFolder = false;
@ -1869,7 +1872,7 @@ namespace WebsitePanel.EnterpriseServer
// delete mailbox // delete mailbox
int serviceExchangeId = GetExchangeServiceID(org.PackageId); int serviceExchangeId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId);
exchange.DeleteMailbox(account.AccountName); exchange.DeleteMailbox(account.UserPrincipalName);
@ -1944,7 +1947,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
return exchange.GetMailboxGeneralSettings(account.AccountName); return exchange.GetMailboxGeneralSettings(account.UserPrincipalName);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1991,7 +1994,7 @@ namespace WebsitePanel.EnterpriseServer
hideAddressBook = true; hideAddressBook = true;
exchange.SetMailboxGeneralSettings( exchange.SetMailboxGeneralSettings(
account.AccountName, account.UserPrincipalName,
hideAddressBook, hideAddressBook,
disabled); disabled);
@ -2063,7 +2066,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxEmailAddresses( exchange.SetMailboxEmailAddresses(
account.AccountName, account.UserPrincipalName,
GetAccountSimpleEmailAddresses(itemId, accountId)); GetAccountSimpleEmailAddresses(itemId, accountId));
return 0; return 0;
@ -2119,7 +2122,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxPrimaryEmailAddress( exchange.SetMailboxPrimaryEmailAddress(
account.AccountName, account.UserPrincipalName,
emailAddress); emailAddress);
if (DataProvider.CheckOCSUserExists(account.AccountId)) if (DataProvider.CheckOCSUserExists(account.AccountId))
@ -2187,7 +2190,7 @@ namespace WebsitePanel.EnterpriseServer
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxEmailAddresses( exchange.SetMailboxEmailAddresses(
account.AccountName, account.UserPrincipalName,
GetAccountSimpleEmailAddresses(itemId, accountId)); GetAccountSimpleEmailAddresses(itemId, accountId));
return 0; return 0;
@ -2228,7 +2231,7 @@ namespace WebsitePanel.EnterpriseServer
// get mailbox settings // get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailbox mailbox = exchange.GetMailboxMailFlowSettings(account.AccountName); ExchangeMailbox mailbox = exchange.GetMailboxMailFlowSettings(account.UserPrincipalName);
mailbox.DisplayName = account.DisplayName; mailbox.DisplayName = account.DisplayName;
return mailbox; return mailbox;
} }
@ -2273,7 +2276,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxMailFlowSettings(account.AccountName, exchange.SetMailboxMailFlowSettings(account.UserPrincipalName,
enableForwarding, enableForwarding,
forwardingAccountName, forwardingAccountName,
forwardToBoth, forwardToBoth,
@ -2321,7 +2324,7 @@ namespace WebsitePanel.EnterpriseServer
// get mailbox settings // get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailbox mailbox = exchange.GetMailboxAdvancedSettings(account.AccountName); ExchangeMailbox mailbox = exchange.GetMailboxAdvancedSettings(account.UserPrincipalName);
mailbox.DisplayName = account.DisplayName; mailbox.DisplayName = account.DisplayName;
return mailbox; return mailbox;
} }
@ -2529,7 +2532,7 @@ namespace WebsitePanel.EnterpriseServer
// get mailbox settings // get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailbox mailbox = exchange.GetMailboxPermissions(org.OrganizationId, account.AccountName); ExchangeMailbox mailbox = exchange.GetMailboxPermissions(org.OrganizationId, account.UserPrincipalName);
mailbox.DisplayName = account.DisplayName; mailbox.DisplayName = account.DisplayName;
return mailbox; return mailbox;
} }
@ -2571,7 +2574,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetMailboxPermissions(org.OrganizationId, account.AccountName, sendAsaccounts, fullAccessAcounts); exchange.SetMailboxPermissions(org.OrganizationId, account.UserPrincipalName, sendAsaccounts, fullAccessAcounts);
return 0; return 0;
@ -2656,7 +2659,7 @@ namespace WebsitePanel.EnterpriseServer
exchange.SetMailboxAdvancedSettings( exchange.SetMailboxAdvancedSettings(
org.OrganizationId, org.OrganizationId,
account.AccountName, account.UserPrincipalName,
plan.EnablePOP, plan.EnablePOP,
plan.EnableIMAP, plan.EnableIMAP,
plan.EnableOWA, plan.EnableOWA,
@ -4763,7 +4766,7 @@ namespace WebsitePanel.EnterpriseServer
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
return exchange.GetMobileDevices(account.AccountName); return exchange.GetMobileDevices(account.UserPrincipalName);
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -249,7 +249,7 @@ namespace WebsitePanel.EnterpriseServer
OrganizationResult serverRes = OrganizationResult serverRes =
crm.CreateOrganization(orgId, org.OrganizationId, org.Name, baseCurrencyCode, baseCurrencyName, crm.CreateOrganization(orgId, org.OrganizationId, org.Name, baseCurrencyCode, baseCurrencyName,
baseCurrencySymbol, user.AccountName, user.FirstName, user.LastName, user.PrimaryEmailAddress, baseCurrencySymbol, user.SamAccountName, user.FirstName, user.LastName, user.PrimaryEmailAddress,
collation); collation);
if (!serverRes.IsSuccess) if (!serverRes.IsSuccess)

View file

@ -1336,11 +1336,11 @@ namespace WebsitePanel.EnterpriseServer
if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled) == 0) if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled) == 0)
{ {
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(upn, org.OrganizationId); accountName = sAMAccountName;
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(sAMAccountName, org.OrganizationId);
TaskManager.Write("sAMAccountName :" + retUser.DomainUserName); TaskManager.Write("sAMAccountName :" + retUser.DomainUserName);
userId = AddOrganizationUser(itemId, upn, displayName, email, retUser.DomainUserName, password, subscriberNumber); userId = AddOrganizationUser(itemId, sAMAccountName, displayName, email, retUser.DomainUserName, password, subscriberNumber);
accountName = upn;
// register email address // register email address
AddAccountEmailAddress(userId, email); AddAccountEmailAddress(userId, email);
@ -1432,7 +1432,7 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.Write("sAMAccountName :" + retUser.DomainUserName); TaskManager.Write("sAMAccountName :" + retUser.DomainUserName);
userId = AddOrganizationUser(itemId, accountName, displayName, email, retUser.DomainUserName, password, subscriberNumber); userId = AddOrganizationUser(itemId, retUser.SamAccountName, displayName, email, retUser.DomainUserName, password, subscriberNumber);
AddAccountEmailAddress(userId, email); AddAccountEmailAddress(userId, email);
@ -1461,6 +1461,9 @@ namespace WebsitePanel.EnterpriseServer
string CounterStr = "00000"; string CounterStr = "00000";
int counter = 0; int counter = 0;
bool bFound = false; bool bFound = false;
if (!AccountExists(accountName)) return accountName;
do do
{ {
accountName = genSamLogin(name, CounterStr); accountName = genSamLogin(name, CounterStr);

View file

@ -444,12 +444,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
try try
{ {
stats = exchange.GetMailboxStatistics(mailbox.AccountName); stats = exchange.GetMailboxStatistics(mailbox.UserPrincipalName);
} }
catch (Exception ex) catch (Exception ex)
{ {
TaskManager.WriteError(ex, "Could not get mailbox statistics. AccountName: {0}", TaskManager.WriteError(ex, "Could not get mailbox statistics. AccountName: {0}",
mailbox.AccountName); mailbox.UserPrincipalName);
} }

View file

@ -371,7 +371,7 @@ namespace WebsitePanel.Providers.HostedSolution
userPath = GetUserPath(organizationId, loginName); userPath = GetUserPath(organizationId, loginName);
if (!ActiveDirectoryUtils.AdObjectExists(userPath)) if (!ActiveDirectoryUtils.AdObjectExists(userPath))
{ {
userPath = ActiveDirectoryUtils.CreateUser(path, upn, loginName, displayName, password, enabled); userPath = ActiveDirectoryUtils.CreateUser(path, null, loginName, displayName, password, enabled);
DirectoryEntry entry = new DirectoryEntry(userPath); DirectoryEntry entry = new DirectoryEntry(userPath);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.UserPrincipalName, upn); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.UserPrincipalName, upn);
entry.CommitChanges(); entry.CommitChanges();

View file

@ -78,8 +78,17 @@
</td> </td>
</tr> </tr>
</table> </table>
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locNotes" runat="server" meta:resourcekey="locNotes" Text="Notes:"></asp:Localize></td>
<td>
<asp:TextBox ID="txtNotes" runat="server" CssClass="TextBox200" Rows="4" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
<wsp:CollapsiblePanel id="secCompanyInfo" runat="server" <wsp:CollapsiblePanel id="secCompanyInfo" runat="server" IsCollapsed="true"
TargetControlID="CompanyInfo" meta:resourcekey="secCompanyInfo" Text="Company Information"> TargetControlID="CompanyInfo" meta:resourcekey="secCompanyInfo" Text="Company Information">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>
<asp:Panel ID="CompanyInfo" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="CompanyInfo" runat="server" Height="0" style="overflow:hidden;">
@ -121,7 +130,7 @@
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secContactInfo" runat="server" <wsp:CollapsiblePanel id="secContactInfo" runat="server" IsCollapsed="true"
TargetControlID="ContactInfo" meta:resourcekey="secContactInfo" Text="Contact Information"> TargetControlID="ContactInfo" meta:resourcekey="secContactInfo" Text="Contact Information">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>
<asp:Panel ID="ContactInfo" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="ContactInfo" runat="server" Height="0" style="overflow:hidden;">
@ -165,7 +174,7 @@
</table> </table>
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secAddressInfo" runat="server" <wsp:CollapsiblePanel id="secAddressInfo" runat="server" IsCollapsed="true"
TargetControlID="AddressInfo" meta:resourcekey="secAddressInfo" Text="Address"> TargetControlID="AddressInfo" meta:resourcekey="secAddressInfo" Text="Address">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>
<asp:Panel ID="AddressInfo" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="AddressInfo" runat="server" Height="0" style="overflow:hidden;">
@ -204,14 +213,6 @@
</table> </table>
</asp:Panel> </asp:Panel>
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locNotes" runat="server" meta:resourcekey="locNotes" Text="Notes:"></asp:Localize></td>
<td>
<asp:TextBox ID="txtNotes" runat="server" CssClass="TextBox200" Rows="4" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
<div class="FormFooterClean"> <div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave" ValidationGroup="EditContact" OnClick="btnSave_Click"></asp:Button> <asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave" ValidationGroup="EditContact" OnClick="btnSave_Click"></asp:Button>

View file

@ -1,3 +1,31 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -228,6 +256,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLastName; protected global::System.Web.UI.WebControls.TextBox txtLastName;
/// <summary>
/// locNotes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locNotes;
/// <summary>
/// txtNotes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNotes;
/// <summary> /// <summary>
/// secCompanyInfo control. /// secCompanyInfo control.
/// </summary> /// </summary>
@ -570,24 +616,6 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.CountrySelector country; protected global::WebsitePanel.Portal.ExchangeServer.UserControls.CountrySelector country;
/// <summary>
/// locNotes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locNotes;
/// <summary>
/// txtNotes control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNotes;
/// <summary> /// <summary>
/// btnSave control. /// btnSave control.
/// </summary> /// </summary>
@ -605,14 +633,5 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
/// <summary>
/// FormComments control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize FormComments;
} }
} }