Last active
April 25, 2024 20:30
-
-
Save joerodgers/c5fe02b0ce2d353e5c18b48142c84e08 to your computer and use it in GitHub Desktop.
Rough proof of concept on locating transcript files stored in OD4B.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -modules "PnP.PowerShell" | |
function Get-TranscriptFile | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$true)] | |
[DateTime] | |
$CreatedOnOrBefore | |
) | |
begin | |
{ | |
$context = Get-PnPContext | |
} | |
process | |
{ | |
$library = Get-PnPList -Identity "Documents" -ErrorAction Stop | |
$camlQuery = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery() | |
$camlQuery.ListItemCollectionPosition = $null | |
$camlQuery.FolderServerRelativeUrl = "$($library.RootFolder.ServerRelativeUrl)/Teams Meeting Transcripts" | |
do | |
{ | |
$batch = $library.GetItems( $camlQuery ) | |
$library.Context.Load($batch) | |
Invoke-PnPQuery | |
$batch | Select-Object Id, | |
@{Name="FileName"; Expression={ $_.FieldValues.FileLeafRef }}, | |
@{Name="FilePath"; Expression={ $_.FieldValues.FileDirRef }}, | |
@{Name="CreateDate"; Expression={ $_.FieldValues.Created }} | |
$camlQuery.ListItemCollectionPosition = $batch.ListItemCollectionPosition | |
} | |
while( $null -ne $camlQuery.ListItemCollectionPosition ) | |
} | |
end | |
{ | |
} | |
} | |
# requires SharePoint > Application > Sites.Manage.All | |
Connect-PnPOnline ` | |
-Url "https://$env:O365_TENANT-admin.sharepoint.com" ` | |
-ClientId $env:O365_CLIENTID ` | |
-Thumbprint $env:O365_THUMBPRINT ` | |
-Tenant $env:O365_TENANTID | |
$sites = Get-PnPTenantSite -IncludeOneDriveSites | Where-Object -Property Template -match "^SPSPERS" | |
foreach( $site in $sites ) | |
{ | |
# requires SharePoint > Application > Sites.Read.All | |
Connect-PnPOnline ` | |
-Url $site.Url` | |
-ClientId $env:O365_CLIENTID ` | |
-Thumbprint $env:O365_THUMBPRINT ` | |
-Tenant $env:O365_TENANTID | |
$transcripts = Get-TranscriptFile -CreatedOnOrBefore ([DateTime]::Today.AddDays(-60)) | |
$transcripts | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment