question

ReneWagner-1403 avatar image
0 Votes"
ReneWagner-1403 asked ReneWagner-1403 commented

SharePoint 2016 - Custom Page - SharePoint Search Box Web Part missing for users with less than 'Member' access

Hello,

I have an on-prem SP 2016 site where we created a custom page. On that page we added a Search Box web part that uses a custom Search box control Display Template. The page saves just fine and as the user that created the page (Site Admin) I can browse to the page and the Search Box control appears as expected and I can run a search.

If I access the page as a Site Member, the page also works fine and the search box is displayed and is functional.

However, if I access the page as a Site Visitor, when the page loads, the Search Box is not displayed. Instead I get an error that seems to indicate that the display template cannot be found -- but I know it exists and works if logging in as a Site Admin or Member user.

I checked the permissions on the JS and HTML files associated with the display template we created and it appears to match what the out-of-the-box display templates have, so permissions on the template appear fine.

Why would a user with Visitor (View Only) access not be able to see the Search Box on a page? What am I missing?

Thanks

office-sharepoint-server-customizationoffice-sharepoint-server-search-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AllenXu-MSFT avatar image
0 Votes"
AllenXu-MSFT answered ReneWagner-1403 commented

Hi @ReneWagner-1403 ,

  • What is the page type of your custom page? If it is a pblishing page, make sure it is not a draft and has been published.

  • Be sure that you have published the JS and HTML files associated with the display template in the master page gallery. If you have published it already, try to re-publish it.

  • Did you get an error like below? Kindly share here the screenshot of the error. In 99 percent of the cases, this error is related to a bug in the code. That one percent will probably be related to someone that has deleted or moved the template. So if that is the case, you will have to put it back in place.
    146458-image.png
    As the error does not say much, the best way to solve it is to open your browser developer tools (f12) and go to the console first. In the browser console, check if there is an error logged. In most cases when you wrote a bug in the display template, you will see it in the console like in this example:
    146438-image.png
    If you click on the file link, the developer tools load the file and shows you where the error occurs.

  • Also you can check the SharePoint ULS logs, find if there is any related clue to hte error in the ULS logs.


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.


image.png (44.3 KiB)
image.png (19.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks -- I did not realize the display templates were not actually 'published' when I added them. I would have expected an error to occur for anyone that tried to access other than myself. But Site Members were able to see the templates apparently, even though they had not been published. Once I republished all was well.

1 Vote 1 ·