Archive for the ‘SharePoint’ Category

SharePoint New Item Form Actions

The following post describes 3 of the many new Form Actions available in SharePoint.

Cancel:
This example shows how to return to home page after user cancels creating the item.

Pre-Save:
This example shows how to show an alert and wait for OK or Cancel action.

Post-Save:
This example shows how to return to home page after user creates the item.

Do make a note that above code requires the Jquery is referenced in the page.

Sharepoint list quick edit not available?

When you are vieweing a custom view and don’t see the “Edit” menu also called as “Quick Edit”, make sure that particular view has the “Tabular View” configured. This is one of the reasons why sharepoint list’s quick edit is not available in custom viewes.

Steps to configure “Tabular View” to enable quick edit.

  1. Goto -> List Settings -> Views -> Click on the view where the “Edit” doesn’t show up
  2. In the view edit page, expand “Tabular View” if not already expanded
  3. Check the “Allow individual item checkboxes ” checkbox.
  4. Click “OK” to save the view settings

Now the quick edit should have been enabled.

Note: This is applicable for modern view available in Office 365, SharePoint 2016 & SharePoint 2013.

Display attachments using JSLink in SharePoint

Recently I had a requirement where the customer wanted to show the actual attachment’s URL in the list view instead of default Icon. Following JSLink code will help to do that.

Source: https://social.msdn.microsoft.com/Forums/office/en-US/29f7998f-ffc5-4877-b975-a49631b53ba2/show-attachments-with-jslink?forum=sharepointdevelopment

Change SharePoint’s “there are no items to show in this view” message

When a list has not data to be shown in the view, we see the following message.

There are no items to show in this view of the “<ListName>” list.

The following JSLink script helps to change this message.

Source: http://www.idubbs.com/blog/2015/jslink-csr-to-override-there-are-no-items-to-show-in-this-view/

Displaying SharePoint user presence indicator in CSR

The following are code snippets which can be used to show a user’s Lync/Skype for Business presence status in SharePoint Client Side Rendering (CSR).

Default Render

With Picture Detail View

With Picture

Presence Only

Picture Only

Source: http://www.sharepointcolumn.com/lync-presence-indicators-code-snippets-in-sharepoint-2013/

Remove duplicate list items from SharePoint REST call result using JavaScript

The following code snippet show how to remove duplicate list items in the JSON result of a SharePoint REST call using JavaScript.

Function Definition:

Function Usage:
In the below code, assumption is that, the REST call returns data.d.results and the column for which duplicate items need to be removed is Title

 

JSLink URL Tokens in SharePoint

Following are some of the JSLink URL Tokens I have come across in SharePoint.

  • ~site – reference to the current SharePoint site (or “Web”)
  • ~sitecollection – reference to the current SharePoint site collection (or “Site”)
  • ~layouts – version specific reference to the web application Layouts folder (so it will automatically swap out /_layouts/14 or /_layouts/15 for you)
  • ~sitecollectionlayouts – reference to the layouts folder in the current site collection (e.g. /sites/team/_layouts/15)
  • ~sitelayouts – reference to the layouts folder in the current site (e.g. /sites/teams/subsite/_layouts/15)

Few Examples:

Source: https://www.martinhatch.com/2013/08/jslink-and-display-templates-part-1.html

Refresh web part without refreshing page in SharePoint

The following code shows how to refresh web part without refreshing page in SharePoint.

Source: https://pradiprathod.wordpress.com/2015/05/04/how-to-refresh-list-view-in-sharepoint-2013-using-javascript/

Load multiple JavaScript files in SharePoint JSLink

To load multiple JavaScript files in SharePoint JSLink, insert a pipe symbol between multiple JavaScript file links in the JSLink field of webpart’s properties.

JSLink Field Example:

A piple symbo is a “|” without quotes

Source: https://egilhansen.com/2013/03/11/jslink-the-simple-way-to-add-and-load-multiple-javascript-files/

Load scripts in SharePoint within custom Javascript or Workflow

Following is the code which can be used to load JavaScript in sequence.

Source: https://sharepoint.stackexchange.com/questions/92082/uncaught-typeerror-cannot-read-property-get-current-of-undefined

Return top
 
Optimization WordPress Plugins & Solutions by W3 EDGE