1

Is it possible to search for all google drive documents that have been shared with a link privately or are open on the web ?

In the advance search you can search for files shares with particular people, but i would like to run a report on files shared either with a link privately or are open on the web.

1

The official help article about search on Google Drive doesn't describe how to search for files shared by usingn a link.

For consumer accounts (usually accounts from gmail.com) the alternative is to use a script, an addon or a third-party app. If you have a G Suite account, on the advanced search options, on location you could select the option "Visible to all users on ". For further details see Find Drive documents in your domain.

If you are G Suite admin, you could use the Security reports to find files shared with a link.

  • Thanks I was looking at the old search box in google drive and it allowed you to actually filter a search by sharing settings (see here : i.stack.imgur.com/whXV1.gif). Do you know if its possible to recreate this functionality inside of the search bar by using a search string something like visibility: not shared ? I dont really want to run a 3rd party addon that will have access to my account, but could run a script do you know of one, ive searched by couldn't find one that audited my whole drive – sam Mar 1 '18 at 20:22
1

It seems Drive URL query parameters doesn't support such searching now(It was probably removed in 2009). The only way you can search by those parameters now is probably by google-apps-script or DRIVE REST API.


  • Official search parameters support only to:email parameter. So,If you know the email address,You can easily filter out the files.

  • GOOGLE-APPS-SCRIPT

    function driveSearch() {
      // Log the name of every file in the user's Drive whose visibility is anyonewithLink or anyonecanfind
      var files = DriveApp.searchFiles(
        'visibility = "anyoneWithLink" or visibility = "anyoneCanFind"');
      while (files.hasNext()) {
        var file = files.next();
        //var owner = file.getOwner().getName();
        //var sa = file.getSharingAccess();
        Logger.log(file.getName());
        //Logger.log('Owner:'+owner);
        //Logger.log("SharingAccess:"+sa);
      }
      }
    

Sample Python Code from the official documentation

    page_token = None
    while True:
    response = drive_service.files().list(q="mimeType='image/jpeg'",
                                      spaces='drive',
                                      fields='nextPageToken, files(id, name)',
                                      pageToken=page_token).execute()
    for file in response.get('files', []):
    # Process change
    print 'Found file: %s (%s)' % (file.get('name'), file.get('id'))
    page_token = response.get('nextPageToken', None)
    if page_token is None:
    break
  • This Google Apps scripts is great and should be the accepted answer. – bers Dec 7 '18 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.