1
서비스 계정이있는 파일을 얻으려면 아래 코드를 사용하고 있습니다. 직접 메시지를 전송하거나 응답을 얻으면서 여기Google 드라이브 API 1.4 오류 : 직접 메시지를 보내거나 응답하는 중에 오류가 발생했습니다.
var certificate = new X509Certificate2("D:\\05-privatekey.p12", "notasecret", X509KeyStorageFlags.Exportable);
var privateKey = certificate.Export(X509ContentType.Cert);
var provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, certificate)
{
ServiceAccountId = "[email protected]account.com",
Scope = DriveService.Scopes.Drive.GetStringValue(),
ServiceAccountUser = "[email protected]"
};
var auth = new OAuth2Authenticator<AssertionFlowClient>(provider, AssertionFlowClient.GetState);
DriveService service = new DriveService(new BaseClientService.Initializer()
{
Authenticator = auth,
ApplicationName = "My APP",
});
FilesResource.ListRequest request = service.Files.List();
FileList files = request.Execute();
실행은() API는 예외를
오류 발생을주고있다.
편집 : 프로젝트는 https://code.google.com/p/google-api-dotnet-client/wiki/Build
편집 2 @ 언급 한 설정을 기반으로 : 나는 서비스 계정
https://developers.google.com/drive/delegation에서 설명한 위임을 진행 했습니까? –
고마워 Burcu, 시작합니다 .... 새로운 Google APP 계정을 만들었고 @ https://developers.google.com/drive/delegation?hl=ko라는 설정을 언급했습니다.하지만 생각해 봅니다. 효과를 발휘할 시간 ....-) – Jeevan
이제는 제대로 작동하는 것이 좋습니다. –