Comments? Questions?

Have a look at my GitHub SharePointOnline-ScriptSamples, where you can find this SharePoint script and 280 others!

You can find all my repositories at PowershellScripts @ GitHub

Powershell script that lists 5 latest files or items a user has created in a given SharePoint Online list or library.


How to use?

1.Download the script and open the file.

2. Modify the following lines with appropriate paths to SharePoint SDKs:


#Paths to SDK 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.Office.Client.Policy.dll"    
3. Enter data about your tenant:
#Enter the data 
$username = "" 
$Url = "" 
$ListTitle = "Customers" 
$UserDisplayName = "FR" 
 $username - user who has administrative rights over the website/list
 $url           - url of the site collection
 $listtitle     - title of the list where you want to run the query
 $userdisplayname  - display name of the user who modified the items
The script will also create a report under "c:\users\public\FiveItems.csv" with file names and created date.