Export-SPOLastAccessDateReport

Downloads completed file last access date reports as a ZIP file and a JSON index.

Syntax

Default (Default)

Export-SPOLastAccessDateReport
    [-RunId] <Guid>
    [[-Path] <String>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This cmdlet downloads reports generated by Start-SPOLastAccessDateReport.

The download includes a ZIP file with CSV reports for completed sites. A JSON index identifies included sites and missing reports.

If a download fails, run the cmdlet again. Use -Force to replace existing report files.

You need the SharePoint Advanced Management Administrator role to run this cmdlet. App-only authentication requires Sites.FullControl.All.

Examples

EXAMPLE 1

Export-SPOLastAccessDateReport -RunId $report.RunId

This example downloads the report package to the current folder when the package is ready.

If Export returns Packaging, wait before running it again. If it returns RunNotFinished, check site progress with Get-SPOLastAccessDateReportStatus.

EXAMPLE 2

Export-SPOLastAccessDateReport -RunId $report.RunId -Path "C:\Reports" -Force

This example downloads both files to the existing C:\Reports folder. It allows Export to replace an existing ZIP or index.

Parameters

-Confirm

Applicable: SharePoint Online

Prompts for confirmation before exporting the reports. This medium-impact cmdlet doesn't prompt by default with the standard confirmation preference.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Applicable: SharePoint Online

Allows Export to overwrite an existing local ZIP or JSON index for this request. Without this parameter, Export stops if either file exists.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

Applicable: SharePoint Online

Specifies an existing local folder for the downloaded files. The default is the current file system folder.

This parameter specifies a folder, not a ZIP filename. Export doesn't create the folder.

Parameter properties

Type:System.String
Default value:Current file system folder
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunId

Applicable: SharePoint Online

Specifies the request identifier returned by Start-SPOLastAccessDateReport. The identifier must not be an empty GUID.

Parameter properties

Type:System.Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Applicable: SharePoint Online

Shows what would happen without exporting the reports.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

This cmdlet doesn't accept pipeline input.

Outputs

Microsoft.Online.SharePoint.PowerShell.SPOLastAccessDateReportExportResult

The returned object contains these properties:

Property Description
RunId Identifies the request.
State Reports whether processing, packaging, or download can complete.
FilePath Identifies the local ZIP when the download succeeds.
IndexFilePath Identifies the downloaded JSON index.
SizeBytes Gives the package size.
Sha256 Gives the package's SHA-256 hash.
SiteCount Counts the sites in the request.
IncludedSiteCount Counts sites included in the package.
MissingSiteCount Counts sites without included reports.
Detail Provides additional status information.
State Description
RunNotFinished Sites are still queued, processing, or retrying. Check request status and wait.
Packaging Wait a few minutes, then run the cmdlet again.
Ready The ZIP and index are downloaded. Review the index for missing site reports.
Failed Review the warning and Detail. Wait a few minutes, then run the cmdlet again.

Notes

Report requests remain available for 15 days after submission. Export reports before the request expires.

Reports contain file names, URLs, and access dates. Protect downloaded files according to your organization's data-handling requirements.

The downloaded files are named LastAccessDateReport_<RunId>.zip and LastAccessDateReport_<RunId>.index.json.

Each completed site's CSV contains these columns:

Column Description
FileId Identifies the file.
FileName Gives the filename, including its extension.
FileType Gives the file extension.
FileUrl Gives the file's absolute URL.
LastAccessDate Gives the effective recorded last access date.
SDSLastAccessDate Gives an additional recorded access date.
DocumentAnalyticsLastActivityTimestamp Gives the last activity timestamp from document analytics.
FileModifiedTime Gives the last modified time.

Dates use UTC. Unavailable dates are empty.