Forum Discussion
List Shared files + File Size in ODB
i haven't found any API or Powershell cmdlet to get for each user a list of
- shared files
- with the corresponding file size
(also the lastest news around Graph API does not help here :(
i would like to use this information to get a better understanding if users are mainly using onedrive for private purpose or if they share files whenever they upload them to onedrive.
Having metadata information such as (filesize, file type, to whom the file is shared, etc..) would further help to understand the user behavior
thanks
- Salvatore BiscariSilver Contributor
A "Shared by me" virtual folder (or something similar) has been promised, but without ETA.
Maybe it could come with some PowerShell cmdlet. We will see...
- Manidurai MohanamariappanIron Contributor
Pls check below script to get Sharing details of single user ODFB . and You need use PnP Sharepoint Online Powershell module.
$cred = Get-Credential Connect-PnPOnline -Url "https://tenantname-my.sharepoint.com/personal/admin_tenantname_onmicrosoft_com" -Credentials $cred $Ctx= Get-PnPContext $lists= Get-PnPListItem -List "documents" $Files = @() foreach( $list in $lists) { $FDetails = "" | Select "FilePath","SharedWith","FileSizeInMB" #Check weather is file or not If($list.FileSystemObjectType -ne "Folder") { $roles= $list.RoleAssignments $Ctx.load($roles) $Ctx.ExecuteQuery() #check file is shared If($roles.Count -gt 0) { #Join Shared UserName $rec = '' for ($i = $roles.Count -1; $i -ge 0 ; --$i) { $m=$roles[$i].Member $Ctx.Load($m) $Ctx.ExecuteQuery() If($rec) { $rec=$rec + ";" + $m.Title } Else { $rec=$m.Title } } $Ctx.ExecuteQuery() #Add File Informations $FDetails.FilePath=$list.FieldValues["FileRef"] $FDetails.SharedWith =$rec $FDetails.FileSizeInMB= $list.FieldValues["File_x0020_Size"]/1mb $Files +=$FDetails $FDetails =$null } } } $Files |fl
Note:
If you want to check each users ODFB sharing details, you need to add secondary site collection admin for each OFDB users, You can refer below link for add secondary admin to ODFB users