Skip to content

Instantly share code, notes, and snippets.

@joerodgers
Last active April 25, 2024 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joerodgers/c5fe02b0ce2d353e5c18b48142c84e08 to your computer and use it in GitHub Desktop.
Save joerodgers/c5fe02b0ce2d353e5c18b48142c84e08 to your computer and use it in GitHub Desktop.
Rough proof of concept on locating transcript files stored in OD4B.
#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