Beispiel #1
0
        public DriveService GetApiKeyDrive(string ConfigApiKeyDriveName)
        {
            ApiKeyGDriveElement apiKey = PGDriveConfig.GetApiKeyElement(ConfigApiKeyDriveName);

            if (apiKey != null)
            {
                return(GetApiKeyDriveService(apiKey.ApiKey));
            }
            throw new NullReferenceException("There is no drive with such name in ApiKeyDrives collection of PGDrive config section");
        }
Beispiel #2
0
        public DriveService GetOAuthDrive(string ConfigOAuthDriveName, PGScope scopes = null, bool recreateOAuthToken = false)
        {
            OAuthGDriveElement oAuth = PGDriveConfig.GetOAuthElement(ConfigOAuthDriveName);

            if (oAuth != null)
            {
                List <string> scopesList = new List <string>();
                if (scopes != null)
                {
                    scopesList = scopes.Scopes;
                }
                ApplicationName = oAuth.ApplicationName;
                return(GetOAuthDriveService(oAuth.ApplicationName, oAuth.ClientSecretPath, scopesList.ToArray(), recreateOAuthToken));
            }
            throw new NullReferenceException("There is no drive with such name in OAuthDrives collection of PGDrive config section");
        }