Just Write Something

I’ve just renewed the hosting and domain for this place and in two years I’ve written 14 posts… including this one!

Clearly I’m not an active blogger, but during some reflection I’ve come to the conclusion that I’ve been putting off a lot stuff. What’s worse, when I do sit down I seem to get very little done as I’m over-thinking.

Turning Point?

Like anything nowadays, I turned to my friend google (other search engines are available) and came across this post from Scott Hanselman Analysis Paralysis: Over-thinking and Knowing Too Much to Just CODE which rung very true.

From the number of comments, I’m clearly not the only person and there seems to be various ways people (try to) overcome it. I particularly liked the Chistopher Svec’s comment of “I usually have these 2 xkcd comics close at hand to help remind me to Just Do It / YAGNI” referring to https://xkcd.com/974/ & http://xkcd.com/1205/.

And if by coincidence, the first post on Christopher’s blog (at the time of writing has a title of:

“Doing nothing is cheap. Failure is cheaper.”

Sums it up nicely. Off to think about coding :)

70-486 – Useful Web API Tutorials

While studying for 70-486 I’ve found a couple of useful resources for studying Web API. Before listing each one, it’s worth pointing out that this is before the March 2014 refresh of the exams.

If you have little programming experience, I recommend you follow them in this order as they get more complicated as the list goes on. If however, you’re already comfortable with MVC and Entity Framework you can probably skip to the penultimate or even last option.

Microsoft Virtual Academy

The whole 70-486 Jump Start is definitely worth investing your time in. Obviously there’s no actual tutorial with this, but it’s a great starting point.

Build RESTful API’s with ASP.NET Web API

This is a nice and quick introduction to Web API that will not only get you up and running with Web API, but also a simple client to consume the service. Importantly, the code on the site works as is and is easy to follow.

Positives

  • Very easy to follow
  • Introduces Service Layer/Repository pattern
  • HTTP PUT and POST
  • Shows how to capture JSON in IE! (I admit never knew this)
  • You build a simple client
  • Brief debugging in Visual Studio
  • Publish the example to Azure (I didn’t try this)

Negatives

  • Download a 100+MB file for code snippets (which you don’t technically need)

Using Web API with Entity Framework

Although this is a 7 part tutorial of Web API with EF it’s not 7 times larger! It has the added bonus of introducing another part of the exam, Entity Framework, but nothing beyond the very basics. Again, you construct a client to consume the service, but this time with a little more detail.

Positives

  • Uses EF, so if you’re not familiar with that you get exposure and if you are, it’s a slightly more “realistic” tutorial
  • More involved Client UI
  • Uses Knockout.js (the MVC template I used has 2.2.0 installed so pay attention to version numbers)
  • Authentication, albeit the installed MVC template forms authentication (blink and you’ll miss the credentials)

Negatives

  • 3 technologies (Web API, Knockout.js and Entity Framework) covered so a lot to pick up
  • starts slow, but gets quick quite rapidly, e.g. part 7 (hint: you can login as “Administrator” on the homepage)

Detailed Tutorial for Building ASP.Net Web API RESTful Service

As the name suggests, this is a more detailed tutorial of Web API than the other resources and although it’s well done, I wouldn’t recommend you start off with this one if you’re a beginner.

Positives

  • Covers Entity Framework, Dependency Injection and the Repository pattern so more “real-life”
  • HTTP POST, PUT and DELETE
  • Versioning
  • Full source code on Github

Negatives

  • May have been me, but I think some bits have been missed as I had to refer to the code a couple of times to get things going
  • Doesn’t explain using Fiddler (and why should it, so make sure you’re happy with either Fiddler or some equivalent like F12)
  • Isn’t finished so no caching.

Summary

If you want a quick overview of Web API in preparation for 70-486, the above 4 resources should get you well on your way. I haven’t taken the exam yet, so who knows if it was worth the effort, but for those familiar with WCF, Web API appears to be very nice.

Installed Markdown

I’ve taken the advice of Scott Hanselman and Rob Conery in their Get Involved! Pluralsight course and have installed Markdown (or perhaps more accurately the Markdown on Save Improved plugin). I haven’t even begun to get to grips with the syntax, but I can certainly see how much easier it’s going to become to write posts.

Speaking of which, I’ve realized why I’m finding it harder and harder to write. (Excuse the over use of Markdown)

“I’m basically doing very very little SharePoint at the moment!”

In my 9-5 job (which is more like 8-5 + work from home) I’m acting as a Product Owner and in those rare moments where I do get some “me time” I’m revising for 70-486.

The Get Involved! course warns about using names that pigeon hole you into something, so I’ve dropped the SharePoint from the blog name.

New Focus – 70-486 Developing ASP.NET MVC 4 Web Applications

A couple of posts back I said I was focusing on 70-487 Azure, but it turns out the exam reference isn’t available yet and the learning curve would be quite steep. More importantly, it wasn’t part of the SharePoint 2013 MCSD Certification like 70-486 MVC4 is. Therefore, the new plan is:

  1. Pass 70-486
  2. Pass 70-488
  3. Pass 70-489 (SharePoint 2013 MCSD complete)
  4. Pass 70-487 (MCSD: Web Applications complete)

Work is pretty hectic at the moment, so I’m not putting in as much study as I need, but I’m hoping to get a Pluralsight licence soon.

Automated SharePoint 2013 Dev Farm on Azure

After successfully creating an Active Directory VM in Azure last time and bragging about it to a tame ITPro, they pointed out that I probably have better things to spend my time doing!

Obviously he’s right (or scared that I’m going to take his crown as the only SharePoint ITPro in town) so I followed his recommendation and used these Automated Deployment of SharePoint 2013 with Windows Azure PowerShell scripts from GitHub.

I don’t know if I failed to follow the “Configuring your environment” section correctly, but it failed the first time I tried. Unfortunately the VM I was running in locked up over night, so I don’t have the full error message, but it definitely contained “The WinRM client cannot process the request” as that’s all in my browser history. I tracked that down to a section where it connects to the DC and attempts to assign an attached disk a driver letter and format it using remote PowerShell.

I eventually got it working by:

  1. Clearing out everything from the Azure management portal
  2. Running the script again, but cancelling it immediately after it fails to make the remote PowerShell connection
  3. Delete the DC in the Azure management portal but leave the Cloud Service and Storage account the scripts created in 2.
  4. Re-running the script, but this time specifying -ServiceName and -StorageAccountName created in 2.

There were a few errors in the script, but they were all at the start and along the lines of “X already exists”. I don’t know how long it takes as I left it to run over night, but I can now RDP into the SharePoint box, browse central admin and the visit publishing site the scripts create.

Build a SP2013 dev box on Azure

To say this place has been neglected would be an understatement. I’m going to do 4 things to rectify that:

  1. Broaden the scope from just SharePoint to anything IT related*
  2. Start studying for some new exams – currently Developing Windows Azure and Web Services
  3. Use it like a journal
  4. Read up on WordPress so I know what I’m doing

So to kick things off, I’m killing two birds with one stone by trying to build a SharePoint 2013 Development/Test lab in the cloud on Azures.

So far I’ve managed to complete exercise 3, which is basically creating an active directory box in “spouse-mode” – my new favorite saying that I saw over on Bjørn Furuknap’s blog SharePoint – You’re Doing it Wrong! - which isn’t complex, but hey, you have to start somewhere!

* think http://www.sharepointviking.com/ but including some Agile/Scrum posts

Saving to a SharePoint List Cross-Domain

What I thought would be pretty easy, turned out to be quite a difficult. I naively thought you could save some user input from http://portal/sites/test to http://my/sites/sp_admin. Turns out, that because this is basically attempting to save data cross-domain, for security reasons this is locked down. I figured it out in the end, but went through a fair bit of trial and error first:

Attempt 1 – Client Object Model
Failure 1 – You simply cannot create a ClientContext cross-domain.

Attempt 2 – JSONP
Failure 2 – I *think* this would actually work as there’s a good blog post about creating A weather forecast WebPart using JSONP. But this was for a secure website, so executing javascript unquestioned seemed like a bad idea.

Attempt 3 – Web Services, e.g. http://weblogs.asp.net/jan/archive/2009/04/10/creating-list-items-with-jquery-and-the-sharepoint-web-services.aspx
Failure 3 – Again doesn’t work cross-domain. From the documentation at http://api.jquery.com/jQuery.ajax

Additional Notes: Due to browser security restrictions, most “Ajax” requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol. Script and JSONP requests are not subject to the same origin policy restrictions.

Attempt 4 – Server Object Model in a Web Part
Problem 4 – The Application Pool of http://portal doesn’t have write access to http://my. I quizzed a friendly IT Pro and he assured it’s by design and again for security reasons!

Attempt 5 – Sandbox Solution
Success! By hosting a Sandbox Proxy on the destination domain and using a sandbox webpart on the source domain, you can pass data cross-domain. I won’t expand on how to write sandbox solutions as that’s very well documented elsewhere.

Full-Trust Proxy “Operation is not valid due to the current state of the object.”

I’ve recently had to do a little work using a SharePoint Full-Trust Proxy. Everything worked well on my development machine but when it was moved to our staging environment we were getting the rather unhelpful message “Operation is not valid due to the current state of the object.”. Apparently “it works on my machine” doesn’t cut it! :(

In the end, it was a combination of things and now I have the following things on my checklist:

  1. Ensure the SharePoint User Code Service is enabled in SharePoint Central Admin
  2. Ensure the SharePoint Service is running in services.msc (it probably is if you’re doing the above)
  3. Ensure the WSP is being installed to the Sandbox and not the GAC, i.e. Install-SPUserSolution and not Install-SPSolution

How I passed 70-480 “Programming in HTML5 with JavaScript and CSS3″

It’s been a very long time since I even thought about this place, but I’m hoping that will change now I’ve passed 70-480 “Programming in HTML5 with JavaScript and CSS3″. In keeping with my other “How I passed” posts, this will provide a little detail on how much work I put in, how I found the exam (compared to the syllabus) and the guides I used to revise. First of all, I under-estimated this exam a little. Although I hadn’t ever used HTML5 or CSS3, I’ve been working with HTML, JS (including jQuery) and CSS on and off for over 5 years so figured this was just be a “brushing up” exercise. A *lot* of it was, but now I know the language a lot more, I think it’s safe to say I didn’t really have a clue about JavaScript. Variable scope, Inheritance, Prototypes etc were all a real eye opener. With regards to HTML, I was completely oblivious to Web Sockets, Web Workers, App Cache, GeoLocation, Storage API etc so that was a bit of a shock too. CSS 3 wasn’t a massive leap, but there was a fair bit to learn. Unfortunately because of the under-estimating I didn’t put in that many hours proper study. I’d say somewhere in the region of 15 hours of study and then 5 hours of *cramming*. Thankfully I was really lucky and avoided a lot of questions on my weakest points and some of the questions provided answers to previous questions \o/ yay! As to the resources, I found the following to be really useful:

Those were my main goto points, but I also skimmed through the following sites:

Good luck to anyone that takes the exam, I hope these links prove useful.

SharePoint 2013 Ignite Training

I spent 4 days of last week in Reading on a SharePoint 2013 Ignite training course. Unfortunately it was the IT Pro version of the course and not the developer session that I was led to believe it would be, but that didn’t stop it being an awesome week.

Huge thanks to Mitch Prince, Neil Hodgkinson and Wayne Ewington for their time and expertise. We could not have asked for a nicer bunch of people and boy do they know their stuff. All three are SharePoint MCMs and Wayne is only one of 5 people in the whole world to be a Microsoft Certified Architect (MCA)!

There was way too much stuff covered to distil to one blog post, but the main points I’ve taken away from the week are:

SharePoint is a *HUGE* product

Mitch, Neil and Wayne constantly deferred to each other. If they look for help elsewhere, there’s simply no way you can be “THE SharePoint Guy”.

Don’t Expect to run SharePoint 2013 on 4 servers

Unless you’re serving a very small number of users with limited functionality, you won’t be setting up just a DC, SQL, App and WFE server. Depending on the situation you might end up with a farm (yes *farm*) for the Distributed Cache ServiceWorkflowOffice Web Apps etc

Search is now more important than ever

There have a been a lot of changes to search in SharePoint. Thankfully there’s now just one version of search (no more Server and FAST) but it’s used to underpin *lots* of the other functionality like Web Analytics, E-Discovery etc. So if you don’t have a functioning/performant crawler/query engine you’re missing out. I particularly liked the sound of “Continuous” crawling as that would’ve come in handy on a recent project.

Certification has got a lot harder

They’ve raised the bar on achieving the equivalent of MCPD and MCITP certifications. In 2013 these have become MCSD and MCSE respectively and they now contain some stuff that was previously at the Master level. Oh and you have to renew your certification every 3 years or they drop off your transcript!

 

Thankfully, besides the app model and the push to CSOM, not a lot has changed for the on-premise server object model developer. Visual Studio 2012 has a nice new GUI for  for building content types, lists etc but otherwise it *should* be business as usual. If/when I start working with some of the new features I’ll try and post about them.