Embedding your JavaScript into a SharePoint page

A very typical approach for client side development in SharePoint is to throw the code onto the page where you need it. You can alternatively put into the master page, but generally speaking, most code doesn’t need to run on each and every page. The following describes my preferred, tried and true, method of handling this.

Upload the Assets

Say you have some great JavaScript code provided by a developer or blogger, and you want to now use it on your page. First things first, get the JavaScript into your SharePoint site!

Upload the JS file into a library. I generally use SiteAssets, with a small folder structure for organization, like SiteAssets\js, or if there is more, sometimes like SiteAssets\webparts\mywebpartname.

Once the JS is uploaded, we now need a HTML file to reference it. This can be pretty simple HTML file. You can create it on your desktop (create a new text file, and rename the extension to .html) or using SharePoint Designer, you can create it directly in SharePoint. Throw it in the same place as your JS file, or however you have your assets structured.

As an example, we’ll take a block of code from one of my blog posts, we’re going to throw the necessary HTML and JS into the HTML file you created, something like:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="/SiteAssets/Lozzi.Fields.js" type="text/javascript"></script>

<script type="text/javascript">
Lozzi.Fields.disableWithAllowance("Start Date", ["Project Managers"]);
Lozzi.Fields.disable("Task Status");
Lozzi.Fields.hide("% Complete");

This is all the HTML and code needed to run the JS I’m working with. Notice Line 2, the second <script tag. This is the path to the JS file you uploaded into SharePoint. Make sure the path is correct. This block of code above will differ for each and every JS example you work with.

Once the HTML file is saved, navigate to it through your browser and copy the link to the HTML file. You can do this simply by clicking on the file’s ellipses, the …, and copy the URL from there

copy file link

Embed in SharePoint

Ok, now that we have the JS file uploaded, and a HTML file created, let’s embed it in SharePoint! This is the easy part.

Navigate to the page you want to use this code on. Just use your browser and click to go to the page, pretty simple so far right?

Now edit the page: click the cog in the top right and select Edit Page

edit page

Once the page is in edit mode, click Add a Web Part button at the top of a zone, it doesn’t matter too much where. If you don’t have an Add a Web Part button, you’re probably using a wiki page, so click anywhere in the content area where you want add a web part, then click Insert Web Part.

add content editor web part

In the Add web part ribbon, select Media and Content on the left, and then select Content Editor. Click Add to add to your page. You should have something like:

added content editor web part

Notice the Content Editor web part added. Now click the web part, in the top right, and edit the web part.edit web part

In the tool pane on the right, paste in the URL to the HTML file. Click OK.

past html link in content editor

Afterwards, your content editor web part may look empty, or you may see some of your HTML, it depends on what you’re working with. My example, I’m just using JavaScript to hide fields on my page.

save content editor

Save the page and you should be good to go! Your code should fire off and you should see things happening. If not, if you question what’s going on, try using the developer tool bar in your browser, more on how here.

A couple of notes:

  • You may want to modify the Content Editor Web Part’s Chrome Type setting to hide the title from view
  • If you receive the error “Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator.”, check the URL you’re pasting in. SharePoint can’t find it, make sure it’s valid. Paste it into a new browser window and see if downloads the file.
  • Make sure to structure your JS and HTML files well, you never know who’s going to look at it next.
  • Consider using the URL to the HTML file as a relative URL instead of a absolute URL. How? Consider the following URL is an absolute URL: https://sharepoint/sites/sitename/siteassets/myfile.js. Make it relative by dropping the first part: /sites/sitename/siteassets/myfile.js. This will keep it a wee bit more flexible and migrations in the future should be a little easier.

‘Til next time, Happy SharePointing!

Showing users’ profile pictures in a SharePoint list

Special thanks to Joann for the question!

A common use case is to have a list of people in a list in SharePoint, maybe they’re members of a project, contacts for a department, your favorite people to talk to, whatever it may be, you have a list. This example is a listing of my teammates:

slalom people list

Now I’d like to spice it up a little and see their pretty little faces. In my example, I’m just using the Title field to store their names (well, the Title field renamed to Name, regardless, same scenario). This won’y fly. We need to add a people picker to the list. I added one called Account Details. You could name yours Photo, Pic, Face, etc.

Add a people picker to the list, and add the correct values:sharepoint list with names

You can edit this view in Quick Edit mode, and copy/paste the Name column into the Account Details column.

Now let’s configure it to show their picture! (yes you could’ve done this with the above step, but for illustration purposes I add more steps)

When you edit the People Picker Field, check out the Show Field property.

edit people picker

See the few options at the bottom? Picture Only, select one. In my example, I selected 72×72

people pictures in sharepoint

BLAM! Profile pictures!!

Now I’ll let my team know I’m sharing their pretty faces.

‘Til next time, Happy SharePointing!

My Slides on Moving from SharePoint Online Public SPSNH

Thank you SPSNH for a great day of SharePoint! I love it when I get to speak AND attend AND learn something! SharePoint Saturdays are an awesome resource to us in the community. If you never heard of it before, check them out at spsevents.org. Well worth the day! By the way, it’s free!

Here are my slides from my talk, enjoy!

Moving from SharePoint Online Public

Speaking at SharePoint Saturday New Hampshire Oct 24, 2015

I’m excited to announce I’ll be speaking at this year’s SharePoint Saturday New Hampshire!

Microsoft has deprecated the SharePoint Online Public Website offering, leaving companies to find a new solution. We at Boston Office 365 User Group are also using the SPO offering. In this session we will walk through what your options are and some of the best practices for migrating to a new website provider. Microsoft recommends GoDaddy or Wix as great new hosting providers, is this true? Let’s find out!

Hope to see you there!

SharePoint’s Not Dead…. It Procreated!

SharePoint is amazing.

It has been great over the years. Seeing it grow up from a basic document library to a robust fully featured enterprise portal and content management, with search, taxonomy features, modern development methodologies, BI, an App Store and so much more.

Click the slides to watch the videos


Approximately at 30:45

And then things got serious. Office 365 stretched its arms out and took SharePoint in, and much like a caterpillar in a cocoon, SharePoint went dark. SharePoint has been in the cloud years before Office 365 came around, but it was only over the last year or so when has Microsoft shifted such focus to their cloud offering that it scared some of the older SharePointers. Rumors ran the interwebs saying Microsoft is getting rid of SharePoint. Office 365 is the beginning of the end for SharePoint….


I had the opportunity to attend Ignite this year, and it was great! Coming from SPC the year before I think a lot of people were expecting more SharePoint sessions. I saw a lot of SharePoint faces around the conference, and reconnected with many. SharePointers were there in full force. Then the great keynote session, and Satya didn’t say SharePoint! All we got was “collaboration tools”.


It’s true, SharePoint is dead

SharePoint Is Dead

Once we got in there and things started up we realized this wasn’t the case. SharePoint is not dead. There were more sessions on SharePoint then initially thought, a lot of them masked in sessions with words like Office 365, Azure and more. but there were more than 200 sessions available!


Approximately at 47:15

What happened? We thought SharePoint was dying! SharePoint was dark because, well, it was procreating, and everyone knows you don’t mess with a pregnant momma. SharePoint is now a proud momma of so many fantastic features like Delve, OneDrive, Video Portal, Microsites, Blogs, Cloud Search, and more! All of this awesomeness is only possible because of SharePoint.

Things Are Changing

SharePoint as we know it now is changing, rather growing, maturing, evolving.


Approximately at 7:40

It’s a great thing, it really is! If you’re a fan of Darwin, then you have accepted evolution, why not for SharePoint? It is happening at a much faster pace, and it costs a lot more money, but it’s a good thing. SharePoint may not be named ‘SharePoint’ in 5 years, but it will always be there, in the background.

SharePoint 2013 is Genesis block

So accept it, SharePoint isn’t going anywhere. Below are some key areas I found that will highly impact enterprises over the next year as Office 365 continues and SharePoint 2016 is released.

SharePoint 2016 – the last on-prem version?

Highly doubtful from where I’m sitting. Watch these two videos (below) showing off the new feature sets and paths for SharePoint 2016. It is very promising that Sharepoint will be alive and well on-prem for longer than we feared. In a few sessions it was said that Microsoft has changed their approach for on-prem: cloud first focusing on working and enhancing cloud then rolling that down to the on-prem installs. It’s a great model as the features are heavily tested well before they’re deployed into our production farms.

Check out The Evolution of SharePoint and What’s New for IT Professionals in SharePoint 2016, long list of new stuff!

Approximately at 45:40

Approximately at 45:40

Cloud Search Service Application

Approximately at 15:10

Approximately at 15:10

This is a new announcement, and starts in SharePoint 2013 later this year via a SP or CU. The Cloud Search Service Application will offload your search queries and indexes to the cloud, yes, really, a real hybrid seamless search experience. Your on-prem only needs the crawler, and the crawler then pushes everything to the cloud. This will work with SharePoint 2010/2013, FileShares and BCS! Enterprises don’t need a robust search farm anymore to store indexes with millions of items. Let Microsoft’s FAST team handle it. This should impact a lot of enterprises, freeing up some expensive hardware and hopefully reapplying performance to our end users ;)

OneDrive for Business

Approximately at 4:05

Approximately at 4:05

OneDrive was a huge topic during Ignite, lots of good sessions. OneDrive is Sharepoint’s oldest child. OneDrive is a SharePoint site with a library, and some very specific features targeted to that experience. There are some great improvements coming down the line, especially on the sync tool. My biggest joy comes from the new selective sync option


Approximately at 8:05

I’ve been waiting a long time for this. The new sync tool is based on their consumer version, which is solid and has millions of users.


Groups have been around for a little bit, Microsoft introduced them I believe late last year in Office 365. Groups allow you to create groups of users grouped together for a grouped goal… Groups will span Outlook, Yammer, Delve, OneDrive, etc.. It’s the new team idea, allowing you to create dynamic groups on the fly, add users and then relate content across these applications. Definitely feeling like the new team collaboration concept from Microsoft, however this is missing metadata, lists, etc. that SP does so well. I’m curious to see how team sites will fit in the coming months.

Approximately at 9:40

Approximately at 9:40

The above video goes to a deep dive, there is an overview session but the video isn’t available, yet.

NextGen Portals

A lot of the recent updates have been personal, focusing on the user base. What about the business? We have some new exciting pieces coming there as well. MS showed off some new portal templates which will fit 80% of businesses easily. The goal isn’t to replace the customization options currently available, instead provide new additional options for businesses to create rapid portals in lower amounts of time and effort.

Approximately at 2:00

Approximately at 2:00

  • Video portal. this has been out for a while. SharePoints second eldest child. It is based on SharePoint site collections, however videos are streamed from Azure Media Services.
  • Blogs. Announced to be released this week, have been reinvented in Office 365. They are beautiful rich experiences using a new authoring canvas, matching the latest blogging technologies from other mainstream blogging services. Rich text editing is clean and simple, no more ribbon.
  • Microsites. Appears to be replacing the publishing sites. These are the rich media experiences we’ve been used to. These have the same features as blogs, but on a larger scale.
  • InfoPedia. The new knowledge management center for businesses. Appears to be using the Delve interface some, and will roll up for multiple sources in SharePoint.

Auto save is coming as well! Especially to blog and microsites, SharePoint will auto save your page while you’re editing. For real, auto save page content…. I can’t wait!

What about on-prem NextGen Portals? No idea, the sessions were focused on O365, but I would expect these to be available onprem eventually, possibly with 2016?

What about team sites?

See Groups Above. Otherwise, nothing. Not one peep about team site improvements that I could see. Does that mean it’s going away? Maybe. Team sites, collaboration sites, do what they do really well. OneDrive, Groups, Delve introduces a new team concept, allowing users to spin up teams as needed. We’ll see where this goes.

So When?

The Office 365 improvements are all over the place. Watch the videos to find out more. Given the rapid update model things may be available by the time you’re reading this. As far as SharePoint 2016, it is scheduled for beta later this year and RTM by Q2 of 2016.

Approximately at 46:00

Approximately at 46:00

Approximately at 29:55

Approximately at 29:55

Nope, not dead

Microsoft is making great strides to improve the product base, adding amazingly rich, user-centric functionality that will only improve productivity and user adoption of these services. During the Evolution of SharePoint session it was stated a few times that there is no expectation all businesses will go to the cloud, and Microsoft will continue to improve on-prem as they go. I don’t see SharePoint dying out any time soon!

Disagree? Comment below!