Forum Discussion

hunk0227's avatar
hunk0227
Brass Contributor
Nov 24, 2022
Solved

missing document template in the document library

Hello,   I added my custom  document template here in the library. my simple question is do you know where the documents are placed?  I tried searching it and cannot find any in the site.   ...
  • SvenSieverding's avatar
    SvenSieverding
    Nov 24, 2022

    hunk0227 


    So does it mean that we cannot just copy/migrate files created in this function and we need to grab it one by one?


    Through the UI? Not really, perhaps with some migration tools.
    You were once able to do this with SharePoint Designer or if you access the document library through Webdav. But this does not really work well with SharePoint Online and modern authentication. 

    But you can list/download/update the "templates" in the forms folder through PNP Powershell and automate the process

     

    # List all files in the "forms" folder
    Get-PnPFolderItem -FolderSiteRelativeUrl "/Shared Documents/Forms" -ItemType File | Where-Object {$_.Name -notmatch '\.aspx$'}
    
    # Download a specific template and save it in your local current directory
    Get-PnPFile -Url "/Shared Documents/Forms/mytemplate.pptx" -Filename "mytemplate.pptx" -Path . -AsFile
    
    # Reupload an updated Version of the template.
    Add-PnPFile -Path '.\mytemplate.pptx' -Folder "/Shared Documents/Forms/"
    
    # Or put it all together to download all files from the hidden forms folder
    
    Get-PnPFolderItem -FolderSiteRelativeUrl "/Shared Documents/Forms" -ItemType File| Where-Object {$_.Name -notmatch '\.aspx$'} |foreach-object {
    
    Get-PnPFile -Url $_.ServerRelativeUrl -Filename $_.Name -Path . -AsFile
    
    }

     






Resources