Exemple #1
0
        public IEnumerable <string> GetDelegates(string id)
        {
            id.ThrowIfNotEmailAddress();

            GmailService service = this.GetService(id);

            UsersResource.SettingsResource.DelegatesResource.ListRequest request = service.Users.Settings.Delegates.List(id);
            ListDelegatesResponse result = request.ExecuteWithRetry(RetryEvents.BackoffOAuthNotFound, this.RetryCount);

            return(result.Delegates?.Select(t => t.DelegateEmail) ?? new List <string>());
        }
Exemple #2
0
        public void RemoveDelegate(string id)
        {
            id.ThrowIfNotEmailAddress();

            GmailService          service = this.GetService(id);
            ListDelegatesResponse result  = service.Users.Settings.Delegates.List(id).ExecuteWithRetry(RetryEvents.BackoffOAuthNotFound, this.RetryCount);

            if (result.Delegates != null)
            {
                foreach (Delegate item in result.Delegates)
                {
                    service.Users.Settings.Delegates.Delete(id, item.DelegateEmail).ExecuteWithRetry(RetryEvents.BackoffOAuthNotFound, this.RetryCount, 5);
                }
            }
        }