A customer asked if there was a method to identity documents stored in SharePoint online that were encrypted with passwords. Since nothing like this existed, it was created using PowerShell. I’m sharing this because the logic in the script may be useful for others.
#Title: find-docpasswords #Description: Iterates through each item in a specified list to find documents stored with passwords. #Date: 7/8/2020 #Author: Mike Lee #Disclaimer: This PowerShell script is provided "as-is" with no warranties expressed or implied. Use it at your own risk. #Dependencies: SharePoint Online Client Components SDK: https://www.microsoft.com/en-us/download/details.aspx?id=42038 #Tested with SharePoint Online Client Components SDK version 16.0.6906.1200 #Parameters: $SiteURL, $ListName, $username
#Add references to SharePoint client assemblies [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") [System.Reflection.Assembly]::LoadWithPartialName("WindowsBase")
#CAML Query to recursively look at all items in the library with a 5000 item row limit. $camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery $camlQuery.ViewXml = @" <View Scope="RecursiveAll"> <Query> <OrderBy><FieldRef Name='ID' Ascending='TRUE'/></OrderBy> </Query> <RowLimit Paged="TRUE">5000</RowLimit> </View> "@