in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, Office 365 / SharePoint Online and Visual Studio 2013.

December 2013 - Posts

  • Using display templates to feature new search results in SharePoint 2013

    For many versions of SharePoint, you have been able to configure the number of days the new indicator shows up on a document in a library.  For example, here is how a new document is indicated in a document library.

    SearchDisplayTemplateDocumentLibraryNewIcon

    I’ve worked with a number of user experience designers and they are always adding these new indicators to the search results wireframes.  Today we’ll look at a relatively simple technique to show this indicator on the search results screen.  I’ll assume you have some basic knowledge of display templates so I won’t go through all of the basics.  There are plenty of posts out there to help you get stared with that. 

    For my example today, I wanted to show a new indicator for all documents regardless of what result type happened to be used.  This means we need to modify the file Item_CommonItem_Body.html.  Normally, the best approach for display templates is to make a copy of an existing one and then modify it.  However, we don’t have this option when we want to make the changes global.  My recommendation is to keep a working copy of this file somewhere before you make modifications.  However, if you really mess it up, you can always grab a working copy from another site collection. 

    To modify the display template, go to the site collection hosting your search center and go to Site Settings.  Go to Master pages and page layouts and then navigate to the folder Display Templates –> Search.  Here you will find the Item_CommonItem_Body.html file.  You can either download a copy of the file or simply click the Library tab and look for the Open with Explorer icon.  From there we can edit the HTML file and make our changes.

    SearchDisplayTemplateMasterPageLibrary

    The Common Item Body file display a lot of the key fields that you see in all search results such as the title, hit highlighted summary, and URL.  We need to write a few lines of JavaScript.  We effectively want to determine the date associated with the file and compare it to another date to determine if the file is “new” or not.  In my case, I went with anything in the last 60 days.  I admit this is not very new but worked well for my demo content.  We’re going to set a new variable isNew and then use it later to display our new indicator.  Here’s the JavaScript.  I inserted this in the main script block just before the line starting with “var clickType” (around line 65).

    var isNew = false;

    var newDate = new Date();

    newDate.setDate(newDate.getDate()-60);

    isNew = ((new Date(ctx.CurrentItem.LastModifiedTime)) > newDate);

    We’re going to add our new indicator right next to the Title of each search result.  To do this, look for the _#= titleHtml =#_ line.  We’ll add our code after that.  First create a JavaScript block to check if isNew is true.

    <!--#_

                if (isNew) {

    _#-->

    Then we add the code to add our new icon.  In this example, I am using the same one from the document library.  I found the necessary HTML by using the IE developer toolbar.  One customization I made to this is that I added the LastModifiedTime to the title tag of the image so that you can see the date when you hover over the icon.

    <span class="ms-newdocument-iconouter"><img title="New - _#= ctx.CurrentItem.LastModifiedTime =#_" class="ms-newdocument-icon" alt="New - _#= ctx.CurrentItem.LastModifiedTime =#_" src="/_layouts/15/images/spcommon.png?rev=31"></span>

    Now we need to close our if statement with another script block.

    <!--#_

                }

    _#-->

    Now, we just need to save our file and see the results.  Execute another query from your search center and the items that are new should now be indicated.  In the example below, the resume and the XML file are new.

    SearchDisplayTemplateNewIcon

    I showed this to @JennferMason and she thought this was neat but thought we needed a better new indicator.  So then I decided to use the one on the site content page.  Again, I used the developer toolbar and replaced the HTML with the following.

    <span class="ms-vl-recent ms-textSmall" id="recent-c831c747-a40d-4cb1-9e8c-3da27e089e19">new!</span>

    Here is what it looks like now.

    SearchDisplayTemplateNewText

    You could even combine the two if you really wanted.  Use whatever works for you.  Now, what I will say about this technique is that search looks at the date the file was last modified and not the date that it was uploaded to SharePoint.  That means if you worked on a document offline and haven’t touched it in three months and then decide to upload it, it would not be considered “new”.

    This is just a simple example of some of the things I’ll be showing in my display templates talk at SPC14 this year.  If you are interested in learning more, be sure and attend that session!

  • Year in Review: 13 SharePoint highlights for 2013

    It’s been a big year and I thought I would take a moment today to cover some of the SharePoint highlights for 2013.

    1) SharePoint moves to a “services-first” offering

    Wave 15 of Office brought us a number of new features to SharePoint Online including improved search, IRM, and more.  Although the SharePoint Online offering still doesn’t have features that on-premises has, we are moving into an era where Office 365 is going to be getting features before anything else now.  That means if you want the latest and greatest features, you should be using SharePoint Online.  A good example of this is Power BI for Office 365.  That doesn’t mean on-premises is dead, but it does mean you will be waiting a while before getting new features.

    2) Microsoft confirms on-premises isn’t dead

    People have been predicting the upcoming demise of on-premises for a while now.  A lot of this was really do to unclear messaging.  While it is obvious that Microsoft is focused on the cloud, it wasn’t obvious about the future of the upcoming server products.  In the last month or so, the messaging has made things cleared with Bill Bear reiterating updates are coming as well as Jeff Teper has been commenting in the SPYam group.

    3) Confusion about release cadence of on-premises cleared up

    At SPC12, Microsoft stated that the release cadence was changing for SharePoint.  However, there was quite a bit of confusion there too.  Did this also include SharePoint on premises?  The answer is a resounding no.  In general, organizations are barely equipped to complete an upgrade of SharePoint once every three years let alone on a more frequent basis.  Bill Baer’s post also confirmed the 2-3 year release cadence of on-premises versions will continue.

    4) The year of Yammer

    Alright, so every year is going to be the year of Yammer for a while.  Yammer is great and people want it now, but we know that integrating a service like this is no easy task and isn’t going to happen over night.  Enterprise Social is huge and customers have to make a big of a gamble on the direction they choose.  The out-of-the-box social features in SharePoint 2013 probably meet a lot of your customer’s requirements.  However, with the acquisition of Yammer, it’s hard to say how much investment you want to make there.  If you ask Microsoft, they will say choose Yammer every time, but until the integration effort makes more progress there is going to be a bit of a disconnect for users.

    5) Service Pack 1 announced for SharePoint 2013

    Service Pack 1 was announced to be coming early next year.  As a reminder, the goal of a service pack is to roll-up fixes and provide a new baseline for support.  So if you are expecting a heap of new features to come to on-premises as a result, I wouldn’t get your hopes up.  Not to say that it’s not possible though. For example we got the preupgradecheck command for stsadm back in SP2 for SharePoint 2007.  However, just keep in mind this is mostly about rolling up bug fixes and improving stability of the product.

    6) Metalogix grows bigger through acquisition

    It’s been a busy year for Metalogix as it continues to grow through a series of acquisitions.  They acquired Axceler’s SharePoint business back in August although I had been hearing rumors of it all year long.  This allows Metalogix to compete on a number of new levels.  This and with their other acquisitions certainly makes for an interesting market with the SharePoint ISVs.

    In October, Metalogix then went on to acquire Idera’s SharePoint backup tools.  This one kind of surprised me.  From the time I have lived in Houston, I haven’t seen a whole lot of activity out of Idera at all.  I’ve known a few people that have worked there over the years, but at the community level, we have seen absolutely nothing out of that company in several years.  I guess it does make since though as Metalogix continue to fill in the gaps of it’s product suite to compete with AvePoint.

    As a reminder, I am not endorsing anyone’s product here.  I’m just stating my observations.  If you work for Metalogix or AvePoint, please don’t feel the need to call me as you all always do anytime I post something even slightly mentioning one of your names. :)

    7) Office Store expands

    The Office Store came out late last year and I threw my hat in the ring by putting a number of SharePoint apps in there.  It’s hard to really say how the Office store is really doing, but they have been making continuous improvements to it all year.  Most recently, we saw the launch of International stores and the much desired subscription pricing.  Subscription pricing is huge because it allows developers to get recurring revenue.  This was a huge issue for provider hosted apps since the app developer has to account for the recurring costs of hosting the remote code.

    8) Legal tangles with the use of the word SharePoint

    In just the last week, we saw Microsoft’s legal team enforce restrictions on the use of it’s trademark.  Furkunap made a big deal about it but he wasn’t the only one that received notices.  Microsoft has every right to enforce the use of their trademark and I am surprised it took this long for some sites to be contacted.  What it comes down to is that you can use the word SharePoint in a manner that doesn’t portray you as being officially associated with Microsoft.  There is probably a better legal way of stating that I am sure.  I have to say I am quite impressed at the level of discussion of interaction by the @SharePoint account.  If you have any questions on what is acceptable, take a look at Bryan Bolling’s post.

    9) SkyDrive name change

    SkyDrive (the consumer offering) and SkyDrive Pro (what SharePoint offers) largely do the same thing and there has always been some confusion on the naming inside SharePoint.  In late July, Microsoft lost a lawsuit with UK-based Sky Broadcasting Group which is going to result ultimately in a name change.  My hopes is that the new products can better differentiate the consumer and SharePoint offerings.

    10) Most SharePoint Online Sites have been upgraded

    By now, most of the SharePoint Online sites have been upgraded to a version based off of SharePoint 2013.  This is a significant piece of Microsoft testing it’s capabilities to push out major updates to SharePoint Online.  While there are still some tenants out there that haven’t been upgraded, by now most people are on the new version.

    11) Microsoft transitions to Devices and Services Company

    In July, we heard a lot about the reorg at Microsoft as the company moves to a focus on devices and services.  With SharePoint moving to a service-first offering, this transition is of course significant for the future of the product.

    12) SharePoint Conference 2014 announced

    It may seem like so long ago, but SharePoint Conference 2014 was just announced in August.  It looks to be another great lineup of speakers (including myself :) ).  This will be the best place to go next year to learn about all things going on with SharePoint.  If you haven’t registered yet, head over to SharePointConference.com today.

    13) 2014 will be the year of the hybrid

    People have realized that we can’t just pull the plug on our on-premises servers and go to the cloud over night.  It’s simply not going to happen.  Now organizations are looking at a more hybrid approach to the problem.  For years now, we have already seen customers jumping to Office 365 for Exchange and Lync.  Now within the SharePoint Online space, we see organizations putting one foot in the clouds with SkyDrive Pro and personal sites.  We’ll continue to hear stories like these next year especially at SPC14.

    Conclusion

    It’s been another big year for SharePoint.  What else do you think has been a highlight of the last year?

  • Tired of apps crashing without displaying an error? Blame Apple!

    Does anyone remember back in the day when an application had an error, it actually displayed some kind of error message?  Albeit the errors were usually cryptic, it was at least something that you could run with.  Now if you look across the app ecosystem, there is a disturbing trend.  When something goes wrong with an app, it’s going to just close and dump you to your home screen with no idea why.  It used to not be in this way though.  When an application had trouble starting up or it had some kind of unhandled exception, it would at least display some ugly modal dialog box and give you some kind of message and then it would close.  Maybe these errors weren’t user friendly (ok, they definitely weren’t), but you could at least provide the information to a developer or support person and they would have something to work with.  Now applications just crash and they dump you back to your home / start screen and the poor person that has to support it really has nothing to work off of.  My question is how as consumers have we been desensitized and believe that this is now acceptable behavior for an application.

    image

    I could be totally wrong here, but I believe this all started with Apple’s launch of the iOS App Store in 2008.  Apple, a company noted for putting user experience first, seems to be the root cause of this.  Back when I could stand using an iPhone, I remember the first time I launched an app and it had an issue.  It just closed and I was sitting there looking at my screen full of icons.  I launched the app again and again it crashed and took me back to the home screen.  Lame.  I kept trying to open the app and there was nothing I could do.  Finally, I uninstalled the app and reinstalled it and it started working again.  How is that for user experience?  This is the same company that shows a computer with an unhappy face when your hard drive goes bad.  I get that consumers don’t always need the details of an error, but they should be available.

    I thought surely it might get better after the years, but in fact it has gotten worse.  Much worse.  You see, Apple convinced all of us that its was perfectly acceptable for an app to crash and not tell you why.  So much to the fact that when you started seeing competitors implement their own marketplaces, we see the same behavior.  Just a few weeks ago, I pull out the Delta app on my Windows Phone to try and check in for a flight (one of the rare exceptions that I didn’t fly Southwest).  My connection in the building was a bit sketchy so I launch the app, it tries to connect and has trouble and so what ends up happening?  That’s right the app crashes.  Frustrating.

    The software development world is shifting into a world of sandboxes and Windows Store applications are no exception.  Just a few minutes ago, I tried to launch iHeartRadio.  It gets the screen loaded and then what does it do?  It crashes and I am sitting there staring at my prize-winning start screen (I won $10 in the Windows 8.1 contest. :) ).  This happens fairly regularly with Windows Store apps, so the tradition continues.

    Holy crap!  What if software developers start using this error handling technique on software that really matters?  I would hate for the software for air traffic control when my flight is coming in to just crash and drop the operator to a command prompt.  I sure don’t want that happening to the software that controls our defense systems.  I know this is a totally different user segment, but we’re already seeing some of this behavior in business products like SharePoint where we get messages like “Something went wrong.”

    The point of this article isn’t to just beat up on Apple.  However, I really think it started here.  The other competing app stores just followed the same model.  As a result, we get the same experience. It seems for now that us as consumers have come to accept this behavior.  Maybe this is a limitation of the app store technologies in use and proper exception handling just isn’t feasible.  I don’t know.  I do know that some platforms have crash logs available that are buried in various places.  However, that doesn’t help consumers one bit.  All they know is that the app they wanted to run isn’t working. 

    How do I think error handling should be done?  Well first, it should never just crash without giving you a reason why.  All exceptions should be caught, handled, and then close the application if necessary.  A consumer oriented error message should be displayed to the user.  Consumer don’t need to know the real reason why the application had an error, but they do need something to report.  The error message should also have a course of action besides “contact your system administrator”.  It should have a link to click on, a phone number to call, whatever makes sense.  Lastly, there should be a way to get more detailed information about the exact error directly from the error screen.  This can be a link that shows the actual error, stack dump, etc.  The error should have a unique id (such as a correlation id from SharePoint) so that a developer or the support team can go find it after the fact.  This assumes that the error information is being logged somewhere.  It should be.  Maybe, that’s a lot to ask for on a mobile device, but I don’t really think it is.

    Am I completely off base here?  Do you remember applications crashing in this manner prior to iOS?  Leave a comment and let us hear your ideas!  I’m not saying the old cryptic error messages were much better, but I think as developers we need to proactively think about a better error handling experience.  Coming from a development background, I know that error handling is one of the last things we think about.  It shouldn’t be though.  With the invent of touch screen devices, consumers demand higher quality user experiences.  There are a lot of great applications and web sites out there that really put UX first.  These experiences are all great up until the point that something goes wrong.  As consumers, it’s time for us to demand a better error handling experience.

    Posted Dec 03 2013, 05:13 PM by CoreyRoth with no comments
    Filed under: ,
  • Explaining the benefits of cloud services to your extended family

    After spending the holidays with the extended family, a number of tech topics came up including Windows 8, tablets, and “the cloud”.  It’s always fun to have these discussions with family because I get an idea of what people across a number of generations (who generally aren’t technical) are thinking.  The general consensus with the cloud is that they just don’t get it.  They have heard about it, but they really have no idea what it is.  Specifically, we’re talking about the consumer oriented cloud services such as SkyDrive, Dropbox, iCloud, Flickr, etc.    I had mixed success in explaining it, but I did manage to show a couple of demos that got them interested.

    With any holiday gathering, a lot of pictures were being taken.  Some people were using their phones.  Some using digital cameras.  People wanted to share their photos of course.  Some people went with Facebook while others needed to go sync up.  It got interesting through when I pointed out that I didn’t have to do all of that.  I have every photo I have ever taken in the last 13 years stored on my SkyDrive.  Thanks to Windows Phone, I don’t have to do a thing for new photos to show up there either.  Chances are whatever phone they use, there is a similar service available.

    I set out on a mission to explain the cloud to my family and dispel some of the myths that they have heard.  When discussing this new cloud-connected way of life, I heard three general concerns / questions:

    • I don’t trust “them” with all of my stuff.
    • What if they lose my stuff?
    • What are the benefits?

    Let’s take a look at each concern and I’ll share the discussions we had on each.

    I don’t trust “them” with all of my stuff

    This is a natural concern.  I hear it from directors and CIOs all of the time in the business world.  However, in the consumer world, it’s quite a bit different.  They aren’t dealing with things like compliance and data loss prevention.  They just want things to work.  If you look at the type of files, the average consumer stores on his or her computer, most of them are things like photos, homework, and maybe a few documents that have financial information.  I’d say very few people use the latter in reality, but I could be wrong.  So I asked, “What files do you have that you are so concerned about someone seeing?”  They really didn’t have an answer.  I asked “Do you really care if someone else sees your picture of pumpkin pie from Thanksgiving?”  They agreed, the answer is generally no.  They might have a few documents they are concerned about (i.e.: financial or real estate), but in general there is very little information that is considered sensitive.

    The interesting point here is that when you start asking questions about what people do on the Internet, it turns out they are choosing more cloud services than they realize.  Every time, you upload a picture to Facebook, use Pintrest, or go and print out photos on WalMart.com, you’re effectively in the cloud.  By explaining that they are already using cloud services, the concept of using SkyDrive for storing pictures doesn’t seem so scary.

    I had another interesting conversation with my mother about not trusting “them” when it comes to online ordering.  Being a baby boomer, she did successfully make the leap into services like Facebook some years ago.  However, she still had quite a bit of distrust when it comes to online ordering.  In fact, she still got catalogs in the mail and then she called the order in.  She said, she didn’t like using her credit card on the Internet.  This made me laugh.  I found it funny because more than likely the person on the other end of the phone is using the Internet in some way to enter that credit card on a secure site.  Often times this is just a flavor of the existing public facing web site.  It turns out her credit card number is more likely to be stolen by the operator on the phone or the waiter at the restaurant than it is by making an online transaction.   

    What if they lose my stuff?

    Surprisingly, there were a lot of concerns that if they put their documents and photos in the cloud they will get lost due to hardware failure or whatever.  Let’s look at storing photos long term.  I’ve always taken extra care of my digital photos just as you would a family photo album.  Before the cloud, I used to burn CDs regularly and store them somewhere else in case of fire.  This led me to inquire about how they store their photos today.  In this case, my mother doesn’t have a smart phone and uses a digital camera.  After she takes the photos, she connects it to her laptop via USB cable and they get stored somewhere on the laptop.  She then uploads them to WalMart.com and prints every single one of them out.  I asked “Do you think keeping your photos on your laptop is safer than in the cloud?”  The answer of course was “No, but I think I have copies and I always have the ones I have had printed”.  Her last computer recently died.  Right now, photos are scatted across WalMart.com, the new laptop, a handful of memory cards, along with the boxes and boxes of 4x6 photos.  For something like photos, I think you have to plan for the worst.  When someone loses a house due to fire or natural disaster, insurance can replace your stuff, but it can’t replace your boxes of photos.  If you find your old pictures valuable, this should scare you a bit.

    With Windows 8.1, I showed how photos can be automatically synced to all of my devices.  This puts a physical copy on each device.  I can then browse them using the Photos app, directly on SkyDrive.com, and on my phone.  I think the feature that really got my family members excited though was the lock screen photo slideshow.  When my tablet showed photos I had literally just taken just a few moments ago in a slideshow, people were impressed.

    What are the benefits?

    To no surprise, shifting to Windows 8 was a difficult shift for the older members of my family.  However, when I showed it in action on my Surface 2, they started seeing some of the benefits.  I find even the most experienced of developers don’t really fully utilize the benefits of SkyDrive integration in Windows and Office.  I explained how I could start working on documents on my laptop and then open the same document on my Surface 2 and pick up right where I left off.  The point is your files are with you wherever you are regardless of the device you are on.

    The last demonstration I gave was, I took a picture of all of them while we were sitting at the table.  I waited a few moments and then I showed it to them from my Surface 2.  Being on Microsoft devices makes this easy of course, but similar cloud functionality has been there for quite some time in the Apple world using iCloud.  Most of them have iPhones with a handful of Android devices, it’s just a matter of knowing these features are there.  Of course, I think uploading to SkyDrive is a much better experience, but the fact is they should take advantage of any service that makes archival of photos easier.  This level of cloud integration is what makes for a great consumer experience.

    Summary

    This “cloud thing” is really just starting to take off in the consumer space so it still may take some time before your grandma is using it.  The benefits are huge though.  With the cloud more integrated into Office 2013 and Windows 8.1, I think this is a step in the right direction.  Files will just automatically save to the cloud and users won’t have to think about it.  The simpler the experience, the greater the adoption.  Now, I don’t think for one minute, my entire family will drop what they are doing and start using the cloud.  However, I do think it got them thinking.  The next time I see some of them, I bet I will get a few more questions and some might even ask how to get started.

2015 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems