Exemple #1
0
        private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink)
        {
            string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID);

            string json = JsonConvert.SerializeObject(new
            {
                role     = role.ToString(),
                type     = type.ToString(),
                value    = value,
                withLink = withLink.ToString()
            });

            string response = SendRequestJSON(url, json, GetAuthHeaders());
        }
        private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, bool allowFileDiscovery)
        {
            if (!CheckAuthorization())
            {
                return;
            }

            string url = string.Format("https://www.googleapis.com/drive/v3/files/{0}/permissions", fileID);

            string json = JsonConvert.SerializeObject(new
            {
                role = role.ToString(),
                type = type.ToString(),
                allowFileDiscovery = allowFileDiscovery.ToString()
            });

            string response = SendRequest(HttpMethod.POST, url, json, RequestHelpers.ContentTypeJSON, null, GoogleAuth.GetAuthHeaders());
        }
Exemple #3
0
        public void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink)
        {
            NameValueCollection headers = new NameValueCollection();

            headers.Add("Authorization", "Bearer " + AuthInfo.Token.access_token);

            string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID);

            string json = JsonConvert.SerializeObject(new
            {
                role     = role.ToString(),
                type     = type.ToString(),
                value    = value,
                withLink = withLink.ToString()
            });

            string response = SendPostRequestJSON(url, json, headers: headers);
        }
Exemple #4
0
        private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink)
        {
            if (!CheckAuthorization())
            {
                return;
            }

            string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID);

            string json = JsonConvert.SerializeObject(new
            {
                role     = role.ToString(),
                type     = type.ToString(),
                value    = value,
                withLink = withLink.ToString()
            });

            string response = SendRequest(HttpMethod.POST, url, json, ContentTypeJSON, null, GetAuthHeaders());
        }
Exemple #5
0
        private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink)
        {
            if (!CheckAuthorization()) return;

            string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID);

            string json = JsonConvert.SerializeObject(new
            {
                role = role.ToString(),
                type = type.ToString(),
                value = value,
                withLink = withLink.ToString()
            });

            string response = SendRequestJSON(url, json, GetAuthHeaders());
        }
Exemple #6
0
        public void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink)
        {
            NameValueCollection headers = new NameValueCollection();
            headers.Add("Authorization", "Bearer " + AuthInfo.Token.access_token);

            string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID);

            string json = JsonConvert.SerializeObject(new
            {
                role = role.ToString(),
                type = type.ToString(),
                value = value,
                withLink = withLink.ToString()
            });

            string response = SendPostRequestJSON(url, json, headers: headers);
        }