Birthdays and Anniversaries

After much procrastinating and work, I finally revisited the Birthdays widget I introduced in JavaScript Templating with SharePoint 2013 (Part 3) about a year ago. The template was well received and liked by many. My initial post was prototype code with a handful of bugs. I’ve since worked fixed those bugs and converted the template to a web part. A web part? Yes..a web part. I know…I know. I should have used a SharePoint hosted app but a web part was too easy to resist! Maybe vNext???

Several people also asked if the original template could be extended to support anniversaries. I’m happy to announce that I finally found time to do that as well!

The Finished Product

Anniversaries

Continue reading

SharePoint Conference 2014 Wrap-Up – Takeaways, Highlights, & Lowlights

I was fortunate enough to attend SharePoint Conference 2014 (SPC14) in Las Vegas last week. I had a little time to reflect so I put a blog post together to wrap-up the conference from my perspective. First let me give some disclaimers.

  1. I wasn’t able to attend SharePoint Conference 2012 so I don’t have that reference point. I did attend SharePoint Conference 2011 in Anaheim though.
  2. SPC 2014 wasn’t before a major release so there wasn’t a ton of new and shiny things on display.
  3. I’ve worked on a handful of SharePoint 2013 projects so my perspective of “cool” may differ from some.
  4. I mostly attended developer sessions so I didn’t see everything. If I missed something, please, please, please leave a comment below or link to your blog post. I’m really hoping that we can build a web of reflections for those who weren’t able to attend.
  5. This is a very long post. I’m sorry.

With that being said, here are the takeaways, highlights, and lowlights I left Las Vegas with. Continue reading

Quick Tip: Change Search Result Page Client Side

One of the major limitation of the OOTB search navigation is that it is scoped to the web level. Not ideal for multiple subsites. Not practical for multiple site collections. So I was tasked with creating my own search navigation that was consistent across site collections.

All of the sites used the same master page so consistency wasn’t an issue. The challenge was changing the results page of the search box when the user clicks a different navigation element. Here’s how I did it.


<script>

EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function () {
   var boxId = $('#SearchBox').parent().attr('id');

   if (!boxId)
     return;

  var url = '/search/pages/myresults.aspx';
  var srchBox = $find(boxId);
  if (srchBox) {
    srchBox.set_resultsPageAddress(url);
  }

});

</script>

Office Web Apps ‘You don’t have access to this page’

Recently I had a request to show display a document in an iframe using Office Web Apps in SharePoint 2013. Pretty straightforward. In fact, Office Web Apps makes this easy. If you click the File tab in the ribbon > Share > and Embed the iframe html is right there for you.The iframe src attribute will look something like ‘http://yoursite/_layouts/15/WopiFrame.aspx?sourcedoc=blahblah&action=embedview.’ Sweet!

The Problem

I used the code as is and thing worked great…I thought. Randomly I would get a message stating “Sorry, you don’t have access to this page.”

Continue reading

JavaScript Templating with SharePoint 2013 (Part 3)

Update: I’ve since converted this template to a configurable web part. See http://www.lestersconyers.com/birthdays-and-anniversaries/ for latest.

Welcome to Part 3 of JavaScript Templating. In this post we will use the SharePoint 2013 Search API to build a Birthdays web part based on user profile data. And my procrastination worked for the good because today is actually my birthday! As in the last post I will be using jQuery to retrieve data and Handlebars to build my HTML.

The Finished Product

I’ll be building a template the renders upcoming birthdays. The display is based on Facebook’s birthday reminders. And as an added bonus, we’ll allow you to post a “Happy Birthday” message to the birthday boy’s (or girl’s) news feed.
birthdays list

Continue reading

JavaScript Templating with SharePoint 2013 (Part 2)

Welcome to Part 2 of JavaScript Templating with SharePoint 2013. In part 1 I tried to lay a foundation for the next posts. If you haven’t read it, I’d suggest you at least breeze over it so this post makes a little more sense.

As I mentioned in the first post, generally speaking when it comes to JavaScript templating there are 3 players involved: a data source, a data retrieval mechanism, and a template. I also mentioned that we SharePoint developers should also keep in mind that our code should be able to exist on any page the user chooses.

As with the remaining posts in this series, jQuery ajax will be my data retrieval mechanism and I’ll use Handlebars as my templating engine. In this post I’m going to leverage a SharePoint list named Events as my data source.

The Finished Product

Below are some screenshots of the finished product. The template lists upcoming events. Clicking the event title reveals more details.

Collapsed

Events

Expanded

events_expanded

Continue reading

JavaScript Templating with SharePoint 2013 (Part 1)

After a very long hiatus I am back hoping to contribute to the SharePoint community. It’s been too long. Today I want to touch on a subject that is getting much traction in the MVC and front end development realm: JavaScript templating. These developers have been quick to utilize client-side templating to build slick and user friendly applications. Beauty is nice but the major benefit is a no-brainer: increase performance due to a decrease in response payloads.

Although the benefits are awesome and obvious, the presence of client-side templating is rare in the SharePoint space, I don’t see it very much. I don’t even hear it talked about often. Let me say that I’m not dissing any one. I’ve been known to revert back to server side web parts in a New York minute. I think several SharePoint developers do the same. It’s because that’s what we’re comfortable with. It’s what we’ve done in SharePoint for years and it works over and over again. It’s like tradition! But a wise man once said “It’s also a tradition that times must and always do change my friend.” [2 bonus points to whoever can name that movie!]

This will be part 1 of a 4 part series involving JavaScript templating. In this post I’m going to lay a foundation for the next 3 posts. This one is heavy on text. The others will be heavy on screenshots and code…I promise!

Continue reading

How to Deploy Display Templates in SharePoint 2013

A few months ago I posted a question on an MSDN forum asking how to deploy display templates via feature. Several people had suggestions but John Ross provided many helpful comments that really made me think. Even now, I’m not 100% sure what the “best practice” is but hopefully I can lay out the options I’ve found and you can make the best decision for your situation.

Continue reading

Refiners on OSSSearchResults.aspx page

In SharePoint 2010 you can customize the refinement panel on the results page of a search center. Unfortunately the default search scope “This Site” uses the OSSSearchResults.aspx page. This is a layouts page so you cannot edit the refiners or add new refiners. So if you wanted cool and custom refiners added, you had to force users to use the search center. Once you force them to use the search center they lose the “This Site” scope if they attempt to search from the center. A big mess.

This solution allows you to have your custom refiners and the osssearchresults page.

Continue reading

Extending Search Web Parts

Here is code sample showing how to extend the search core results web part in SharePoint 2013. This can also be used for the content by search web part because it inherits from the search core results web part. In this sample I modify the query programmatically to retrieve items with metadata that matches a claim for the current user. This would be really helpful if you want to target content for a customer based on their demographics or browsing history. You know…like the Disneyland ads that appear in GMail a day after you research a Disneyland vacation :) .
Continue reading