Display the File Last Updated Date Using jQuery in SharePoint

In this example, assume there is a dashboard page on a SharePoint site that displays a number of graphs and charts. This dashboard is based on data contained in a single file located in a document library on the same site. Whenever this file is updated, the last modified date of the file needs to be automatically reflected on the dashboard page. This allows the page viewer to know the freshness of the dashboard data without requiring the content owner to edit the dashboard page itself with every data change. The following code will display the file last updated date using jQuery, the SharePoint Client Object Model (sp.js), and a bit of HTML. The formatDate function is used to format the file last modified timestamp in dd-mon-yyyy format.

Add a Content Editor Web Part to the dashboard page and include the following script in the source (or as a reference to a script file).

Change the FileUrl variable in getFileInfo() to the appropriate file path. When the code executes, it will replace the contents of the “data_last_update_date” container with the formatted last modified timestamp.

Base64 Decoding and Encoding in JavaScript

Base64 decoding and encoding in JavaScript is handled through the atob() and btoa() functions respectively. The following script provides a few text boxes to play around with decoding and encoding strings in Base64. The code can be copied to a local text file and opened in a web browser for a simple encoder and decoder utility. I created this utility to provide a local solution to decode Base64 encoded data instead of using one of the available online solutions since I didn’t know whether or not the submitted data is captured on the server.

Minimal Contact Form Plugin for WordPress

There are many contact form plugins available for WordPress. These plugins tend to be highly configurable in order to produce complex forms. They typically require some effort to set up even for the simplest contact form and, invariably, they never produce exactly what I need because they cater to a large user base with infinite data collection needs. I wanted a minimal contact form that allows a user to complete a basic, four field form in order to submit a message through the website with no set up involved.

The Minimal Contact Form plugin produces a simple form to capture Name, Email, Subject, and Message fields. When the user submits the form, the input is sent to the WordPress defined Admin email address. The look and feel of the form can be changed through your child theme’s style sheet, but it isn’t a mandatory step.

Once the plugin is installed and activated, the shortcode “mcf_contact” is used to display the form on the desired page.

Minimal Contact Form Plugin Code