SharePoint 2013 PDF Preview List Item using Office Web Apps

Found this useful script from:

Copy this Code to a file called preview.js:

function WictorsPdfPreviews() {
    SP.SOD.executeOrDelayUntilScriptLoaded(function () {
        filePreviewManager.previewers.extensionToPreviewerMap.pdf = [embeddedWACPreview, WACImagePreview]
        embeddedWACPreview.dimensions.pdf= { width: 379, height: 252}
    }, "filepreview.js");

Upload this script as a js file to your script library.
Modify your MasterPage and add this line in the head:

<SharePoint:ScriptLink ID="ScriptLink9" language="javascript" name="~sitecollection/SiteAssets/scripts/pdfpreview/previews.js" runat="server" LoadAfterUI="false" />

The result now operates the same as a Word document preview:

Installing SPEasyForms in Farms Where Sandbox Solutions are not an Option

SPEasyForms - Joe McShea

Occasionally, I get asked how SPEasyForms can be installed in a farm where Sandbox solutions have been disabled by the farm administrators. This blog post will provide instructions for how to do just that. This blog post will talk specifically about installing SPEasyForms v2015.06, which is the latest version as I’m writing this, but if you’re trying to install a later version as you’re reading it you will have to adjust the paths to point to the newer versions of the files.

The first thing you have to do is get the files. Go to the downloads page on

Assuming you don’t already have the files on your SharePoint site:

  • Click on the download and save it to your computer.
  • Unzip the file (you should have an SPEasyFormsAssets folder with a bunch more folders and files inside of it)
  • Copy the entire SPEasyFormsAssets folder to the Style…

View original post 251 more words

Add Button to web part to Open any address in Dialog box

This is a script that you can use for SharePoint 2010 (untested in SharePoint 2013)

I currently use this script to open a list item’s NewForm.aspx page.

But you can use it to display and web address in a pop-up dialog.

And no JQuery is required!

Added notifications, if Ok or Cancel buttons clicked in the dialog.

Open Link button

dialog windows
Any URL can be displayed in Dialog

To test it out, just add this code to a txt or html file and link it to a Content Editor Web Part

<script type="text/javascript">

function portal_openModalDialog() {
var options = SP.UI.$create_DialogOptions();
options.url = "/_layouts/Upload.aspx?List={327D2CF7-F385-4969-8973-E6FD3908A996}&RootFolder="; //Change the URL to the page you require.
options.title = "Title of Dialog Window";
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
function CloseCallback(result, value) {
if (result === SP.UI.DialogResult.OK) {
SP.UI.Notify.addNotification("Your request has been submitted");
if (result === SP.UI.DialogResult.cancel) {
SP.UI.Notify.addNotification("Request cancelled");

<button name="button" type="button" onclick="javascript:portal_openModalDialog();javascript:return false;" href="#" target="_self">Open Link</button>

Pastebin Version: (opens in new tab)

SharePoint display DOCX XLSX Thumbnails in Library

Just found this useful unknown feature for uploading and displaying DOCX or XLSX image cover thumbnails in a SharePoint 2010 Asset Library.

This works using SharePoint 2010 and a default Team Site template on a non-Publishing site, straight out of the box.

For Word and Excel 2010 and higher, when a Document is Saved As, there is a Save Thumbnail checkbox.



Select Rich Media Asset as Content Type; Video Content Type also works.





So far I have tried DOCX, XSLX, PPTX files.

PDF files do not display at this stage.

My next challenge is to get the Rich Media Content Type into an existing Document Library.

I’ve done some research and couldn’t find any other posts relating to this.
If anyone know of any, post them in the comments section.


Thanks for reading.

Skype Lync 2013 Presence Indicator Web Part

This post is to embed a users Skype for Business (Lync 2013) presence indicator in a Content Editor Web Part for SharePoint 2010.

From reading this post:

The code works exactly for SharePoint 2010, though I’ve added a Sype button and when clicked opens the Chat window in Skype.

sype button




  • Replace the paths below with your SharePoint path.
  • Replace my name with another email address or SIP Address.
  • Download the the Skype image below and upload it to the same folder as the code below.
<script type="text/javascript" src="/sites/SP2010/_layouts/1033/init.js"></script>
<script type="text/javascript" src="/sites/SP2010/_layouts/1033/core.js"></script>
<style type="text/css">
img.presenceIndicator {
border-style: None;
height: 12px;
width: 12px;
border-width: 0px;
vertical-align: middle;
<img id="uniqueID" onload="IMNRC('',getElementById('uniqueID'))" showofflinepawn="1" src="/sites/SP2010/_layouts/images/blank.gif" class="presenceIndicator" />
<a href="">Brett Anderson</a>
<a href="">
<img width="86" height="32" role="Button" style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: -41px; BORDER-BOTTOM: 0px; MARGIN: 10px; BORDER-LEFT: 0px" alt="Skype chat, instant message" src="/sites/SP2010/scripts/Sypebutton/chatbutton_32px.png"></a>


Image button to upload to SharePoint server.

Save list item as PDF file from Display Form using SWF buttons

This article explains how to add swf Flash buttons using TableTools to your List View and Default Display Form.

I’ve tested this in SharePoint 2010, using IE8. I have not tested this in SharePoint 2013 but it would work there too.

This is a pure front-end solution, using only SP Designer or notepad for those on a locked down intranet.

The only requirement is that your browser needs to be able to display Flash and SWF files.

The original post and code came from Danish Islam, which explains the how the code and buttons are linked to a List View.

Use jQuery Datatables for SharePoint List Webpart with export to CSV, EXCEL, PDF and Print features

The buttons contained in jQuery Datatable TableTools are:

Copy, CSV, Excel, PDF, Print.


This is the result of adding the script to the List View:


Note: The search box is live “Search as you type” filtering the list. The paging is Ajax and loads instantly.

All that you require are:

  • The files to be uploaded
  • Change the file paths in the the code
  • Change the file paths of the images in the CSS files.
  • Add a Content Editor Web Part to your List View or Display Form view.

If you place this script in a content editor web part above a list view, the full affect of Datatable Tabletools will be displayed.

Also, important note: Use the jQuery.js file that comes with the Datatables Zip Package.  Using jQuery v1.12 the buttons did NOT display and it took me a couple hours to determine it was the jQuery.js file.

<style type="text/css">
.even, .odd, .sorting_1 {
 background-color: transparent !important;
.dataTable THEAD TH {
 border: 0 !important;
<script type="text/javascript" src="/scripts/datatables/jquery.js"></script>
<script type="text/javascript" src="/scripts/datatables/jquery.dataTables.min.js"></script>
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/jquery.dataTables.css">
<script type="text/javascript" src="/scripts/datatables/dataTables.tableTools.js"></script>
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/dataTables.tableTools.css">

<script type="text/javascript" >
 $(".ms-listviewtable").prepend($("<thead></thead>").append($(".ms-listviewtable").find("tr:first"))).DataTable({"sDom": 'T<"clear">lfrtip', 

 "tableTools": {
 "sSwfPath": "/scripts/datatables/copy_csv_xls_pdf.swf"
 // Change this path according to file location 



For a List Display Item, I removed the CSV and Excel buttons and also added an “Email Link” button.


<style type="text/css">
.even, .odd, .sorting_1 {
background-color: transparent !important;
.dataTable THEAD TH {
border: 0 !important;
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/jquery.dataTables.css">
<link type="text/css" rel="stylesheet" href="/scripts/datatables/css/dataTables.tableTools.css">
<script type="text/javascript" src="/scripts/datatables/jquery.js"></script>
<script type="text/javascript" src="/scripts/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/scripts/datatables/dataTables.tableTools.min.js"></script>
<script type="text/javascript">
$(".ms-formtable").prepend($("<thead></thead>").append($(".ms-formtable").find("tr:first"))).DataTable({"sDom": 'T<"clear">rt',
"tableTools": {
"sSwfPath": "/scripts/datatables/copy_csv_xls_pdf.swf",

"aButtons": [


"sExtends": "copy",
"sButtonText": "Copy to clipboard"
"sExtends": "pdf",
"sButtonText": "Save as PDF",

"fnComplete": function ( nButton, oConfig, oFlash, sFlash ) {
SP.UI.Notify.addNotification('<img src="/_layouts/images/loadingcirclests16.gif" style="vertical-align: top;"/> PDF Exported to file ...',false);

"sExtends": "print",
"sButtonText": "Print this item"


"sExtends":    "text",
"sButtonText": "Email link",
"sButtonClass":  "DTTT_button_csv",
"fnClick": function ( nButton, oConfig, oFlash ) {
window.location='mailto:?subject=' + document.title + '&body=' + window.location;
} // end of tabletools




The Saving to PDF button is the only front-end solution I have found that works without for IE8 and SharePoint 2010.

Any comments, questions, hit me up. Enjoy.


Display Todays Date in a Calculated Column with Javascript

Here’s what I used to display Today date in a Calculated Column with nothing but JavaScript in SharePoint 2010.

After a lot of research and trial and error, I finally have it displaying:

To display a date like this: 17/5/2015

Use this code:

=CONCATENATE("<p id='mydate'><script>var currentDate = new Date();var day = currentDate.getDate();var month = currentDate.getMonth()+1;var year = currentDate.getFullYear();document.getElementById('mydate').innerHTML = ( day + '/' + month + '/' + year );</script></p>")




Don’t forget to use data type returned as Number(1, 1.0, 100) This will convert the code to HTML

For U.S. Date, just swap the day and month over like this:

( day + ‘/’ + month + ‘/’ + year )

( month + ‘/’ + day + ‘/’ + year )


Update: The above code will only work for the first entry as the id name, i.e. ‘mydate’, needs to be unique.

So all you need to do is use another column that has Unique values, like a counter, or you could even combine two columns as thus:

 =CONCATENATE("<p id='"&PosNum&""&[First Name]&"'><script>var currentDate = new Date();var day = currentDate.getDate();var month = ('0' + (currentDate.getMonth()+1)).slice(-2);var year = currentDate.getFullYear();document.getElementById('"&PosNum&""&[First Name]&"').innerHTML = ( day + '/' + month + '/' + year );</script></p>"

The above code works and displays todays date for every Item.

 Date will now show as 20/05/2015

Hope this saves you some time 😉