I have below piece of code to read documents from domain users Drive. One of the user in selected Domain is suspended. I am getting 'Precondition failed.' error for this suspended users. For all other users same code works properly. Is it possible to read the contents of suspended Google users Drive by using Admin APIs.
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 = "877564787679-glrhdp0e4998dkc6mfj62@developer.gserviceaccount.com",
Scope = DriveService.Scopes.Drive.GetStringValue(),
ServiceAccountUser = "suspendedusersEmailAddress"
};
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();