Re: [GAM] Listing files shared outside domain

506 views
Skip to first unread message

Ross Scroggs

unread,
Feb 25, 2021, 11:13:54 AM2/25/21
to google-ap...@googlegroups.com
Jyoti,

Files can be shared outside your domain to users, groups, domains and anyone. Are you looking for all of these situations?

Ross

On Wed, Feb 24, 2021 at 11:06 PM 'Jyoti Madur' via GAM for Google Workspace <google-ap...@googlegroups.com> wrote:
Hello,

I want to list files shared outside my domain.

For the same, I read in one of the posts and ran below mentioned command:

gam config auto_batch_min 1 redirect csv ./filelistperms.csv multiprocess all users print filelist fields id,title,permissions,owners.emailaddress pm not role owner em todrive

This gives me the list of files shared with my domain as well outside domain.

I want to list only files shared outside my domain.

Please help with any pointers to move further on this.

Thank you.


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/42b3f02b-05c5-4ad3-bb10-b6ee8a8f65edn%40googlegroups.com.


--

Ross Scroggs

unread,
Feb 25, 2021, 1:04:41 PM2/25/21
to google-ap...@googlegroups.com

Jyoti Madur

unread,
Feb 26, 2021, 5:11:15 AM2/26/21
to google-ap...@googlegroups.com
Hi Ross,

Thanks for replying.

I have two queries:
1) What does the option "owners.emailaddress pm type anyone em pm not domain xyz.com em" will do in the below mentioned command:

gam config auto_batch_min 1 redirect csv ./filelistperms.csv multiprocess all users print filelist fields id,title,permissions,owners.emailaddress pm type anyone em pm not domain xyz.com em

2) What does the option "allowFileDiscovery" do?

3) Most importantly if I have more that 600 users in a Domain, will the above mentioned command work ?



--
Regards,
Jyoti Madur

Ross Scroggs

unread,
Feb 26, 2021, 9:10:04 AM2/26/21
to google-ap...@googlegroups.com
Jyoti,

1)
fields id,title,permissions,owners.emailaddress - Select the fields we need
pm type anyone em pm not domain xyz.com em - Only list files shared to anyone or shared outside of your domain xyz.com

2) Shares to domains and anyone can specify that the shares can be discovered by searching (allowFileDiscovery True) or a link is required (allowFileDiscovery False)

3) Yes, it will run for some time depending on the total number of files the 600 users have.

Remember, the script is collecting data, it takes no action on the ACLs discovered; there is a example of how to delete the ACLs, but the script does not do that,
you can manually execute that step is desired.

Jyoti Madur

unread,
Feb 26, 2021, 9:56:03 AM2/26/21
to google-ap...@googlegroups.com
Thanks Ross 😊



--
Regards,
Jyoti Madur

Jyoti Madur

unread,
Mar 1, 2021, 2:44:06 AM3/1/21
to google-ap...@googlegroups.com
Ross,
the above shared link does list the files shared inside as well outside domain.


But in that Domain Name Column is not mentioned and if I try to add its swapping the contains.

Can you please help me with it
--
Regards,
Jyoti Madur

Jyoti Madur

unread,
Mar 1, 2021, 3:19:34 AM3/1/21
to google-ap...@googlegroups.com
Ross,

MyBad!

I got it. Thanks again!
--
Regards,
Jyoti Madur

Jyoti Madur

unread,
Mar 1, 2021, 7:16:06 AM3/1/21
to google-ap...@googlegroups.com
Ross,

A) Going further I want to Unshare Files for a Specific EmailID for the Files which are Shared outside the Domain and I have used below command :

  1. gam csv deleteperms-00.csv gam user "~Owner" delete drivefileacl "~driveFileId" "id:14672737723742332"


It works. Hope I am on the right track.

B) I would also want to Unshare Files for a Specific Domain for the Files which are Shared outside the Domain. And not able to find any option for the same.

C) Is there any command where we can mention the outside domain name and list the files shared for that domain itself for both single user as well all users.

Thank you.

--
Regards,
Jyoti Madur

Brian Kim

unread,
Mar 1, 2021, 9:26:36 AM3/1/21
to GAM for Google Workspace
Hi Jyoti,

This is probably what you need.


Assuming you have filelistperms.csv created already, you can run the Python script for different users/domains as needed.

Jyoti Madur

unread,
Mar 1, 2021, 9:37:30 AM3/1/21
to google-ap...@googlegroups.com
For a specific domain how can we delete files shared

--
Regards,
Jyoti Madur

Ross Scroggs

unread,
Mar 1, 2021, 9:41:35 AM3/1/21
to google-ap...@googlegroups.com

Jyoti Madur

unread,
Mar 1, 2021, 5:02:44 PM3/1/21
to google-ap...@googlegroups.com
What I want to achieve is that after listing the details as mentioned in the link below, I want to unshare the files which are shared outside "xyz.com" for domain "pqr.com"


e.g. 
gam csv deleteperms.csv gam user "~Owner" delete drivefileacl "~driveFileId" "~domainId" How can I do achieve this?




--
Regards,
Jyoti Madur

Ross Scroggs

unread,
Mar 1, 2021, 5:58:24 PM3/1/21
to google-ap...@googlegroups.com
Jyoti,

Is there one domain pqr.com or do you want to unshare all domains other than xyz.com?

Ross



--

Ross Scroggs

unread,
Mar 1, 2021, 6:03:08 PM3/1/21
to google-ap...@googlegroups.com
Jyoti,

~domainId should be ~permissionId
gam csv deleteperms.csv gam user "~Owner" delete drivefileacl "~driveFileId" "~permissiond" 

Ross




--

Jyoti Madur

unread,
Mar 1, 2021, 9:46:21 PM3/1/21
to google-ap...@googlegroups.com
Ross,

One domain to unshare

--
Regards,
Jyoti Madur

Jyoti Madur

unread,
Mar 2, 2021, 7:39:08 AM3/2/21
to google-ap...@googlegroups.com
Ross,

I did try that but got error message as :
Permission ID: 02095506347849278317i, Does not exist

Is there any other way?

Ross Scroggs

unread,
Mar 2, 2021, 12:14:45 PM3/2/21
to google-ap...@googlegroups.com
Jyoti,

I've updated the GetSharedExternallyDriveACLs.py script; get the latest version
and make the following customizations, substitute for domain.com with the one external domain.

# Substitute your domain(s) in the list below, e.g., DOMAIN_LIST = ['domain.com',] DOMAIN_LIST = ['domain1.com', 'domain2.com',]                                                                                                               

DOMAIN_LIST = ['domain.com']

# Indicate whether the list is exclusive or inclusive                                                                                                                                                                                          

EXCLUSIVE_DOMAINS = False

# Indicate whether shares to anyone should be included                                                                                                                                                                                         

INCLUDE_ANYONE = False


Re-read the instructions and perform steps 1-4.


I'm in California (PST), contact me directly if you need additional help.


Ross




--
Reply all
Reply to author
Forward
0 new messages