Share via

Any drawbacks of referencing templates from a main document library inside other document libraries

john john 1,026 Reputation points
2023-09-22T01:30:19.6+00:00

I am using the below PnP Powershell to reference document library templates inside other document libraries:-

First I modified the "New" menu of one document library .. Then I executed these Powershell commands

# Get the template
Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<site> -UseWebLogin
$listname="Name of the base document library"
$view = Get-PnpView -List $listname | Where-Object {$_.DefaultView -eq $true}
$template=$view.NewDocumentTemplates

This will load the configuration of the "New" menu inside of the variable "$template". I Kept the PowerShell window open and enter these lines

# If the library is on a different site than the other library
#Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<site> -UseWebLogin

$listname="Name of the documentlibrary you want to apply the template to"
$view = Get-PnpView -List $listname | Where-Object {$_.DefaultView -eq $true}
$view.NewDocumentTemplates = $template
$view.Update()
Invoke-PnPQuery	

That will apply the same "New" Menu to that other document library. It will not upload the document templates a second time but will configure both libraries to use the same template file.

so is there any drawbacks of doing this operation? Thanks

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-09-22T08:21:29.4133333+00:00

    Hi @john john

    According to the content provided, as far as I know, the following situations may occur:

    1.If you need to use the same template in multiple document libraries, then you need to update the template in all locations when a change is required. This may cause inconsistency and extra work.

    2.If you use the same template to reference files in other document libraries, then you may encounter permission or access issues. For example, if you want to create a file based on a template in another document library, but you do not have access to that document library, then you may receive an error message.

    3.If you use the same template to reference files in other document libraries, then you may lose some customization or management features. For example, if you want to set different metadata or version control for different document libraries, then using the same template may limit your options.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.