Category Archives: Uncategorized

Allow Export of List Views (XsltListViewWebPart) in SharePoint Online / SP2016

Disclaimer – This does require a single manual step where you need to add a GUID to the exported file.

Wow .. its been a while since I blogged last but finally have something SharePoint(y) to post about 🙂

This time I was asked by a client if it was possible add a “List View” (XsltListViewWebPart) to a different site than the one where the list exists.

Now, I know that this is possible because I’ve done it on older projects, simply by exporting the List View, adding the “Web ID” and re-importing it to another page. This works as long as the page you are importing it into are in the same site collection.

The problem of course is that the List View web parts in SharePoint Online (and SP2016) currently have the “Allow Export” property set to false .. AND you can’t change this through the UI.

Luckily, this property is access via a DOM attribute which is extremely easy to modify. The following JavaScript identifies all “Web Parts” (in edit mode) which have an “allow export” attribute set, and then sets it to “true”.

var webParts = document.querySelectorAll(“div[webpartid][allowexport]”);

 

for(i=0; i<webParts.length; i++) {

 

webParts[i].setAttribute(“allowexport”, “true”);

 

}

You can of course add this to the page any way you see fit (either a Script Editor Web Part, Master Page, Custom Action, SPFx Application Customiser .. depending on the type of set and purpose for this script).

So .. this enables the “Export” menu on the Web Part Properties. Once you have exported the Web Part definition if you open it you will find that the WebId property will be blank.

<property name=”WebId” type=”System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″>00000000-0000-0000-0000-000000000000</property>

This will need updating with the “Web Id” property of the web where the list resides. You can easily retrieve this using the REST API:

https://tenant.sharepoint.com/sites/SiteN/subsite/_api/web?$select=id

Just copy-paste that into the Web Part definition (NotePad will do the trick) and you can now upload that Web Part definition into ANY page anywhere in the Site Collection.

Switching from Windows Mobile to Android … it was the best of times, it was the worst of times

So as a massive surprise to anyone living in a nuclear bunker the past few years, the announcements are out that Windows Mobile is (kind-of) officially dead.

The writing was clearly on the wall with near-to-zero global sales and declining market ownership (if you could call it that) .. Windows Mobile has been “doing a Blackberry” recently.

I’ve been a (very) long die-hard fan of Windows Mobile, as an early adopter getting one of the first Windows Phone 7 devices, I even got WP7 running on my old HTC HD2 (a behemoth of a device at the time which seemed capable of running pretty much anything).

I’ve had numerous “flagship” phones from the Nokia Lumia 1020 (with its amazeballs-never-seen-better 41MP PureView camera) to the Nokia Lumia 930 (with the eyeball hurting bright orange back and aluminium sides) and my last Microsoft Lumia 950XL which I still have as an emergency-back-up-phone to this day (in fact, my wife is currently using it after losing her Lumia 620 and is steadfastly refusing to switch to another platform until the last possible minute!)

But .. I took the plunge and 4 months ago I made the jump over to Android. I knew things were heading south and had heard various rumours coming from internal Microsoft channels (working at a Microsoft Gold Partner has some perks) not to mention finding out that various heads of division at Microsoft were using iOS and Android devices. So I went out and bought myself a Samsung Galaxy S8+.

So this post aims to cover off some of the things I love about it, some of the things I hate .. and some of the things I really just miss from Windows Mobile (we’ll miss you, dear friend!)

Note – My Android phone is a Samsung Galaxy S8+

The things I love about my Galaxy S8+ 🙂

The first thing I think that leapt out was the design. Windows phones have always been fairly “out there” in terms of bright colours and pushing the OS design interface, but the S8+ certainly looks a bit different (at least when you are holding it in your hand). The screen is gorgeous (probably the best I’ve ever seen on any device short of a £5000+ OLED TV) and the curved glass body (with both a curved screen, and wrap-around glass shell front and back) make it look like a polished stone.

Of course .. that screen has it’s own drawbacks so hold fire for the “things I hate” bits too!

The Camera was another thing which impressed me. Of course being an avid Windows Phone user I have always had the benefit of excellent “PureView” cameras. The Lumia 1020 was standout and I still don’t think I’ve seen anywhere NEAR the quality in a phone camera since (see Some real photos from 6 Months of using a 41MP Nokia Lumia 1020).

The interface is neat and the photos always seem to be sharp, quick to focus, quick to take and the image quality is excellent (even in low light levels). It is quite rare that I get a photo that I feel is sub-part in quality, so that is something which really stood out for me.

The other thing that of course jumped out was the Apps. And I’m not talking about “number of apps” (in fact that’s in my “hate” section later). I’m talking about apps that feel like they’ve had the level of investment they deserve (regular updates and feature improvements).

I was pleasantly surprised to find that almost all of the core “Windows” apps I relied upon (Cortana, OneDrive, Outlook, OneNote, Microsoft Office (Word / Excel / PowerPoint), Skype, Yammer) were not only available on the Google Play store but were in some cases even more feature rich than they were on Windows.

Of particular delight was the “Nokia Here Now” app (basically the “Nokia Maps / Nokia Drive / Nokia Transit / Microsoft Maps” app from the Windows Mobile store) which still included the fully-offline downloadable maps and turn-by-turn satnav modes completely free of charge!

I also found that LastPass is much improved, with the ability to auto-complete passwords in other apps / throughout the interface rather than just in the web browser!

One example of the versatility of a feature rich “App” market was the Photo Gallery, you could go and find an alternative to use, download and install (of which there are many) and the same can be said about pretty much everything on the phone. You don’t like the default contacts App? go get another. Don’t like the Dialler? Messaging Interface? even the Keyboard? Same applies .. dozens of alternatives were waiting at every turn.

The security / login features were another plus. I have the options of fingerprint, iris scanning, “pattern” unlock, pin-codes and the like. And certainly on the S8+ the “iris scanner” seems to be both extremely quick and accurate (working in complete darkness, through my glasses and in all but the most harsh direct sunlight).

The integration for payment-options (which gets baked into the NFC payment system) was fairly intuitive and quick to use. Both convenient and simple to setup I can easily switch from stored credit cards to my mobile provider and back .. all very seamless (and to be honest, what you should expect from a platform this mature!)

Overall a pretty positive experience…. but its not all wine and roses!

The things I hate about my Galaxy S8+! 🙁 

Ok there are a few things off the bat which really get on my tits!

First off the “curved infinity display” screen which Samsung gave such a song and dance about. It looks gorgeous and most of the time is amazing, but on some apps (where they place the interface right along the edge) it just means you are constantly trying to hit “that sweet spot” by the edge of the screen which is just “on the curve”

On that subject, the glass body on the phone can be extremely slippery! It is also a fingerprint and scratch magnet. Do NOT put your phone in your pocket with keys / coins or any other sharp-edged metal. I’ve already put a fairly decent gouge in the glass on the back of the phone .. something which I’m sure is only going to get worse over time! Of course I could go and get myself a nice leather “wallet” or one of those shock-proof rubber condoms people put on their phones, but I’ve always been a bit of a fatalist that I like to see the phone as it was meant to be, and if that means I accidentally drop it a few times then so be it!

The keyboard was another sore spot. I have possibly been spoilt by being on Windows Phone and its best-in-class Swipe keyboard (“Microsoft Word Flow”?? or did they rename it?). I frequently find that my new phone either; completely misses the letters I was trying to type, and/or, completely mis-guesses the word I was trying to spell.  The result is an awful lot of predictive-text mis-hits and I find myself correcting it a LOT more often than I did on Windows. Some of this may be down to having a new phone and muscle-memory issues from having a slightly different layout, but I’m 4 months in now using the phone heavily every day so I’m starting to lose hope on that.

The number of third party apps is another sore point. I know .. “choice is a good thing” but in my opinion “too much choice is just annoying”. Its like going into a restaurant and being told they sell 300 different types of Burger. Which is fine, until you also get a separate 200 page menu of salads, and a 20 page book for soft drinks. After a while .. this just gets annoying.

So when I started looking for a replacement Calendar App, I found I was utterly _swamped_ with choice. Many of these apps seem to come from small software houses, which I suppose is again both great for choice (and exposure for small dev houses) but it means that the average app I come across severely lacks that professional “polish” that you might expect from a solid first-party application, and are either missing key features or have a quirky interface that just puts me off.

Another thing that I really can’t stand is the notifications and status bar. Apart from the icons at the top being seemingly font-size 4 (if I’m not wearing my glasses .. forget it!). You still have the “swipe down from the top” to get the expanded “quick actions” panel but there is critical information missing.

On Windows Mobile it would tell me not just if WiFi was turned on, but which SSID I was connected to. Equally for Bluetooth, am I connected to my headphones, my laptop or my car stereo? For Mobile data, do I have 4G, 3G or just GSMA connection? On Windows Mobile these were all “at a glance” features, but now it seems I have to click in-and-out of various menus to try and find this information out.

Probably the biggest bug-bear though is the reliance on having a Google Account for everything, or even having multiple accounts for the same thing! The Photos Gallery app wants you to “backup to Google”. Apparently this is free and unlimited, but if you don’t you will get reminded about it every week or so. The payment options require a Google Account for you to save them. Phone backup needs to use a Google Account (or in the case of the Galaxy S8+ a Samsung Account!). I have ended up using my (previously barely-ever-used) Google account to do some of these things, but it is annoying and slightly fragmented having to now juggle 2-3 different accounts for different parts of my phone, when previously I had a “one account does everything” method for Windows Phone.

Another good example is the Calendar / Contacts integration. So I use “Outlook” for my emails, but that won’t sync the Calendar items. I didn’t like the Google “Calendar” app, so I had to download a third party Calendar. But all that does is sync from the built-in “Calendar” functions, so I had to add all my accounts to the Google Calendar first so that my third-party calendar app could pick them up.

So I basically have my Calendar accounts added in 3 places: Outlook (notifications disabled), Google Calendar (notifications disabled) and my third-party Calendar. This all feels like way too much effort just to get reminders about upcoming appointments!

There are then the really WEIRD oddities about certainly functions. For example, you can’t change the colour of Calendar Icons without a third-party app. So I’ve had to go and find, install and configure a third-party app just so I can change the colour of calendar items (I have like 4 different accounts which I sync to my calendar). This just feels like I have to do a fair number of “hacks” to provide something I would have expected to be there from day 1 (and this is a mature platform by now too!)

Bixby – Well .. need I say more? Pointless and annoying .. but not stock Android so I’ll try and steer away from Samsung-specific arguments if I can.

But certainly the things I hate the most are simple usability features that were standard on Windows Mobile, but are missing from Android…

The things I miss from Windows Phone … 

The first thing I think I’m really missing is having OneDrive and Outlook as first-class-citizens. Yes … you have the “OneDrive” app which will auto-backup your photos and videos. But it won’t bring your OneDrive photos into the stock “Photo Gallery” app on the phone (I had to copy the last few months over manually).

OneDrive does have it’s own “photos” gallery feature but it is both buried away in the OneDrive app interface and not as feature rich. Plus you can’t “deep link” a shortcut for that Photos interface to the home page anyway.. even if you wanted to.

The Outlook app seems to be fairly good on Android, but it is lacking in a number of features. The whole sync-mechanism with the rest of the phone seems “tacked on” and there are numerous “settings” interfaces which are nested in each other which make it a little complicated to configure things like sync schedules and notifications. The “Calendar” view itself limits you to “3-Day”, “Day” or “Agenda” and completely drops the “Week / Agenda-Week” views which were by far my most popular on Windows Mobile. Equally, there is no ability on Android to link a “mailbox”, “folder” or “calendar” to the home page (you can’t even have a shortcut to just take you straight to the Outlook Calendar, that is buried away inside the app itself) which brings me onto …

Deep Linking Shortcuts.

This was (for me) the single KILLER feature of Windows Mobile. Forget “live tiles” (quite frankly I could take or leave them) but the ability to pin a shortcut on the home page which deep-links into the bowels of another app was awesome.

  • A specific Mailbox from Outlook
  • A specific FOLDER in a mailbox in Outlook
  • A Notebook / Page in OneNote
  • Internet Shortcuts
  • Phone Settings (WiFi / Bluetooth / Storage / etc)

You name it, you could pin it! On Android you can basically pin “the app” .. and that’s it. Yes you have “widgets” but they are really not the same thing (and other than “the weather” and “the time” I’ve yet to find one even vaguely useful).

The thing about this which is most painful is being able to see “at a glance” which of my 4 Mailboxes in Outlook have unread mail. Its great knowing I have 18 unread emails, but are they from my work or personal accounts? Are they in “Inbox” or are they one of the automated emails from TFS or Yammer? This is a major productivity kick-in-the-teeth and something I have to admit I’m struggling with a little bit.

Note – installing a different Mail App for each mailbox is NOT something I am going to even consider!

Facebook / LinkedIn Integration is another thing I miss… and by this I mean:

  • Showing my Facebook / LinkedIn friends in Contacts
  • Showing Facebook / LinkedIn photos for my existing Contacts (who are friends)

There are (apparently, technically) third-party apps on Android which can do this. I have spent several hours with the top-three rated of these, and none of them seem to work very well at all, enough so that I have effectively given up.

The Status Panel is another one which I had a little rant over up above, and to be honest this can go hand in hand with a Crisp and Clean Interface and general Notification Panel full stop. The overall UI and experience with Windows Phone has been hands-down superior, and most people I spoke to who had Windows Phone and have moved to iOS or Android have said the same.

I also miss the dedicated camera button which I’m sure exists on some Android phones, and I know doesn’t exist on some Windows phones too .. but I’ve had it on my last three Windows phones and it is something I’m really missing from my Galaxy S8+!

My final point on this is the Microsoft Account glue .. one account to rule them all. It did my favourite / internet history / browser passwords / wifi codes / phone backups / app settings. I had a single account, and it “just worked”. I haven’t tried a full backup/restore on my Galaxy S8+ yet (and TBH I’m a little scared to do so) but I can’t believe it will be anywhere near as simple and easy, and I expect to run into several hiccups along the way, especially if I change to another phone supplier!

The things that I thought would only be in Windows… but are in Android too!

My parting comments on this are some of the features that, back when Windows Mobile launched (be it WP7, WP8.1 or WP10) were standout features that I thought were unique to the platform, but I was surprised were ready and waiting when I switched.

OneDrive Camera backup was a biggy! Not only that but the same options for Photos / Videos, Resolution and “backup over WiFi vs Mobile Data”. If only it synced in both directions I’d be really happy

Cortana also integrates with the Windows 10 PC/Laptop with the same notification alerts and ability to reply to SMS messages without taking your phone out of your pocket.

And the Nokia HereNow / Maps / Transit / Whatever app, with downloadable country-sized maps, an “offline zero-data” mode and turn-by-turn satnav it was one of those features which surprised all my friends back in the day, and I’m really pleased to find it made it’s way over to Android and kept its ultra-low price tag (i.e. completely free!)

 


 

So, I am now embedded on Android. The switch was slightly less painful that I thought it would be, but I found some features missing which I didn’t quite expect. I am generally happy with the phone / ecosystem .. but I am (and probably always will be) missing Windows Mobile.. we’ll miss ya fella!

 

For those interested, here are the apps which I felt the need to download and install before I settled into my rhythm. The core apps I feel I would need for any Android phone, and the keys reasons why I use them:

  • OneDrive – Camera Backup / Cloud access
  • Cortana – PC alerts and SMS replies
  • Office / OneNote – Obviously
  • LastPass – Password Management and integrated auto-complete
  • Facebook / Messenger / Yammer / Twitter / Skype  – for obvious reasons
  • DailyPic – Auto-set the “Bing background of the day” to the Phone home and lock screen
  • DigiCal – Calendar with “Agenda Week” view which doesn’t look like it was built by college grads – the killer view for me!
  • Calendar Colors – Change the colours for synced calendars – no really!!
  • Nokia Here WeGo – Offline maps, satnav
  • Stock Google Apps {Dialler / Contacts / Messages} – Because I can’t stand the Samsung ones! 

JSLink and Display Templates Part 7 – Code Samples

When I was speaking at the SharePoint Evolutions conference earlier this year I ran into Jeremy Thake (@JThake) and Vesa Juvonen (@vesajuvonen) and they saw the JSLink samples I was running through for the session I had.

Well .. one thing led to another as they say .. and by the time the conference finished I had refactored all of my code and uploaded it to the OfficeDev PnP (Patterns and Practices) GitHub repository.

So you can find all of my sample code in the “Branding.JSLink” section (OfficeDev PnP > Samples > Branding.JSLink).

This includes full documentation, full source code, a compiled deployable WSP package, as well as loads and loads of awesome stuff from the rest of the OfficeDev PnP contributors.

The sample code includes:

  • Re-Render Lookups as bulleted lists and checkboxes
  • Cascading Drop-Downs for Lookup Fields
  • Cascading Drop-Downs for Managed Metadata Fields
  • Google Maps integration (allowing both pin-point and shape selection)
  • Sample colour picker

And here are some tasty screenshots to get you in the mood!

Cascading Lookup Fields, with Checkboxes (multi-select lookups)

Cascading Drop Downs dynamically loaded from a Taxonomy (Managed Metadata Term Set)

Google Maps Thumbnails in List Views

Extensive editing interface for Google Maps fields

Simple Colour formatting

Announcement View as an Accordian

 

Hope you enjoyed the series (sorry it took so long!)

JSLink and Display Templates Part 6 – Creating View Templates and Deployment Options

Well first of all .. OH MY GOD I AM SORRY .. this has taken an absolute age to get out of the door. There really isn’t any excuse (although I’m going to try and use the excuse of the birth of my second child along with crazy busy real-world-life getting in the way).

But .. I am back and should be blogging a little bit more frequently from now on! So .. the JSLink stuff .. where was I? (believe it or not this series has been going on for almost 2 YEARS!).. View Templates! Right!

In Part 5 we covered the ability to override the rendering of List Views, and from a developer perspective this was awesome, but it isn’t that useful from content editor’s perspective. The field-level overrides are easy enough to push through (because they can be applied to every single instance of a field at either the Site Column or Content Type scope) but the views tend to get in the way a little bit.

What we really need is the ability for someone who creates a new view to be able to pick one of our custom view templates, and that is exactly what we are going to do here. This is perhaps one of the least known features of the JSLink / Client-Side-Rendering approach for SharePoint 2013 and even people I have spoken to who have been doing JSLink development for a while now didn’t know about this.

In order to get this to work you will need to make sure each of your “views” are encapsulated into separate JavaScript files (one view per file) and you will be uploading them into the Master Page Gallery (if any of you have read my Content Search Web Part series, or done any development with Search Results display templates, then all of this should be intimately familiar!).

Now you can put these files anywhere in the Master Page Gallery, my personal preference is to create yourself a new folder called “List Views” in the “Master Page Gallery > Display Templates” folder. The secret sauce however is the choice of Content Type:

  • Content Type: JavaScript Display Template
  • Name: <name of file>
  • Title: <how it will appear when selecting the template>
  • Target Control Type: View
  • Standalone: Standalone
  • Target Scope: <Relative URL where you want it to be used>
  • Target List Template ID: <ID of list where view is available> (Optional)

To keep in line with my example in Part 5 I have added “MJH Announcement View” with a Target Scope of “*” (i.e. all sites) and a List Template ID of 104 (Announcement Lists)

MJH_VIEW_FILE

Once this has been saved then if you browse to any announcement list and create a view then my new View type is available from the template selection screen!

MJH_VIEW

Now finally a word on Deployment Options and this is relatively straightforward.

Where should I put my files … ?

The first thing is that your files need to reside in SharePoint. I had a conversation with @MarkStokes about this just the other week and he was trying to load his JS files from Azure Storage (so that you could upgrade multiple O365 tenancies from a single file). This didn’t work, as the absolute URLs in the JSLink properties weren’t being picked up and the files weren’t loaded.

The solution was adding a lightweight JavaScript “script loader” .. basically just a short JS file which then dynamically loaded in the reference JS from Azure.

In terms of where THAT file lives, the Master Page Gallery or Style Library are obvious choices as they include automatic permissions for all users to have limited read access. The JSLink properties then allow you to reference dynamic ~sitecollection URLs so you can get a reference URL to them relatively easily.

How do I get them there … ?

Again, this is really standard SharePoint stuff. If you are already using a No-Code-Sandbox-Solution then simply using a Module to push the files in makes sense. If you are instead using a Remote-Code provisioning approach (either using a Provisioning App or PowerShell approach) then you will be using CSOM to push the files in.

The only thing to bear in mind is what other assets rely on those JS files. If your JS file provides rendering overrides for a Site Column then deploy the file in the same feature / provisioning logic that you are using to provision your Site Column. If you want the end users to be able to turn it on and off for a given site then a separate Web Scoped feature makes plenty of sense.

If you want to apply it carte blanche to all sites then a Custom Action to inject the JavaScript file using the ScriptLink element will allow you to push this onto every page without touching the master page, but be aware that this will also include plenty of back-end system pages (file dialogs, site settings, and so forth) so make sure you thoroughly test your code, and make it defensive enough that it doesn’t throw unexpected errors when the SharePoint libraries you expect to be there aren’t present.

If you are just mocking this up as an example then you can of course just upload the file manually, and for REALLY quick demos just copy-paste the JavaScript into a Script Editor Web Part!

Some real photos from 6 Months of using a 41MP Nokia Lumia 1020

I have long been an advocate of both the Windows Phone operating system and Nokia Lumia phones, and one thing that I always look for in a new smartphone is a decent camera! “The best camera is the one you have with you” is one that rings strongly with me and I am frequently finding myself out at kids parties, in the park or just on family days out without my bulky DSLR (which is awesome, but due to the size of it I just can’t slip it in my pocket).

The Lumia 1020 therefore grabbed my attention (and media headlines) when it was announced with a 41MP camera! Now, this isn’t some marketing gimic or crazy “lets cram more MP in” kind of publicity stunt. This was coupled with some fancy Nokia tech (from their “PureView” camera team) which uses a combination of pixel oversampling and post-processing to produce fantastic images (the final images typically being around 34MP plus a 5MP version for sharing on social networking sites).

I won’t go into too much detail about the technical details here but you can certainly read more about it here, here and here.

So .. the purpose of this article is to share some of the photos I have taken myself in the 6 months or so of owning and using a Lumia 1020 in everyday life. I’ve specifically picked ones which don’t contain people (other than myself) and are pretty harmless (no photos of my kids of family just yet ;)).

Read more »

SharePoint 2013 Reference Sheet – Services on Server

This post will provide a description of each of the SharePoint Services in the “Services on Server” section of Central Administration, describing what it is for and anything you need to look out for.

This was borne out of a frustration of checking client environments and consistently finding environments which had services running which they weren’t using (and were never going to use!).

Note that some of these also have a corresponding Service Application that you will need to create in order to use them.

Service Purpose Comments
Access Database Service 2010 Enables SharePoint 2010 Access Services functionality
Access Services Enables SharePoint 2013 Access Services functionality Required for “Access Apps”
App Management Service Manages SharePoint App licenses and permissions Required for Apps to work
Application Discovery and Load Balancer Service Determines which server to send Service Application requests to .. this is how SharePoint automatically balances load. Fundamental SharePoint Service, defaults to “Round Robin”Can be extended with custom load balancing code if you are brave enough!
Business Data Connectivity Service Enables BCS which provides External Content Types and External Lists. Required if you want to sync external LOB systems with User Profiles.
Central Administration Hosts the Central Admin Web Application The default URL is set to the server-name of the first server SharePoint is installed on.If you want to run this on multiple servers you should consider Alternate Access Mappings with a DNS entry
Claims to Windows Token Service (C2WTS) Used to convert SharePoint Claims back into Windows Tokens for Kerberos delegation. Required for Kerberos when used with BI Tools.Requires some manual steps: https://technet.microsoft.com/en-us/library/hh231678.aspx
Distributed Cache Heavily used in SharePoint.Requires ICMP ports open between SharePoint Servers.

Numerous Gotchas: https://technet.microsoft.com/en-us/library/jj219613(v=office.15).aspx

 

Document Conversions Launcher Service Enables an extension point to configure conversion from one document format to another.
Document Conversions Load Balancer Service Enables an extension point to configure conversion from one document format to another.
Excel Calculation Services Enables the Excel Services BI functionality Significant RAM overhead (recommended 32GB)If you want to use “PowerView” in Excel then you also need to configure the SQL PowerPivot add-on.

Kerberos will require C2WTS.

Lotus Notes Connector Allows you to connect Search to a Lotus Notes database to enable indexing and crawling of Lotus content.
Machine Translation Service Allows an API for developers to submit content to be translated into another language.
Managed Metadata Web Service Enables “Managed Metadata” taxonomies and term sets Required for default navigation settings in SP2013 (navigation stored in Term Store)Required for User Profiles
Microsoft SharePoint Foundation Incoming E-Mail Enables inbound emails to be stored in Document Libraries. Requires significant configuration including AD and DNS settings:https://technet.microsoft.com/en-us/library/cc262947(v=office.15).aspx
Microsoft SharePoint Foundation Outgoing E-Mail Enables outbound emails from the server Needs to be configured in Central Admin
Microsoft SharePoint Foundation Sandboxed Code Service Allows Sandbox Solutions to be used and executed. Required for SharePoint Hosted Apps, Design Manager and “Save as Template” functions.(SharePoint Hosted Apps use the Sandbox Code Service to provision features and content in the “App Web”)
Microsoft SharePoint Foundation Subscription Settings Service Manages subscriptions between Sites and Apps. Required for Apps to work
Microsoft SharePoint Foundation Web Application  Hosts the Content Web Applications If this is enabled, all of the Web Applications (except for Central Admin) will be deployed.Also determines which servers are deployed to when deploying a WSP which is Web Application Targeted.
Microsoft SharePoint Foundation Workflow Timer Service Runs any SharePoint 2010 style Workflows
PerformancePoint Service Runs the PerformancePoint BI component. Significant RAM overhead (recommended 32GB)Kerberos will require C2WTS.
PowerPoint Conversion Service Enables an API for developers to convert PowerPoint Presentations to various different formats (e.g. PPTX / PDF / JPG / PNG)
Request Management Allows custom routing rules for requests made to Service Applications. e.g. to route Excel traffic from one Site to a specific server If you turn this on without defining any routing configurations then everything breaks!
Search Administration Web Service Servers that run search components This service is automatically started on all servers that run search topology components.
Search Host Controller Service Servers that run search components This service is automatically started on all servers that run search topology components.
Search Query and Site Settings Service Servers that run the query processing component This service is automatically started on all servers that run search topology components.
Secure Store Service Allows storage of credentials and other secure information. Database is encrypted using a “Master Key” configured when the service is setup.Required for the BI Unattended Service Account configuration
SharePoint Server Search Crawls content for the search index This service is automatically started on all servers that run search topology components.Note – Cannot be stopped or started from the Services on Server page
User Profile Service Manages the user profiles, creation of My Sites and SharePoint Social Features (and associated permissions and properties). Required for “High Trust” Provider Hosted Apps to work
User Profile Synchronization Service Used to synchronise data from AD (and other data sources) into the Profile Database. Not necessarily required for User Profiles!If you are just doing the “Directory Import” option then this service is not required.

The definitive “how-to” guide: https://www.harbar.net/articles/sp2010ups.aspx

Visio Graphics Service Allows Visio diagrams to be deployed to SharePoint so they can be displayed in the browser.
Word Automation Services Enables an API for developers to convert Word Documents to various different formats (e.g. DOCX / PDF)
Work Management Service Allows task aggregation, particular bringing together Tasks from Exchange, Project Server and SharePoint. Requires Search and My SitesTasks are stored in a hidden list in the user’s My Site.

So that gives you a run through of the SharePoint 2013 Services, and hopefully an indication of whether you should have them running or not!

Any additional suggestions, comments or errors you’ve spotted please let me know and I’ll try and keep this updated!

Note – this list only includes the Vanilla SharePoint 2013 services and does not include services added through other installs like SQL Server: {PowerView, Reporting Services, PowerPivot}

For more detail, including some great technical detail you can also check this TechNet article out:

Plan service deployment in SharePoint 2013 (https://technet.microsoft.com/en-US/library/jj219591(v=office.15).aspx)

JSLink and Display Templates Part 5 – Creating custom List Views

This post will look at a slightly different scenario – List Views. The general principles are the same (we write some JavaScript which tells SharePoint to override the rendering of various elements) but because we are now dealing with a whole view instead of just a single field there are some new elements to play with.

This is actually one of the more simple examples so I’ll start with all of the JavaScript in one block

var mjhViews = mjhViews || {};

mjhViews.itemHtml = function (ctx) {
  var returnHtml = “<h2>” + ctx.CurrentItem.Title + “</h2>”;

  if (ctx.CurrentItem.MyCustomField) {
    returnHtml += “<p>” + ctx.CurrentItem.MyCustomField + “</p>”;
  } 
  return returnHtml;
};

(function () {
  var mjhOverrides = {};
  mjhOverrides.Templates = {};

  mjhOverrides.Templates.Header = “<div id=’MyCustomView’>”;
  mjhOverrides.Templates.Item = mjhViews.itemHtml;
  mjhOverrides.Templates.Footer = “</div>”;
 
  mjhOverrides.ListTemplateType = 104;
  mjhOverrides.BaseViewID = 1;
 
  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(mjhOverrides);
})();


So we start off as good JavaScript developers and create ourselves a namespace (mjhViews) for our function (so we don’t pollute the global namespace). This contains a single function (mjhViews.itemHtml) which accepts the same render context object we’ve been using throughout this series.

The itemHtml method simply returns some basic HTML consisting of the item Title in an H2 element followed by the “MyCustomField” (if it exists, this field was used in Parts 3 and 4). Of course there are different methods for retrieving the values of the current item but the render context will automatically provide properties for the basic data types (some field types, external data fields in particular, don’t work like this and you might need to get creative with AJAX REST calls but be careful about performance!).

Finally we have our anonymous function which actually registers this override with SharePoint, and this is where things get interesting.

The main thing you might notice here is that we aren’t controlling any specific fields but instead override the “Header” and “Footer” with plain old HTML. For the “Item” we reference our rendering method and this will be executed for every item present in the view.

We then have two more properties (both of which are optional by the way).
The ListTemplateType and the BaseViewID both define which specific list types and views this rendering should be used for. If you don’t specify values for these then when this rendering override is registered it will override EVERY list and view on the page.

Finally we use the same old RegisterTemplateOverrides to tell SharePoint to process our object and do its thing!

Now before I apply this view it looks like this (which should be a pretty familiar SharePoint view):

Standard SharePoint list view

Once I apply my custom view rendering it looks like this:

A custom (if slightly boring) list view done with JavaScript

So .. quite easy huh? But the bright among you might have wondered .. where the hell has the toolbar and paging gone? Ahh .. yes .. that is all handled by the header and footer.

The header and footer contain important List View elements

This isn’t the only setback, if you try to use the view I defined above in “Quick Edit” mode then you also get the following error message:

TypeError: Unable to get property ‘style’ of undefined or null reference

The problem is that if you don’t override the Header you get some slightly funky behaviour because the headers injects a table object and it expects your content to be rendered inside that HTML table as rows. So by default I end up with the following (note the headers are at the bottom!)

Custom rendering with the header intact, but column headers are appearing AFTER the other content

So if you really want to play ball with the list views (and want the headers to be available) then you need to use TR and TD elements for your render HTML. For example:

mjhViews.itemHtml = function (ctx) {
  // start with a <tr> and a <td>
  var returnHtml = “<tr><td colspan=’3′>”;

  returnHtml += “<h2>” + ctx.CurrentItem.Title + “</h2>”;

  if (ctx.CurrentItem.MyCustomField) {
    returnHtml += “<p>” + ctx.CurrentItem.MyCustomField + “</p>”;
  }
  // close off our <td> and <tr> elements
  returnHtml += “</td></tr>”;
  return returnHtml;
};
Once we put this in place, our headers are back in the right place.

Custom rendering with column headers in the right place

Making your views use the correct Display Template
In order to make sure the Display Templates are used in the correct places you have a number of options.

  1. In your schema.xml of a custom list definition you can define the JSLink property allowing you to override specific views. This allows you to build List Templates which have completely bespoke views when required (especially useful for use with list view web parts)
  2. You can define the JSLink property on the List View Web Part .. and this works either for defined views in the List or for List View Web Parts which you have dropped onto other web part pages or publishing pages.
  3. You can use Code / PowerShell to modify the JSLink property of the SPView object programmatically
  4. You can of course just drop in your JavaScript file using a Script Editor or custom Master Page and use the ListTemplateType and BaseViewID properties I told you about at the beginning on this post 🙂
  5. or you can use a funky new method which allows users to create their own views using your custom templates … but more about that in Part 6 🙂

So that pretty much covers off how list views can be rendered using bespoke code. Hope you’ve been enjoying the series but we’re not done yet!

..

Next – Part 6 – Creating View Templates and Deployment Options

JSLink and Display Templates Part 4 – Validating user input

In the previous posts we have looked at JSLink and how we can use it, we have looked at overriding the rendering of individual fields both for display and also for editing. Now we are going to look at Validators and how we can validate user input before their changes are saved.

In order for a validator to work you need three moving parts:

  • Validation method (to tell SharePoint if the field input is valid or not)
  • OnError method (to handle any errors which are raised)
  • Registration code to do the plumbing

Validation Method
We’ll base this sample on the Custom Editing interface we built in Part 3 and first off we will build ourselves a validation method.

This is technically going to be an object with a Validate method (to which SharePoint will pass a value). The code for this method is as follows:

mjh.MyCustomFieldValidator = function () {
  mjh.MyCustomFieldValidator.prototype.Validate = function (value) {
    var isError = false;
    var errorMessage = “”;

    if (value == “Item 2”) {
      isError = true;
      errorMessage = “You cannot select ‘Item 2′”;
    }
    returnnew SPClientForms.ClientValidation.ValidationResult(isError, errorMessage);
  };
};

The code above contains a very simple if statement to check the items value (in my example saying that an error message will be displayed if the item value is set to “Item 2” .. one of the drop-down choices from Part 3 of this series).

Finally we call the SPClientForms.ClientValidation.ValidationResult method passing in our “isError” (a true/false boolean) and the error message (a text string).

OnError Method
We then need a final method which tells SharePoint basically what to do when an error actually occurs. This is a fairly simple method in which you can basically do whatever you want (pop-up alerts, add HTML to the page, change CSS, whatever you need).

Now we could just use an Alert(error.message) function if we wanted a particularly crude error message but it would be much better to have some formatted error message just like SharePoint does out of the box .. and for that to work we first need to have ourselves a recognisable element that we can manipulate using jQuery, so we add the following code to our rendering method for the edit interface:

// add the error span
returnHtml += “<span id=’MyCustomFieldError’ class=’ms-formvalidation ms-csrformvalidation’></span>”;

Once we have this we can manipulate it in our “onError” function (which as you can see is very simple).

mjh.onError = function (error) {
  $(“#MyCustomFieldError”)
  .html(“<span role=’alert’>” + error.errorMessage + “</span>”);
};

So all we are really doing is grabbing the span using the ID we gave it, then injecting our error message.

Now for the plumbing …
So the only thing missing is making this all hang together from inside our render method:
var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);

// register the field validators

var fieldValidators = new SPClientForms.ClientValidation.ValidatorSet();

if (formCtx.fieldSchema.Required) {
  fieldValidators.RegisterValidator(
    new SPClientForms.ClientValidation.RequiredValidator()
  );
} fieldValidators.RegisterValidator(new mjh.MyCustomFieldValidator());

formCtx.registerValidationErrorCallback(formCtx.fieldName, mjh.onError);
formCtx.registerClientValidator(formCtx.fieldName, fieldValidators);

So lets walk through what we are doing in the code above.

First off we create ourselves a new ValidatorSet which will contain the validators that we need for the field. We then do a simple check to see if it is a required (mandatory) field and if it is we add the standard SharePoing “RequiredValidator” to our ValidatorSet.

Then we add our own new “MyCustomFieldValidator” object to the validator set.

Finally we have two register methods. The first one registerValidationErrorCallback is basically telling SharePoint that if our field fails validation that it should call the mjh.onError method to deal will letting the user know what has gone wrong.

The second one registerClientValidator actually registers our validators with SharePoint for the chosen field.

Note – it is perfectly possible to register your client validator without providing a validation error callback. If you do this then the validator will stop the form from being saved but the user won’t be told why (they’ll just get a frustrating form which won’t post back).

So ..  assuming all of the above has worked correctly you would see something like this if you tried to selected “Item 2”:

Validation message being shown in SharePoint

So that should be what you need to start putting together your own custom validation. You can of course use this technique on any number of fields.

For the complete code-sample to date (including Parts 2 and 3) please download the Visual Studio solution here:

https://sdrv.ms/15eB6CI

….

Next – Part 5 – Creating Custom List Views

JSLink and Display Templates Part 3 – Creating a custom editing interface

So this part talks about some of the more interesting bits of Display Templates .. the editing interface. This introduces some new features as not only are we required to provide and rendering all of the editing controls but we also have to somehow get SharePoint to understand what value it should use when someone wants to save their changes.

Now the process for creating an editing interface is identical for both “New” and “Edit” forms (with the exception that the editing interface also needs to deal with loading up existing values) so for this post our examples will focus on the “Edit Form” functionality.

Registering our Edit Form function
So this uses exactly the same technique that we walked through in Part 2, where we register our desired override method for our named field.

(function() {
  var mjhOverrides = {};
  mjhOverrides.Templates = {};

  mjhOverrides.Templates.Fields = {  

    ‘MyCustomField’: {
      ‘NewForm’: mjh.editMethod,
      ‘EditForm’: mjh.editMethod
    }
  };

  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(mjhOverrides );
 })();
So just like before we create ourselves an override object and tell it we want to use the method “mjh.editMethod(ctx)” to render both the “EditForm” and “NewForm” for our field “MyCustomField” and we then register that using the SPClientTemplates.TemplateManager.RegisterTemplateOverrides method.

The Edit Render Method
The format of the rendering method for the edit interface (in this example) is pretty straightforward. I have simply rendered out a drop-down list containing three items.

mjh.editMethod = function (ctx) {
  var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx); 

  formCtx.registerGetValueCallback(formCtx.fieldName, mjh.getFieldValue.bind(null, formCtx.fieldName));

  // items to appear in the drop down list
  var items = new Array(“Item 1”, “Item 2”, “Item 3”);
  var returnHtml = “<div id=” + ctx.CurrentFieldSchema.Name + “><select>”;
 
  for (var i = 0; i < length; i++) {
    returnHtml += “<option”;
    if (ctx.CurrentFieldValue == items[i]) {
      // select the current item if the value matches
      returnHtml += ” selected “;
    }  
    returnHtml += “>” + items[i] + “</option>”;
  }

  returnHtml += “</select></div>”;
  return returnHtml;
};

 

Now as you can see this time we have a new method in play as we are also creating a new “FormContext” object and using the registerGetValueCallback method. This method is what tells SharePoint to use our method to find out what the field value should be when the item is saved. The first argument is the name of the field we are overriding, and the second argument is the method that will return our field value.

We have also made use of the JavaScript “bind” function so that we can specify arguments that should be passed to our callback method, in this case we want to pass the field name (you’ll see why in a minute). 

The only other thing special going on here is that I check to see if the current value of the item matches the option, and if it is we add the “selected” attributed.

We have also enclosed the whole thing in a div using the fieldname as the ID, which we can use in our callback method below …

The Get Value callback
The next thing of course is our method to retrieve the actual field value, and for this we use a little bit of jQuery (you can choose your own way of getting the jQuery library onto the page. Adding it as an extra JSLink URL is quite cool, although if you use jQuery everywhere you might otherwise want to use a Custom Action or Delegate Control so it appears on every page).

mjh.getFieldValue = function (fieldName) {
  // a div used with jQuery to identify the appropriate items 
  var divId = “#” + fieldName;
  // get the selected item 
  var selectedItem = $(divId + ‘ option:selected’)[0];
  // return the value 
  return selectedItem.innerText;
};
So you can see above that we are using the fieldName argument so we can identify the correct div. This allows us to use the same methods on multiple fields without them clashing.
We then simply use a small jQuery statement to pull out the selected item (the “option” element which has an attributed of “selected”) and return the “innerText” (which in our example is the value we want to save). Of course you need to be mindful of the data type of the field you are working with. All values are returned as Text but fields such as People and Lookup Fields need to return a specifically formatted string.
I then bound this to a site column (of type Text) with the following schema:
<Field ID={A424AE9E-1F1D-4ECE-B695-202F5106352E}
  Name=MyCustomField
  DisplayName=My Custom Field
  Description=a text field which has custom rendering?
  Type=Text
  Required=FALSE
  Group=MJH JSLink Columns
  JSLink=~layouts/MJH.JSLink/jquery-1.10.2.min.js|~layouts/MJH.JSLink/MJH.JSLink.js
  Overwrite=TRUE>
</Field>
Once that is all deployed it should look something like this …

My Custom Field – a Text field but rendered as a drop-down list

So that is pretty much all you need to get going with editing of fields. Come back for Part 7 where I share sample code for handling Lookup Fields (and converting them to checkbox lists), cascading dropdowns and generating values by calling AJAX REST queries.

In the meantime you can download the sample code from this example here:
https://sdrv.ms/14KtFgv

Next – Part 4 – Validating user input

JSLink and Display Templates Part 2 – Changing how individual fields display

This is part two in my JSLink and Display Template series, and in this post we will be looking at the actual Display Template JavaScript code to override the rendering of individual fields.

If you haven’t read Part 1 and then it is well worth a look, if nothing else you need to understand the URL tokens and where/how you use JSLink to get your Display Template in the right place.

So what will we be doing?
The premise of using Display Templates here is simple, we are going to tell SharePoint
that when it wants to render a field we want it to use one of our JavaScript functions instead of the “out of the box” one.

We can do this on each field for four different rendering methods:

  • Display Forms
  • Edit Forms
  • New Forms
  • Views (as in, list views)

This post will look at the “Display Form” while the others are covered in further posts in this series.

Registering your Override Methods
The magic all happens through a SharePoint JavaScript method called SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctx). This expects a single object to be passed in which declares what exactly we want to override.

This method call is actually the same we use throughout this series, but in this example we will focus on the Fields part of it.

In order to do this we need to create an object which has an empty “Templates” object value. This “Templates” object then contains a “Fields” object value which contains an array specifying the fields we want to override. Each field override then refers to methods which contains the rendering logic for that field.

We finally pass our main object over to the RegisterTemplateOverrides method and let SharePoint take care of the rest. For example:

(function() {
  var mjhOverrides = {};
  mjhOverrides.Templates = {};

  mjhOverrides.Templates.Fields = { 

    ‘MyCustomField’: {
      ‘DisplayForm’: mjh.displayMethod
    }
  };

  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(mjhOverrides );

})();

So in the example code above we create our override object called “mjhOverrides” (which has a “Templates.Fields” value).  We then assigned an array (of one item) which specified the InternalName of the field I want to override (in this case “MyCustomField”).

I then specified that when SharePoint wants to render this field for a “Display Form” then I want it to use my own method called “mjh.displayMethod”

The whole thing is wrapped in an anonymous self-executing function so that it executes as soon as the page is loaded but doesn’t pollute the global namespace.

Of course, you could specify multiple different fields or multiple different override methods, this uses simple JavaScript array principles and an example is shown below:

mjhOverrides.Templates.Fields =

{ 

  ‘MyCustomField: {
    ‘DisplayForm’: mjh.displayMethod,
    ‘View’: mjh.viewMethod
  }, 
  ‘Title’: {
    ‘DisplayForm’: mjh.displayMethod,
    ‘View’: mjh.viewTitleMethod
  }

};

So in the above example we are overriding two different fields (a custom field called “MyCustomField” and the out of the box “Title” field). For each field we specify overrides for both the DisplayForm and the View (List View) methods.

Note that we can re-use the same rendering method multiple times for different fields (so it is highly recommended to try and build reusable generic render methods where possible).

Format of a Render Method
So now that we have told SharePoint which render method we want it to use I suppose it would be useful to actually write it. Being a good JavaScript citizen we declared our own namespace for our functions so we didn’t pollute the global namespace, so the function starts off with a simple method declaration.

var mjh = mjh || {};

mjh.displayMethod = function (ctx) {
  return ‘<div>Hello World</div>’;
}

The format as you can see is very simple. All we need to do is return a string which contains the HTML we want to display. This example is not particularly useful as every item will render the same HTML (a simple Hello World message).

Hopefully you can appreciate that with the power of JavaScript and CSS you really do have full-reign to do whatever you want here. You can declare JavaScript events for AJAX REST calls or simply using some CSS and jQuery to create a funky dynamic interface (or just output some nice clean HTML).

However, this example isn’t terribly useful as what we REALLY want are access to the item values, and this is where the “ctx” object comes in. This is a method argument which SharePoint automatically provides and is a “Render Context” object.

Now I really haven’t been able to find very much information on MSDN / TechNet (read – actually I’ve found nothing) which describes this object and all of its methods, but from inspecting the JavaScript object using the developer tools I’ve managed to gleam a fair bit of detail. I’ve listed the basic values below, but to be honest you’d get a lot of value by poking around in the script debugger and checking out this object in more detail.

// value of the current field
var currentValue = ctx.CurrentFieldValue;

// the list item object
var item = ctx.CurrentItem;

// get the schema for the field
var field = ctx.CurrentFieldSchema;

So in order to make our display method a little more useful we should update it to the following:

mjh.displayMethod = function (ctx) {
  return ‘<div class=’mjhCustomField’>’ + ctx.CurrentFieldValue + ‘</div>’;
}

So now we have our item being displayed in a custom div with our own class. We can of course properly go to town on this but you get the idea 🙂

This is all then wrapped into a JavaScript file and attached either to the Site Column (declaratively in XML) or the List Form Web Part, or the Content Type (for more information on how to do that please go and read Part 1).

So that is about as complicated as it gets for Display Forms, but don’t worry, we have all sorts of fun and games coming up in the next parts in the series, first creating custom editing interfaces, providing validator methods and overriding views.

Next : Part 3 – Creating a custom editing interface

« Older Entries