-
Notifications
You must be signed in to change notification settings - Fork 0
/
PPTPNP.ps1
19 lines (15 loc) · 901 Bytes
/
PPTPNP.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Define the source URL of the template on SharePoint Online
$sourceUrl = "https://yoursharepointdomain.sharepoint.com/sites/yoursite/Shared%20Documents/templates/blank.potx"
# Define the local path where you want to save the template
$localPath = "C:\Users\$env:USERNAME\AppData\Roaming\Microsoft\Templates\blank.potx"
# Connect to SharePoint Online; this command might prompt for credentials
# If your organization uses MFA, this prompt will handle it
Connect-PnPOnline -Url "https://yoursharepointdomain.sharepoint.com/sites/yoursite" -UseWebLogin
# Download the file
Get-PnPFile -Url "/sites/yoursite/Shared Documents/templates/blank.potx" -Path $localPath -AsFile -Force
# Optional: Check if the file was downloaded successfully
If (Test-Path $localPath) {
Write-Output "Template 'blank.potx' has been updated successfully."
} Else {
Write-Output "Failed to download the template."
}