示例#1
0
 internal Containers.User CreateUserObject(Google.Apis.Drive.v3.Data.Permission permission)
 {
     Containers.User user = null;
     if (permission.DisplayName != null)
     {
         user = new Containers.User()
         {
             DisplayName  = permission.DisplayName,
             EmailAddress = permission.EmailAddress,
             Permissions  = GetPermissions(permission),
         };
     }
     return(user);
 }
示例#2
0
        /// <summary>
        /// This method takes a Google Drive file or folder as parameter
        /// and returns a list of users along with their access permissions type.
        /// </summary>
        internal List <Containers.User> GetUsers(Google.Apis.Drive.v3.Data.File file)
        {
            List <Containers.User> Users = null;
            // Add users and permissions
            IList <Google.Apis.Drive.v3.Data.Permission> permissions = file.Permissions;

            if (permissions != null && permissions.Count > 0)
            {
                Users = new List <Containers.User>();
                foreach (Google.Apis.Drive.v3.Data.Permission permission in permissions)
                {
                    Containers.User user = CreateUserObject(permission);
                    if (user != null)
                    {
                        Users.Add(user);
                    }
                }
            }
            return(Users);
        }