Example #1
0
        private List <ExchangeAccount> GetMailboxFolderPermissions(Runspace runSpace, string organizationId, string folderPath)
        {
            Command cmd = new Command("Get-MailboxFolderPermission");

            cmd.Parameters.Add("Identity", folderPath);
            Collection <PSObject> results = ExecuteShellCommand(runSpace, cmd);

            List <ExchangeAccount> accounts = new List <ExchangeAccount>();

            foreach (PSObject current in results)
            {
                string user = GetPSObjectProperty(current, "User").ToString();

                var accessRights = GetPSObjectProperty(current, "AccessRights") as IEnumerable;

                if (accessRights == null)
                {
                    continue;
                }

                ExchangeAccount account = GetOrganizationAccount(runSpace, organizationId, user);

                if (account != null)
                {
                    account.PublicFolderPermission = accessRights.Cast <object>().First().ToString();
                    accounts.Add(account);
                }
            }

            return(accounts);
        }
        public void AddMailboxFolderPermission(string folderPath, ExchangeAccount account)
        {
            TransactionAction action = new TransactionAction();

            action.ActionType      = TransactionAction.TransactionActionTypes.AddMailboxFolderPermission;
            action.Id              = folderPath;
            action.ExchangeAccount = account;
            Actions.Add(action);
        }
		public void SetAccounts(ExchangeAccount[] accounts)
		{
			acceptAccounts.SetAccounts(accounts);

			rblAcceptMessages.SelectedIndex = 1;
			if (accounts == null || accounts.Length == 0)
				rblAcceptMessages.SelectedIndex = 0;

			ToggleControls();
		}
Example #4
0
 protected override void RemoveMailboxFolderPermission(Runspace runSpace, string folderPath, ExchangeAccount account)
 {
     Command cmd = new Command("Remove-MailboxFolderPermission");
     cmd.Parameters.Add("Identity", folderPath);
     cmd.Parameters.Add("User", account.AccountName);
     ExecuteShellCommand(runSpace, cmd);
 }
Example #5
0
        protected override void RemoveMailboxFolderPermission(Runspace runSpace, string folderPath, ExchangeAccount account)
        {
            Command cmd = new Command("Remove-MailboxFolderPermission");

            cmd.Parameters.Add("Identity", folderPath);
            cmd.Parameters.Add("User", account.AccountName);
            ExecuteShellCommand(runSpace, cmd);
        }
 /// <remarks/>
 public void SetMailboxPermissionsAsync(int itemId, int accountId, string[] sendAsaccounts, string[] fullAccessAcounts, string[] onBehalfOfAccounts, ExchangeAccount[] calendarAccounts, ExchangeAccount[] contactAccounts, object userState) {
     if ((this.SetMailboxPermissionsOperationCompleted == null)) {
         this.SetMailboxPermissionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetMailboxPermissionsOperationCompleted);
     }
     this.InvokeAsync("SetMailboxPermissions", new object[] {
                 itemId,
                 accountId,
                 sendAsaccounts,
                 fullAccessAcounts,
                 onBehalfOfAccounts,
                 calendarAccounts,
                 contactAccounts}, this.SetMailboxPermissionsOperationCompleted, userState);
 }
        public static ExchangeAccount GetAccount(int itemId, int accountId, bool withLog = true)
        {
            #region Demo Mode
            if (IsDemoMode)
            {
                ExchangeAccount m1 = new ExchangeAccount();
                m1.AccountId = 1;
                m1.AccountName = "john_fabrikam";
                m1.AccountType = ExchangeAccountType.Mailbox;
                m1.DisplayName = "John Smith";
                m1.PrimaryEmailAddress = "*****@*****.**";

                // Log Extension
                if (withLog)
                    LogExtension.WriteObject(m1); 
                
                return m1;
            }
            #endregion

            ExchangeAccount account = ObjectUtils.FillObjectFromDataReader<ExchangeAccount>(
                DataProvider.GetExchangeAccount(itemId, accountId));

            if (account == null)
                return null;

            // Log Extension
            if (withLog)
                LogExtension.WriteObject(account);

            return account;
        }
        public static int SetMailboxPermissions(int itemId, int accountId, string[] sendAsaccounts, string[] fullAccessAcounts, string[] onBehalfOfAccounts, ExchangeAccount[] calendarAccounts, ExchangeAccount[] contactAccounts)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // place log record
            TaskManager.StartTask("EXCHANGE", "SET_MAILBOX_PERMISSIONS", itemId);

            try
            {
                // load organization
                Organization org = GetOrganization(itemId);
                if (org == null)
                    return -1;

                // check package
                int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
                if (packageCheck < 0) return packageCheck;

                // load account
                ExchangeAccount account = GetAccount(itemId, accountId);

                // Log Extension
                LogExtension.SetItemName(account.PrimaryEmailAddress);

                // get mailbox settings
                int exchangeServiceId = GetExchangeServiceID(org.PackageId);
                ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);

                exchange.SetMailboxPermissions(org.OrganizationId, account.UserPrincipalName, sendAsaccounts, fullAccessAcounts, onBehalfOfAccounts, calendarAccounts, contactAccounts);

                return 0;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }

        }
 private bool IsGroup(ExchangeAccount account)
 {
     return (account.AccountType == ExchangeAccountType.SecurityGroup || account.AccountType == ExchangeAccountType.DefaultSecurityGroup);
 }
        public static List<ExchangeAccount> GetAccounts(int itemId, ExchangeAccountType accountType)
        {
            #region Demo Mode
            if (IsDemoMode)
            {
                if (accountType == ExchangeAccountType.Mailbox)
                    return SearchAccounts(0, true, false, false, true, true, false, "", "", "");
                else if (accountType == ExchangeAccountType.Contact)
                    return SearchAccounts(0, false, true, false, false, false, false, "", "", "");
                else if (accountType == ExchangeAccountType.DistributionList)
                    return SearchAccounts(0, false, false, true, false, false, false, "", "", "");
                else
                {
                    List<ExchangeAccount> demoAccounts = new List<ExchangeAccount>();
                    ExchangeAccount f1 = new ExchangeAccount();
                    f1.AccountId = 7;
                    f1.AccountName = "documents_fabrikam";
                    f1.AccountType = ExchangeAccountType.PublicFolder;
                    f1.DisplayName = "\\fabrikam\\Documents";
                    f1.PrimaryEmailAddress = "*****@*****.**";
                    f1.MailEnabledPublicFolder = true;
                    demoAccounts.Add(f1);

                    ExchangeAccount f2 = new ExchangeAccount();
                    f2.AccountId = 8;
                    f2.AccountName = "documents_fabrikam";
                    f2.AccountType = ExchangeAccountType.PublicFolder;
                    f2.DisplayName = "\\fabrikam\\Documents\\Legal";
                    f2.PrimaryEmailAddress = "";
                    demoAccounts.Add(f2);

                    ExchangeAccount f3 = new ExchangeAccount();
                    f3.AccountId = 9;
                    f3.AccountName = "documents_fabrikam";
                    f3.AccountType = ExchangeAccountType.PublicFolder;
                    f3.DisplayName = "\\fabrikam\\Documents\\Contracts";
                    f3.PrimaryEmailAddress = "";
                    demoAccounts.Add(f3);
                    return demoAccounts;
                }
            }
            #endregion

            return ObjectUtils.CreateListFromDataReader<ExchangeAccount>(
                DataProvider.GetExchangeAccounts(itemId, (int)accountType));
        }
Example #11
0
        private void ResetMailboxFolderPermissions(Runspace runSpace, string folderPath, ExchangeAccount[] accounts, ExchangeTransaction transaction)
        {
            ExchangeLog.LogStart("ResetMailboxFolderPermissions");

            foreach (var account in accounts)
            {
                RemoveMailboxFolderPermission(runSpace, folderPath, account);

                transaction.RemoveMailboxFolderPermissions(folderPath, account);
            }

            ExchangeLog.LogEnd("ResetMailboxFolderPermissions");
        }
 public void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string path)
 {
     SetDriveMapsTargetingFilterInternal(organizationId, accounts, path);
 }
Example #13
0
 private static int CompareAccount(ExchangeAccount user1, ExchangeAccount user2)
 {
     return string.Compare(user1.DisplayName, user2.DisplayName);
 }
Example #14
0
        protected override void SetMailboxFolderPermissions(Runspace runSpace, ExchangeAccount[] existingAccounts, string folderPath, ExchangeAccount[] accounts)
        {
            ExchangeLog.LogStart("SetMailboxFolderPermissions");

            if (string.IsNullOrEmpty(folderPath))
                throw new ArgumentNullException("folderPath");

            if (accounts == null)
                throw new ArgumentNullException("accounts");

            ExchangeTransaction transaction = StartTransaction();

            try
            {
                SetMailboxFolderPermissions(runSpace, folderPath, existingAccounts, accounts, transaction);
            }
            catch (Exception)
            {
                RollbackTransaction(transaction);
                throw;
            }

            ExchangeLog.LogEnd("SetMailboxFolderPermissions");
        }
 /// <remarks/>
 public void SetDriveMapsTargetingFilterAsync(string organizationId, ExchangeAccount[] accounts, string folderName, object userState) {
     if ((this.SetDriveMapsTargetingFilterOperationCompleted == null)) {
         this.SetDriveMapsTargetingFilterOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDriveMapsTargetingFilterOperationCompleted);
     }
     this.InvokeAsync("SetDriveMapsTargetingFilter", new object[] {
                 organizationId,
                 accounts,
                 folderName}, this.SetDriveMapsTargetingFilterOperationCompleted, userState);
 }
 /// <remarks/>
 public void SetDriveMapsTargetingFilterAsync(string organizationId, ExchangeAccount[] accounts, string folderName) {
     this.SetDriveMapsTargetingFilterAsync(organizationId, accounts, folderName, null);
 }
 /// <remarks/>
 public System.IAsyncResult BeginSetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("SetDriveMapsTargetingFilter", new object[] {
                 organizationId,
                 accounts,
                 folderName}, callback, asyncState);
 }
 public void SetDriveMapsTargetingFilter(string organizationId, ExchangeAccount[] accounts, string folderName) {
     this.Invoke("SetDriveMapsTargetingFilter", new object[] {
                 organizationId,
                 accounts,
                 folderName});
 }
Example #19
0
        public void SetAccounts(ExchangeAccount[] accounts)
		{
			BindAccounts(accounts, false);
		}
Example #20
0
        private void AddMailboxFolderPermissions(Runspace runSpace, string folderPath, ExchangeAccount[] accounts, ExchangeTransaction transaction)
        {
            ExchangeLog.LogStart("SetMailboxCalendarPermissions");

            foreach (var account in accounts)
            {
                AddMailboxFolderPermission(runSpace, folderPath, account);

                transaction.AddMailboxFolderPermission(folderPath, account);
            }

            ExchangeLog.LogEnd("SetMailboxCalendarPermissions");
        }
 public int SetPublicFolderGeneralSettings(int itemId, int accountId, string newName, bool hideAddressBook, ExchangeAccount[] accounts) {
     object[] results = this.Invoke("SetPublicFolderGeneralSettings", new object[] {
                 itemId,
                 accountId,
                 newName,
                 hideAddressBook,
                 accounts});
     return ((int)(results[0]));
 }
Example #22
0
        private void SetMailboxFolderPermissions(Runspace runSpace, string folderPath, ExchangeAccount[] existingAccounts, ExchangeAccount[] newAccounts, ExchangeTransaction transaction)
        {
            ResetMailboxFolderPermissions(runSpace, folderPath, existingAccounts, transaction);

            AddMailboxFolderPermissions(runSpace, folderPath, newAccounts, transaction);
        }
 /// <remarks/>
 public System.IAsyncResult BeginSetPublicFolderGeneralSettings(int itemId, int accountId, string newName, bool hideAddressBook, ExchangeAccount[] accounts, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("SetPublicFolderGeneralSettings", new object[] {
                 itemId,
                 accountId,
                 newName,
                 hideAddressBook,
                 accounts}, callback, asyncState);
 }
        internal void SetDriveMapsTargetingFilterInternal(string organizationId, ExchangeAccount[] accounts, string locationPath)
        {
            HostedSolutionLog.LogStart("SetDriveMapsTargetingFilterInternal");
            HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
            HostedSolutionLog.DebugInfo("folderName : {0}", locationPath);

            if (string.IsNullOrEmpty(organizationId))
                throw new ArgumentNullException("organizationId");

            if (string.IsNullOrEmpty(locationPath))
                throw new ArgumentNullException("folderName");

             try
             {
                 Dictionary<string, ExchangeAccount> sidAccountPairs = new Dictionary<string, ExchangeAccount>();

                 foreach (var account in accounts)
                 {
                     string path = IsGroup(account) ? GetGroupPath(organizationId, account.AccountName) : GetUserPath(organizationId, account.AccountName);

                     DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);

                     byte[] sidByteArr = (byte[])ActiveDirectoryUtils.GetADObjectProperty(entry, ADAttributes.SID);

                     string sid = new System.Security.Principal.SecurityIdentifier(sidByteArr, 0).ToString();

                     sidAccountPairs.Add(sid, account);
                 }

                 string gpoId;

                 if (!CheckMappedDriveGpoExists(organizationId, out gpoId))
                 {
                     CreateAndLinkMappedDrivesGPO(organizationId, out gpoId);
                 }

                 if (!string.IsNullOrEmpty(gpoId))
                 {
                     string drivesXmlPath = string.Format("{0}\\{1}",
                                                          string.Format(GROUP_POLICY_MAPPED_DRIVES_FILE_PATH_TEMPLATE, RootDomain, gpoId),
                                                          "Drives.xml");
                     // open xml document
                     var xml = GetOrCreateDrivesFile(gpoId);

                     XmlNodeList drives = xml.SelectNodes(string.Format("./Drives/Drive[contains(Properties/@path,'{0}')]", locationPath));

                     foreach (XmlNode driveNode in drives)
                     {
                         XmlNodeList childNodes = driveNode.ChildNodes;

                         if (childNodes.Count > 1)
                         {
                             //delete existing filters
                             driveNode.LastChild.ParentNode.RemoveChild(driveNode.LastChild);
                         }

                         XmlNode newFiltersNode = CreateFiltersNode(xml, sidAccountPairs);

                         driveNode.AppendChild(newFiltersNode);
                     }

                     xml.Save(drivesXmlPath);

                     IncrementGPOVersion(organizationId, gpoId);
                 }
             }
             catch (Exception)
             {
                 throw;
             }
             finally
             {
                 HostedSolutionLog.LogEnd("SetDriveMapsTargetingFilterInternal");
             }
        }
 /// <remarks/>
 public void SetPublicFolderGeneralSettingsAsync(int itemId, int accountId, string newName, bool hideAddressBook, ExchangeAccount[] accounts) {
     this.SetPublicFolderGeneralSettingsAsync(itemId, accountId, newName, hideAddressBook, accounts, null);
 }
 public void AddMailboxFolderPermission(string folderPath, ExchangeAccount account)
 {
     TransactionAction action = new TransactionAction();
     action.ActionType = TransactionAction.TransactionActionTypes.AddMailboxFolderPermission;
     action.Id = folderPath;
     action.ExchangeAccount = account;
     Actions.Add(action);
 }
 /// <remarks/>
 public void SetPublicFolderGeneralSettingsAsync(int itemId, int accountId, string newName, bool hideAddressBook, ExchangeAccount[] accounts, object userState) {
     if ((this.SetPublicFolderGeneralSettingsOperationCompleted == null)) {
         this.SetPublicFolderGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetPublicFolderGeneralSettingsOperationCompleted);
     }
     this.InvokeAsync("SetPublicFolderGeneralSettings", new object[] {
                 itemId,
                 accountId,
                 newName,
                 hideAddressBook,
                 accounts}, this.SetPublicFolderGeneralSettingsOperationCompleted, userState);
 }
        public static List<ExchangeAccount> SearchAccounts(int itemId,
            bool includeMailboxes, bool includeContacts, bool includeDistributionLists,
            bool includeRooms, bool includeEquipment, bool includeSecurityGroups,
            string filterColumn, string filterValue, string sortColumn)
        {
            #region Demo Mode
            if (IsDemoMode)
            {
                List<ExchangeAccount> demoAccounts = new List<ExchangeAccount>();

                if (includeMailboxes)
                {
                    ExchangeAccount m1 = new ExchangeAccount();
                    m1.AccountId = 1;
                    m1.AccountName = "john_fabrikam";
                    m1.AccountType = ExchangeAccountType.Mailbox;
                    m1.DisplayName = "John Smith";
                    m1.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(m1);



                    ExchangeAccount m3 = new ExchangeAccount();
                    m3.AccountId = 3;
                    m3.AccountName = "marry_fabrikam";
                    m3.AccountType = ExchangeAccountType.Mailbox;
                    m3.DisplayName = "Marry Smith";
                    m3.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(m3);
                }

                if (includeRooms)
                {
                    ExchangeAccount r1 = new ExchangeAccount();
                    r1.AccountId = 20;
                    r1.AccountName = "room1_fabrikam";
                    r1.AccountType = ExchangeAccountType.Room;
                    r1.DisplayName = "Meeting Room 1";
                    r1.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(r1);
                }

                if (includeEquipment)
                {
                    ExchangeAccount e1 = new ExchangeAccount();
                    e1.AccountId = 21;
                    e1.AccountName = "projector_fabrikam";
                    e1.AccountType = ExchangeAccountType.Equipment;
                    e1.DisplayName = "Projector 1";
                    e1.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(e1);
                }

                if (includeContacts)
                {
                    ExchangeAccount c1 = new ExchangeAccount();
                    c1.AccountId = 4;
                    c1.AccountName = "pntr1_fabrikam";
                    c1.AccountType = ExchangeAccountType.Contact;
                    c1.DisplayName = "WebsitePanel Support";
                    c1.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(c1);

                    ExchangeAccount c2 = new ExchangeAccount();
                    c2.AccountId = 5;
                    c2.AccountName = "acc1_fabrikam";
                    c2.AccountType = ExchangeAccountType.Contact;
                    c2.DisplayName = "John Home Account";
                    c2.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(c2);
                }

                if (includeDistributionLists)
                {
                    ExchangeAccount d1 = new ExchangeAccount();
                    d1.AccountId = 6;
                    d1.AccountName = "sales_fabrikam";
                    d1.AccountType = ExchangeAccountType.DistributionList;
                    d1.DisplayName = "Fabrikam Sales Dept";
                    d1.PrimaryEmailAddress = "*****@*****.**";
                    demoAccounts.Add(d1);
                }

                if (includeSecurityGroups)
                {
                    ExchangeAccount g1 = new ExchangeAccount();
                    g1.AccountId = 7;
                    g1.AccountName = "group_fabrikam";
                    g1.AccountType = ExchangeAccountType.SecurityGroup;
                    g1.DisplayName = "Fabrikam Sales Dept";
                    demoAccounts.Add(g1);
                }

                return demoAccounts;
            }
            #endregion

            return ObjectUtils.CreateListFromDataReader<ExchangeAccount>(
                DataProvider.SearchExchangeAccounts(SecurityContext.User.UserId, itemId, includeMailboxes, includeContacts,
                includeDistributionLists, includeRooms, includeEquipment, includeSecurityGroups,
                filterColumn, filterValue, sortColumn));
        }
 public int SetMailboxPermissions(int itemId, int accountId, string[] sendAsaccounts, string[] fullAccessAcounts, string[] onBehalfOfAccounts, ExchangeAccount[] calendarAccounts, ExchangeAccount[] contactAccounts) {
     object[] results = this.Invoke("SetMailboxPermissions", new object[] {
                 itemId,
                 accountId,
                 sendAsaccounts,
                 fullAccessAcounts,
                 onBehalfOfAccounts,
                 calendarAccounts,
                 contactAccounts});
     return ((int)(results[0]));
 }
 private static void UpdateAccount(ExchangeAccount account)
 {
     DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
         account.PrimaryEmailAddress, account.MailEnabledPublicFolder,
         account.MailboxManagerActions.ToString(), account.SamAccountName, account.MailboxPlanId, account.ArchivingMailboxPlanId,
         (string.IsNullOrEmpty(account.SubscriberNumber) ? null : account.SubscriberNumber.Trim()),
         account.EnableArchiving);
 }
 /// <remarks/>
 public System.IAsyncResult BeginSetMailboxPermissions(int itemId, int accountId, string[] sendAsaccounts, string[] fullAccessAcounts, string[] onBehalfOfAccounts, ExchangeAccount[] calendarAccounts, ExchangeAccount[] contactAccounts, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("SetMailboxPermissions", new object[] {
                 itemId,
                 accountId,
                 sendAsaccounts,
                 fullAccessAcounts,
                 onBehalfOfAccounts,
                 calendarAccounts,
                 contactAccounts}, callback, asyncState);
 }
        public static int SetPublicFolderGeneralSettings(int itemId, int accountId, string newName,
            bool hideAddressBook, ExchangeAccount[] accounts)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // place log record
            TaskManager.StartTask("EXCHANGE", "UPDATE_PUBLIC_FOLDER_GENERAL", itemId);

            try
            {
                // load organization
                Organization org = GetOrganization(itemId);
                if (org == null)
                    return -1;

                // check package
                int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
                if (packageCheck < 0) return packageCheck;

                // load account
                ExchangeAccount account = GetAccount(itemId, accountId);

                // get mailbox settings
                int exchangeServiceId = GetExchangeServiceID(org.PackageId);
                ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);

                var oldObj = exchange.GetPublicFolderGeneralSettings(org.OrganizationId, account.DisplayName);

                exchange.SetPublicFolderGeneralSettings(
                    org.OrganizationId,
                    account.DisplayName,
                    newName,
                    hideAddressBook,
                    accounts
                    );

                var newObj = exchange.GetPublicFolderGeneralSettings(org.OrganizationId, account.DisplayName);

                // Log Extension
                LogExtension.LogPropertiesIfChanged(oldObj, newObj);

                // update folder name
                string origName = account.DisplayName;
                string newFullName = origName.Substring(0, origName.LastIndexOf("\\") + 1) + newName;

                if (String.Compare(origName, newFullName, true) != 0)
                {
                    // Log Extension
                    account.LogPropertyIfChanged(a => a.DisplayName, newFullName);
                    TaskManager.Write("Public Folders: ");

                    // rename original folder
                    account.DisplayName = newFullName;
                    UpdateAccount(account);

                    // rename nested folders
                    List<ExchangeAccount> folders = GetAccounts(itemId, ExchangeAccountType.PublicFolder);
                    foreach (ExchangeAccount folder in folders)
                    {
                        if (folder.DisplayName.ToLower().StartsWith(origName.ToLower() + "\\"))
                        {
                            var newFolderName = newFullName + folder.DisplayName.Substring(origName.Length);

                            // Log Extension
                            folder.LogPropertyIfChanged(f => f.DisplayName, newFolderName);

                            folder.DisplayName = newFolderName;
                            UpdateAccount(folder);
                        }
                    }
                }

                return 0;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
 /// <remarks/>
 public void SetMailboxPermissionsAsync(int itemId, int accountId, string[] sendAsaccounts, string[] fullAccessAcounts, string[] onBehalfOfAccounts, ExchangeAccount[] calendarAccounts, ExchangeAccount[] contactAccounts) {
     this.SetMailboxPermissionsAsync(itemId, accountId, sendAsaccounts, fullAccessAcounts, onBehalfOfAccounts, calendarAccounts, contactAccounts, null);
 }