Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
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);
        }