5

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
  • Send feedback to Google while in Drive. I just did it in desktop and it send a screenshot and gave a checkbox to allow an email reply. This seems like a crucial feature to have (especially considering how poorly I see admins manage files, and the liabilities they create).
    – SteveExdia
    May 1, 2023 at 12:43

2 Answers 2

4

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
3
  • This Google Apps scripts is great and should be the accepted answer.
    – bers
    Dec 7, 2018 at 9:14
  • 1
    Go here script.google.com/home to create an app script (it's not immediately obvious). Create a new script, copy paste this, and forth you roll. I couldn't solve my initial problem (tons of "link shared" files owned by other people invading my drive), but this answer worked well with a few tweaks, e.g. if "owner = me" for tidying up stuff I was accidentally or obsoletely sharing.
    – Matt Bond
    Feb 23, 2021 at 17:22
  • I wonder why Google would have removed the ability to filter by visibility:all.
    – SteveExdia
    May 1, 2023 at 12:44
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.

1
  • 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, 2018 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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