evoke it logo white with clear backQuick Contact

Edit a Library/List Template file (.stp)

Edit a Library/List Template file (.stp)

Background

Creating document library template files can be extremely useful if you are going to have multiple libraries which use the same unique settings. The purpose of the template is to take an exact replica of the settings you have chosen in the list/library you’re creating a template from. However, a recent requirement I had for a template resulted in the discovery of a setting which is not replicated in the template – Opening Documents in the browser.

The Open Documents in the browser setting is set in each Document Library based on the Site Collection Feature ‘Open Documents in Client Applications by Default’.

If this feature is not activated, documents will open in the Web App. If this site collection feature is activated then the setting is changed to the ‘Open in the client application’ setting. The status of this feature overrides any templates created from a Document library. So if the above feature is deactivated, the setting is set to ‘Use the server default’ for all Document Libraries and even if you change the setting and save a template, the setting is defaulted back to the setting based on the Site Collection Feature status.

Looking at this in a little more detail when a site template file is created, an XML file is generated and the attribute for setting the ‘Open Documents in the Browser’ is absent from the XML. So in order to get around this issue we need to get into the XML of the Library template and make some changes.

Method

In order to make any changes to a library template file follow the steps below. In this example we will be changing this template to include the ‘Open Documents in the Browser’ attribute so we can set this setting to whatever we need it to be. This process can be followed to change any settings in a library template.

  1. Download the template file from SharePoint. This is found in the List Templates area (see below). Select the template file and select ‘download a copy’ from the Files Ribbon.

Navigate to the List Templates location by adding this to the end of your root site URL:

_catalogs/lt/Forms/AllItems.aspx

  1. Locate the template file in the location you downloaded it
  2. Right click on the .stp file and select ‘Rename’. Change the extension from .stp to .cab
  3. A pop up will appear asking if you’re sure you want to change it. Select Yes.
  4. .You now have a file with the extension .cab and the icon will have changed to a cabinet.
  5. Double click on the cabinet file and then double click on the manifest.xml file within it.
  6. You will be asked to extract the file. Select a short path (for example, C:/Template) and extract.
  7. Navigate to the location of your extracted manifest.xml file and then open in an editor of your choice. In this example Notepad++ is being used.
  8. Search within your editor for the following attribute: ‘DefaultItemOpenUseListSetting’
  9. If you find this attribute, its value will be 1. Change this to ‘False’ of if the attribute doesn’t exist, add it in and assign its value to false.
  10. You then need to add a new attribute – ‘DefaultItemOpen’ and set its value to ‘PreferClient’.
  11. Those are all the changes required. Now you need to create a cabinet file containing this xml file and then change it back to a .stp file.
  12. Firstly, be sure to save your changes to the xml file
  13. Create a new notepad file and paste in the code below, replacing the red text for your own paths and filenames.

 

.OPTION EXPLICIT ; Will Generate errors for mistakes

.set DiskDirectoryTemplate=CDROM ; All cabinets go into a folder

.Set CompressionType=MSZIP ;** All files are compressed to cabinet files

.Set UniqueFiles=”OFF”

.Set Cabinet=on

; Create destination Folder of your choice

.Set DiskDirectory1=C: cabinets

; File name for the new cab file

.Set CabinetNameTemplate=yourcabfile.cab

; Files to be added are listed below

C:Templatemanifest.xml

 

Save the notepad file with the following name and extension. Set the ‘Save as type’ to ‘All Files’

Save As:          a.ddf

  1. Open the Command Prompt and enter the following:

makecab /f C:yourlocationa.ddf

  1. Hit Enter and you should see the results below:
  2. If you’ve followed the above steps correctly your Cabinet directory and Cabinet file will have been created.
  3. Navigate to your newly created Cabinet file and rename the extension from (.cab) to (.stp).
  4. You have now successfully amended the settings of your template file and created a new template file which you can upload to SharePoint and use in your site.

 

Be the First to Get Our Ebook
Microsoft SharePoint 2019

What you need to know!

Back To The BlogContact Support

View Post's Via Catagory

IT support laptop image
Software Development cloud image
Terms & ConditionsPrivacy PolicyDeveloped by Evoke IT