Scenario: When you navigate to a custom search page, the Search Results web part is already populated even though you haven't searched for anything yet. You want the Search Results web part to remain empty until a user searches for something. Solution: Wrap the query template. {?{searchboxquery}} 1. Edit the page 2. Edit the Search … Continue reading Keep Results Empty Until User Searches
Web Part
Custom XSL Web Part Error – Access Denied
Scenario: I created a custom XSL style sheet for a library web part that would intermittently throw an error for everyone except the admin account (me). Every morning users were complaining about an error on the web part. I would sign in and try to replicate, but it always worked for me. Then when I'd … Continue reading Custom XSL Web Part Error – Access Denied
Chart Web Part – SharePoint 2013
In SharePoint 2010, there was a Chart Web Part that you could connect to another web part on the same page, to a list anywhere in the site collection, to an external content type, or to data from an Excel workbook. In SharePoint 2013, this does not exist OOB. However, if you copy and paste this code … Continue reading Chart Web Part – SharePoint 2013
Edit Form Popup – Drag And Drop
By default, the edit form does not pop up when you drag and drop documents into a library. This piece of JavaScript will force an edit form to pop up for as many documents you drag and drop. For example, if you drag 5 documents at the same time, 5 individual edit forms will pop … Continue reading Edit Form Popup – Drag And Drop
Library Paging – First Page Button
Adding a "First Page" button is a simple work around for getting back to the first page when paging through documents. This is especially handy if you use document sets. Edit the page and add a Script Editor web part. Click EDIT SNIPPET. Embed the following code: I moved the Script Editor web part down below the … Continue reading Library Paging – First Page Button
Custom Quick Edit Button
To add a custom Quick Edit button to a page or view, add a Script Editor Web Part and embed the following code. Make sure you change the number in [WPQ2SchemaData] to the ID of the Web Part you want to Quick Edit. You can find that by inspecting the list or library Web Part using … Continue reading Custom Quick Edit Button
Audit Web Part Locations
Through PowerShell, you can export a csv list of every single app and web part and the URLs where they exist. This is useful for keeping track of where apps are visible and who has access to them. The script will prompt you for the URL. Enter the entire URL of the top site collection site. For … Continue reading Audit Web Part Locations
Filter Items By First Letter
Copy the following JavaScript into notepad and save it as a .txt file. Upload this text doc to the Site Assets library. Create a calculated column on the library you want to filter and name it "FL". Add this to the Formula field: =IF(ISNUMBER(INT(LEFT(Title,1))),"0-9",LEFT(Title,1)) Add a Content Editor web part to the page and open … Continue reading Filter Items By First Letter
Show Files & Library Tabs
Problem: You want the Files and Library tabs to be visible when you browse to a page with multiple web parts. Solution: JavaScript! Add this to a Script Editor web part on the same page. You may need to change "MSOZoneCell_WebPartWPQ2" to the web part ID of the web part you want to focus on. … Continue reading Show Files & Library Tabs
Disable Drag And Drop
This handy piece of JavaScript will disable the drag and drop function for all library web parts on a single page. Other upload options will still work. Just paste this into a Script Editor web part: