public static int UpdateExchangeMailboxPlan(int itemID, ExchangeMailboxPlan mailboxPlan) { // place log record TaskManager.StartTask("EXCHANGE", "UPDATE_EXCHANGE_MAILBOXPLAN", mailboxPlan.MailboxPlan, itemID); try { // Log Extension LogExtension.WriteObject(mailboxPlan); ExchangeMailboxPlan oldMailboxPlan = null; try { oldMailboxPlan = ObjectUtils.Clone(mailboxPlan); } catch (Exception ex) { TaskManager.Write("Can't clone mailbox: " + ex.Message); } Organization org = GetOrganization(itemID); if (org == null) return -1; // load package context PackageContext cntx = PackageController.GetPackageContext(org.PackageId); if (org.PackageId > 1) { mailboxPlan.EnableActiveSync = mailboxPlan.EnableActiveSync & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ACTIVESYNCALLOWED].QuotaAllocatedValue); mailboxPlan.EnableIMAP = mailboxPlan.EnableIMAP & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_IMAPALLOWED].QuotaAllocatedValue); mailboxPlan.EnableMAPI = mailboxPlan.EnableMAPI & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_MAPIALLOWED].QuotaAllocatedValue); mailboxPlan.EnableOWA = mailboxPlan.EnableOWA & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_OWAALLOWED].QuotaAllocatedValue); mailboxPlan.EnablePOP = mailboxPlan.EnablePOP & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_POP3ALLOWED].QuotaAllocatedValue); if (cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue != -1) if (mailboxPlan.KeepDeletedItemsDays > cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue) mailboxPlan.KeepDeletedItemsDays = cntx.Quotas[Quotas.EXCHANGE2007_KEEPDELETEDITEMSDAYS].QuotaAllocatedValue; if (cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValuePerOrganization != -1) if (mailboxPlan.MailboxSizeMB > cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValuePerOrganization) mailboxPlan.MailboxSizeMB = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValuePerOrganization; if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue != -1) if (mailboxPlan.MaxReceiveMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue) mailboxPlan.MaxReceiveMessageSizeKB = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECEIVEMESSAGESIZEKB].QuotaAllocatedValue; if (cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue != -1) if (mailboxPlan.MaxSendMessageSizeKB > cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue) mailboxPlan.MaxSendMessageSizeKB = cntx.Quotas[Quotas.EXCHANGE2007_MAXSENDMESSAGESIZEKB].QuotaAllocatedValue; if (cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue != -1) if (mailboxPlan.MaxRecipients > cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue) mailboxPlan.MaxRecipients = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue; if (Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue)) mailboxPlan.HideFromAddressBook = true; mailboxPlan.AllowLitigationHold = mailboxPlan.AllowLitigationHold & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD].QuotaAllocatedValue); if (cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValuePerOrganization != -1) if (mailboxPlan.RecoverableItemsSpace > cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValuePerOrganization) mailboxPlan.RecoverableItemsSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValuePerOrganization; } DataProvider.UpdateExchangeMailboxPlan(mailboxPlan.MailboxPlanId, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP, mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients, mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType, mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct, mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg, mailboxPlan.Archiving, mailboxPlan.EnableArchiving, mailboxPlan.ArchiveSizeMB, mailboxPlan.ArchiveWarningPct, mailboxPlan.EnableForceArchiveDeletion); // Log Extension LogExtension.LogPropertiesIfChanged(oldMailboxPlan, mailboxPlan); } catch (Exception ex) { throw TaskManager.WriteError(ex); } finally { TaskManager.CompleteTask(); } return 0; }
/// <remarks/> public void UpdateExchangeMailboxPlanAsync(int itemId, ExchangeMailboxPlan mailboxPlan) { this.UpdateExchangeMailboxPlanAsync(itemId, mailboxPlan, null); }
private bool PlanExists(ExchangeMailboxPlan plan, ExchangeMailboxPlan[] plans) { bool result = false; foreach (ExchangeMailboxPlan p in plans) { if (p.MailboxPlan.ToLower() == plan.MailboxPlan.ToLower()) { result = true; break; } } return result; }
/// <remarks/> public System.IAsyncResult BeginUpdateExchangeMailboxPlan(int itemId, ExchangeMailboxPlan mailboxPlan, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdateExchangeMailboxPlan", new object[] { itemId, mailboxPlan}, callback, asyncState); }
public int UpdateExchangeMailboxPlan(int itemId, ExchangeMailboxPlan mailboxPlan) { object[] results = this.Invoke("UpdateExchangeMailboxPlan", new object[] { itemId, mailboxPlan}); return ((int)(results[0])); }
/// <remarks/> public void AddExchangeMailboxPlanAsync(int itemId, ExchangeMailboxPlan mailboxPlan, object userState) { if ((this.AddExchangeMailboxPlanOperationCompleted == null)) { this.AddExchangeMailboxPlanOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddExchangeMailboxPlanOperationCompleted); } this.InvokeAsync("AddExchangeMailboxPlan", new object[] { itemId, mailboxPlan}, this.AddExchangeMailboxPlanOperationCompleted, userState); }
/// <remarks/> public void AddExchangeMailboxPlanAsync(int itemId, ExchangeMailboxPlan mailboxPlan) { this.AddExchangeMailboxPlanAsync(itemId, mailboxPlan, null); }
public int UpdateExchangeMailboxPlan(int itemId, ExchangeMailboxPlan mailboxPlan) { return ExchangeServerController.UpdateExchangeMailboxPlan(itemId, mailboxPlan); }