Is there anyway to get the count of documents where document has not been modified for 30 days? I was thinking of CAML query but is it possible to only get the count? Some list contains hundred of thousands of documents so I will get a thresh hold error. I am only looking for the count. Not sure if keyword query can do it. Just provide the amount of files.
You can use a CAML query to get the count of documents. You can use PowerShell to get all the files not modified in recent 30 days and get the count of them. The script below works for a library.
#Config Variables $SiteURL = "Site URL" $LibraryName = "Documents" #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) #Define Query to Filter Files that were modified 30 days ago (or More!) $Query= "<View Scope='RecursiveAll'> <Query> <Where> <And> <Lt> <FieldRef Name='Modified' Type='DateTime'/> <Value Type='DateTime' IncludeTimeValue='TRUE'> <Today OffsetDays='-30'/> </Value> </Lt> <Eq> <FieldRef Name='FSObjType' /><Value Type='Integer'>0</Value> </Eq> </And> </Where> </Query> </View>" #Get All Files matching the query $Files = Get-PnPListItem -List $LibraryName -Query $Query -PageSize 500 Write-host $Files.Length
If you have not install the PNP package before, install it.