Document Follow option missing in Custom Document Library


In SharePoint 2013, you can Follow people, documents, sites, and tags.  Out of the box when you create a document library, for each item you will find Follow option (both in Ribbon and Callout). 

When you create custom document library using Visual studio (the ListTemplate Type value for custom library as recommended should be over 10000).  After deploying this list template, when you create a document library based out of this custom list template, you will notice that “Follow” option is missing at document level.  It’s because the follow option is shown based on the ListTemplate Type attribute value and it works if the value is 101 (DocumentLibrary)

imageimage

The ListTemplate type provides a unique identifier for the template. This identifier must be unique within the feature, but need not be unique across all feature definitions or site definitions.  So if you want to show follow option in your library (based out of custom list template), you need to create custom list which has ListTemplate Type value set to “101”.


Comments (2)

  1. @Carl - This works too, nice job!!

  2. Carl-Johan says:

    Hi!

    Just found another solution to this. By default sharepoint only adds the follow option to ListTemplate 101 and 700, this is had coded. To also add the follow option to your custom template, just create a javascript file that you include in your master page with the following code (12000 beeing the template id);

    var renderFollowFooter = function (renderCtx, calloutActionMenu) {

       if (renderCtx.ListTemplateType == 700)

           myDocsActionsMenuPopulator(renderCtx, calloutActionMenu);

       else

           CalloutOnPostRenderTemplate(renderCtx, calloutActionMenu);

       var listItem = renderCtx.CurrentItem;

       if (typeof (listItem) === 'undefined' || listItem === null) {

           return;

       }

       if (listItem.FSObjType == 0) {

           calloutActionMenu.addAction(new CalloutAction({

               text: Strings.STS.L_CalloutFollowAction,

               tooltip: Strings.STS.L_CalloutFollowAction_Tooltip,

               onClickCallback: function (calloutActionClickEvent, calloutAction) {

                   var callout = GetCalloutFromRenderCtx(renderCtx);

                   if (!(typeof (callout) === 'undefined' || callout === null))

                       callout.close();

                   SP.SOD.executeFunc('followingcommon.js', 'FollowSelectedDocument', function () { FollowSelectedDocument(renderCtx); });

               }

           }));

       }

    };

    var registerOverride = function (id) {

       var followingOverridePostRenderCtx = {};

       followingOverridePostRenderCtx.BaseViewID = 'Callout';

       followingOverridePostRenderCtx.ListTemplateType = id;

       followingOverridePostRenderCtx.Templates = {};

       followingOverridePostRenderCtx.Templates.Footer = function (renderCtx) {

           var renderECB;

           if (typeof (isSharedWithMeView) === 'undefined' || isSharedWithMeView === null) {

               renderECB = true;

           } else {

               var viewCtx = getViewCtxFromCalloutCtx(renderCtx);

               renderECB = !isSharedWithMeView(viewCtx);

           }

           return CalloutRenderFooterTemplate(renderCtx, renderFollowFooter, renderECB);

       };

       SPClientTemplates.TemplateManager.RegisterTemplateOverrides(followingOverridePostRenderCtx);

    }

    registerOverride(12000);

Skip to main content