Office 365. PnP Provisioning – Hide default Title column and Enable menu for Other Custom Text Column

Introduction

Playing with PnP Provisioning is funny as you have different set of features and requirements you can achieve when provisioning sites.

Last month I found sort of bug at version v2.4.1605 of PnP Core: Can not Convert Object when provisioning pnp:file Display Template.

Working with the same version I had a requirement to provision a Content Type that inherits of Item but we MUST hide OOTB Title column and provision List Instance, bind the Content Type to the new List and enable contextual menu on the Custom_Title field.

If it is the first time you use the PnP Provisioning, please highly recommends you look into this GitHub page (where MS publish the PnP Core solution).

Using PnP Provisioning:

I will quick remind a step by step to start using PnP Provisioning:

  1. Create Console Application to invoke PnP Core classes.
  2. Add Packages needed using Package Manager Console. Here is how my packages.config looks like:

    Now, we can see OfficeDevPnP.Core in our Project References:

    image

  3. Create a function to read the XML file (Provisioning Template) and Apply it to Web object on SharePoint or Office 365.

  4. Call this function from Main method but before configure your environment settings.

  5. Create a two folders in your Project:

    • Assets folder: where you can put all the files you need to provision (Display Templates, Master Pages, JS, CSS, Page Layouts, WebParts, etc.)
    • Config folder: where you can put all your Provisioning Template xml files.
  6. Create Site Collection level Provisioning Template (JQ.SiteCollection.Template.xml):

    In this case, we will Provision:

    • A new Hyperlink field.
    • A new Text field used as a Custom Title. It is important to use these four attributes to enable the field as a Link and Menu in the SharePoint views:

      1
      2
      3
      4
      LinkToItemAllowed="Required" 
      LinkToItem="True"
      ListItemMenuAllowed="Required"
      ListItemMenu="True"

      Thank you Dario for your post: Linking a custom column to the Item and the Item menu.

    • A new Content Type that inherits of Item but with the two new fields previously created and OOTB Title column hidden.
  7. Create Sub-site level Provisioning Template (JQ.Resources.Template.xml).

    A new list will be provisioned using and binding to the previously created Content Type.

Conclusion

This is how the solution looks at the end, and we have meet two requirements:

  • Hide OOTB Title column.
  • Enable menu on QuickLinks Title column. image image Using traditional provisioning approach that isn’t as easy as configure a XML file.

 

Author: José Quinto
Link: https://blog.josequinto.com/2016/07/11/office-365-pnp-provisioning-hide-default-title-column-and-enable-menu-for-other-custom-text-column/
Copyright Notice: All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.