Get the revision history in Google Drive with Java by Netbeans

Asked

Viewed 134 times

1

I need to get the revision history of Google Drive. I visited the website of Drive Developers and I saw that you can do this with several languages. I want to do Java and use Netbeans and the history I want is Google Docs. The code is already ready to get the history but you need to have the library. I downloaded the library at this link.

And then add in Netbeans (I’ve already added the library and the jar files). I did as they say to do but nothing worked. How to do this? The code that gives error for not having the library are these 3 lines:

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.model.Revision;
import com.google.api.services.drive.model.RevisionList;

The error is as follows:

package [name] doesnt exist

What I need to do?

Obs: The rest of the schedule is as follows(taken directly from the google Developers website, in item review > list):

    package javaapplication8;    

    import com.google.api.services.drive.Drive;
    import com.google.api.services.drive.model.Revision;
    import com.google.api.services.drive.model.RevisionList;

    import java.io.IOException;
    import java.util.List;



    public class MyClass {

      private static List<Revision> retrieveRevisions(Drive service,
      String fileId) {

          fileId = "1XpNdeTFBr2KygyfPtlowBvkpcaJJzjgLckrGjp5oOhg0";
      try {
        RevisionList revisions = service.revisions().list(fileId).execute();
        return revisions.getItems();
      } catch (IOException e) {
        System.out.println("An error occurred: " + e);
      }
      return null;
    }
  }

1 answer

1


This (build) error occurs because none of the libraries you imported from the sent link have the classes you want to use, from the package:

import com.google.api.services.drive.

For this you have the error:

inserir a descrição da imagem aqui

Download this version, it possesses what you need. Behold the API.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.