The New Model for Office and SharePoint Apps

As I write this blog entry, I’m flying to Atlanta to give the last of 13 seminars on the new App model that is available for Office 2013 and SharePoint 2013. I have taught this material to people all over North America, as well as in Paris. As a result, I have talked to a large number of people not only about the model, but also about their plans for it. This gives me a fairly unique perspective into how people are taking the new model, as well as how it will be adopted over the next 6-9 months.

What is “The New App Model”

In a nutshell, the new app model is conceptually similar for both Office 2013 and SharePoint 2013. The basic idea is that the application no longer needs to be installed on the client’s machine (or in the SharePoint farm). There is no assembly that is deployed onto the user’s system. Instead, a manifest, in the form of an XML file, is made accessible to the client software. This manifest file includes, among other things, a URL where the application lives. And that application interacts with your client software (whether it be Office or SharePoint) through a combination of JavaScript and server-side code. That’s right, the App Model allows you to create Web sites that are hosted any place you want, but appear to run inside of Office/SharePoint. And, by the way, the Web site can be constructed using any technology you want. There is no requirement that the site use the Microsoft stack. If you’re rather create Web applications using LAMP, that’s all fine and good in this model.

What’s the Benefit?

Well for the Apps for Office model, the benefit is that you don’t have to wrestle with VSTO or MSIs to be able to deploy your applications. There is (more or less) no administrative permissions required to install an application. And there is now an Office Store where users can search for and install your application. So your ability to reach more potential clients is much higher.

For the Apps for SharePoint model, there is no need for sandbox solutions. This is not to say that you still can’t write sandbox (or farm) solutions. You can. And they still have all of the same limitations that those applications had in SharePoint 2010. But the guidance is that they should no longer be needed. The client side object model (CSOM) has been expanded to the point where farm solutions are probably not required. And if you are working in a shared hosting environment (that’s everyone is SharePoint Online, as well as a number of clients of ours), then you can be freed from the limitations of the sandbox.

And What are the Problems?

The biggest problem is that, because the model is completely new, there is no compatibility with older versions of the products. This model will not work with Office 2010 or SharePoint 2010. At all. No way, no how. If you understand the details of what’s going on, you’ll understand why this limitation exists. But the practical impact is that your only audience for any app you write and want to sell is new users. In the corporate world, this could be a few years off. For SharePoint Online, it’s a little closer, as the back-end functionality is in the process of being converted, with the user interface to be upgraded over the next 12-18 month.

Along with the need to have users on the latest version, the capability of the interface with the software seems to be a little lacking in certain areas. I found this to be particularly true in the Apps for Office model. A number of people had interesting ideas for Word or Excel applications and their first choice for a user experience ran aground on the shoals of missing capabilities. For instance, there is no way to retrieve or modify the format for a particular cell. Nor is there the ability to have the app set the currently selected cell. Is this a critical lack of functionality? Possibility. But I also know a number of people who are on the development team and they are eager to address holes in the functionality, especially if there is a compelling story around the request.

Is It Worth Using?

I think that quick answer is ‘yes’. Now it could be that I’m biased…I have been teaching this material for a while. But I like to think that talking to people about the model, hearing what they want to do and working through how it might be done has given me perspective. And I don’t have a history of liking a technology just because I teach it.

Again, dividing between Office and SharePoint, I believe that app model for SharePoint will be transformative. In particular, if you have a Web-based application that has nothing whatsoever to do with SharePoint, it is simple to integrate the application with SharePoint. And put it into the SharePoint Store, increasing its visibility. The model also requires that people who create SharePoint applications need to rethink their approach. Instead of being forced to utilize SharePoint as a data store (a task for which is it not particularly well suited), you can use a real database. Yea!!!!

The app model for Office is a good one in cases where it fits. At the moment, that seems to be helper applications. Dictionaries, encyclopedias, image searching. Maybe an application that can perform calculations based on the data in the document. But at the moment, there do seem to be some pieces of functionality that I’d like to see put in place. And the model is so different from how users typically use Word/Excel that I can see it taking a little bit of time to see mass acceptance.

If you have any experience with the app model, either with Office or SharePoint, I’d like to hear how it went. What type of applications have you created? Was there missing functionality that you had to work around? I’m done with the teaching tour, but I’d still like to keep in touch with how people use the model.

ObjectSharp at DevTeach

If you are an aficionado of conferences, then odds are pretty good that you have already aware that DevTeach is coming to Toronto at the end of May (May 27-31, to be precise). If you have not attended, heard of or thought about DevTeach, then you’re in for a treat.

DevTeach is a conference. For developers. By developers. If you want to learn about the latest technology, then DevTeach is the place to be. This is true whether you are interesting in developing apps, using and administering SQL Server, or working with the latest mobile technology. You will hear from industry experts, people from not only all over North America, but also locals you can chat with afterwards. And when it comes to networking, there are few conferences that offer the opportunity to hang with as many of the best and brightest.

At ObjectSharp, we are proud to be a supporter of DevTeach. And we are lucky enough to have a list of associates who are knowledgeable enough to be able (and generous enough to be willing) to share their insights and experience with others. The following is a list of the sessions that are led by one of our own. If this list isn’t enough to entice you, then check out the full schedule here. Or you can just trust me and sign up here. Take advantage of the fact that all of this talent is within your reach to hear from and talk to.

clip_image002Colin Bowern

Designing with ASP.NET MVC and Web API – Tues, May 28

The State of (Corporate) HTML5 – Wed, May 29

Managing a Cross-Platform Code Base – Wed, May 29

Handing Identity Management for SaaS Apps – Thurs, May 30

clip_image004Bruce Johnson

var WebDeveloper = new OfficeAndSharePointAppDev; – Wed, May 29

Using Hybrid Solutions in Windows Azure – Thurs, May 30

Advanced Windows Phone 8 (full day, pre-conference session) – Mon, May 27

clip_image006Atley Hunter

Building Mobile Experiences that Don't Suck – Wed, May 29

HackTeach – Wed, May 29

MTM Test Suite–add requirement

One option in Test Manager for Test Suite is “Add Requirement” which adds the Requirement ID and it’s title as a test suite. Example below:




What happens if at a later date someone goes in and changes the title of the PBI?

First the change in the work item to the title does not show in your Test Suite. What has been added to Test Manager is an object on it’s own not a link to the actual work item. Think of it as a folder for tests related to your requirement.

What can I do?

There is the delete/add option however you will lose all test results associated to your test suite. When you delete a suite all test points contained within the suite are deleted. I would only use this when test execution has not happened yet for the test suite.

The rename option on a test suite can be used. Select test suite > right-click > Rename. In this option I would copy from the actual work item so the titles match.

How do you know there has been a change?

Often you don’t without someone telling you or finding by accident or creating a query to compare with. I’d like an alert that tells me when a Requirement title has changed and the Iteration Path. Both of these can affect the Test Plans and their Suites.

This happens in both MTM2010 and MTM2012.

Testa Smile


Welcome to the Author Fold

For most people, the idea of writing a book is a daunting one. There is little that scares people more than a blank page and the need to put 10,000 words onto it in the next 30 days or so. I believe that death and public speaking might be higher on the list, but only by a little. So the gumption it takes to put together a book proposal, submit it to a publisher, write all of those words, suffer with editors and technical editors making comments and finally get to the point where it’s it published is a big deal. For that reason, I’d like to celebrate two of my ObjectSharp colleagues, Lori Lalonde (@LoriBLalonde) and David Totzke (@VisualDragon) who now have a publication date for their book, Windows Phone 8 Recipes.

I know that it’s a thankless journey, but allow me to offer up my appreciation for your contribution to the world of technical literature. As for the rest of you, you can show your appreciation by going here and buying a copy. It is currently on pre-order with a scheduled publication date of June 26th, but you can buy an alpha copy of the book and get access to the wonders that are inside right now.

AppFest Contest Results

Hopefully most, if not all, of you will be aware of the AppFests that ObjectSharp ran in conjunction with Microsoft between September and December of last year. If you had the joy of attending, you would definitely be aware that by submitting apps to either the Windows Phone Marketplace or the Windows Store, you would have a chance to win either a Surface RT or a Nokia Lumia 920. Well, it has taken a while to get the submission information (and thanks to Jonathan Rozenblit for his help), but we have gathered up all of the apps that were submitted, calculated the entries and found our winners. They are as follows:

Surface RT Winner: Tom Walker (Orange Crush)

Tom submitted nine apps and the following is one of his better reviewed ones

Short Cuts - Life is to short to waste time trying to find your phone settings. Short Cuts enables the user to quickly access their phones wifi, bluetooth, airplane mode and cellular settings

Nokia Lumia 920 winner: Gordon Lo (13 Sides)

Gordon submitted a total of 8 apps and the following app received 4 stars over 17 reviews

My Business Card - My Business Card is a simple, fast, and lightweight way to share your contact information using a QR Code. This app encodes it as a MeCard that is compatible with virtually all QR Code scanners out there. Share quickly, and share easily with My Business Card.

Finally, just so you have a sense of the volume of apps produced through the AppFest engine :), we recorded a total of 107 Windows Phone apps and 49 Windows Store apps. Not bad, but I know you can do better. If you check out the Developer Movement web site (, you can see how to sign up, submit your apps and win some cool prizes.

I will profile a number of the other apps that were created through the AppFest process over the next few blog posts. If you’d like to receive some publicity for apps that you have built, feel free to drop me an email with a link to your store or marketplace page.

TFS builds and HTTP Code 500 error

At one of our clients, TFS build server was choking for no good reason with the following error “Please contact your administrator. There was an error contacting the server. Technical information (for administrator): System.ServiceModel.ServiceActivationException.” Not very useful error message, isn’t it? TFS logs were a bit more informative and had the following error:

WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/4342953
Exception: System.ServiceModel.ServiceActivationException: The service '/tfs/queue/DefaultCollection/Services/v4.0/MessageQueueService2.svc' cannot be activated due to an exception during compilation.  The exception message is: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item. ---> System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item
   at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
   at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
   at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
   at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
Process Name: w3wp

Now, that’s a much better error message. It actually tells us that the problem is caused by multiple bindings in IIS on TFS website and it tells us how this error can be fixed. I love such errors. Anyway, to fix the problem we need to add the following line to web.config file on TFS server:

<serviceHostingEnvironment aspNetCompatibilityEnabled=”true" multipleSiteBindingsEnabled="true" />

Then restart TFS Build Service, and it’s all good again…

What Do You Think Your Job Is?

Shortly after I published my last blog entry on the complaints that developers have about writing unit test (see Do I Have to Unit Test), I came across this blog entry from Derick Bailey entitled “You Are Not Paid to Write Software”. This approached the issue of excuses for the lack of unit tests from a different angle. And one that I wholeheartedly agree with.

So let me ask those of you who are professional developers a simple question. What do you think your job is?

Is your job to write the code that your boss tells you to write?

Is you job to write the code to implement every feature that your users ask for?

Is your job to find the most efficient and effective way to move the contents of a database and put it onto the screen?

Is it to optimize the code that you’re writing to squeeze every last drop of performance from it?

I’m going to suggest that you should have answered no to every single one of those questions.

If you are a developer, your job is to solve problems. The process is supposed to go as follows: users describe the problem, you develop a solution to the problem, you deliver solution to the problem, user is happy.

Sounds almost too easy, doesn’t it :)

But there is an unspoken contract in this process. Once you have solved a problem, there is no reason why you should have to solve the problem again. You don’t want to have to solve it again. And the user has no reason to have you solve it again. Not to mention that the user doesn’t want to find out that the problem that was previously solved is back again.

So why do you not do everything in your power to keep this from happening? And what is one of the simplest steps you could take?

Write unit tests.

You see? Derrick is correct. You are not paid to write software. You are paid to solve problems. And to make sure that they stay solved. Again, what is one of the easiest ways to make sure this happens?

Write unit tests!

Keep that in mind they next time you question whether you should be writing unit tests. It’s actually not a question that should come up. Writing unit tests should be part of your job. And if it’s not, then ask yourself what you think your job really is?

Do I Have to Unit Test?

It could very well be the fact that I have four kids that makes me interpret this particular question as coming from the mouths of one of my children. It’s like I have asked developers to eat their broccoli while staring at a three scoop sundae sitting not 6 inches from where they sit.

First off, I’m not a ‘true believer’. I don’t do TDD for every drop of code I write. For instance, if I have a simple property (that is, nothing but storage and retrieval), I won’t start by writing a unit test. This changes the moment that I put any kind of functionality (like validation) into the property. But my starting point for properties is not truly red-green-refactor.

That having been said, my short answer to the question in the title is “yes”. My longer (and less sensitive) answer is ‘Of course you do. Duh! Why would you not want to write unit tests’.

To be honest, if you’re a developer and asking this question, I’m guessing that you don’t understand why you should actually demand that unit tests be written for your code. So let’s go over what the benefits of a good suite of unit tests.

Change != Breaking Changes

Your code is going to change. Maybe not today. Maybe not tomorrow. But some day and for the rest of its life. It’s one of the few givens in programming. But when you do make a change to your code, how do you know whether or not it’s a breaking change. I mean, you’re trying to avoid breaking changes (at least unintentional ones). But how do you KNOW?

The answer is that without unit tests, you don’t. So one reason for writing unit tests is to make sure that when you’re fixing a bug or adding a new feature that you don’t unintentionally introduce problems. This was driving home for me about 8 or 9 years ago. I was working on a project for a commercial application that had about 25-30 people on the team. We were getting close to delivery and we went through a performance sprint. In other words, the sole purpose of the sprint was to find bottlenecks and fix them.

Ask yourself this question. Would you, about two weeks prior to the delivery date of a large project, completely revamp some of the internal functionality? Change how some fundamental functions worked so that performance was improved? If you did, would you be putting your project at risk?

With a complete set of unit tests, we could do this knowing that so long as all of the tests were green when we finished the change, the rest of the application would be unaware of our modifications. Unit tests allowed me to sleep peacefully when the product was eventually released.

Better Interfaces

One of the interesting side effects of unit testing is that you have to be a consumer of your own classes. You have to create and use the methods that you have created. Sometimes that can be an interesting (and humbling) experience. If you find a method awkward to use, odds are that any other developer will have the same feeling.

So fix it. As you’re writing your unit tests, change your methods, change your parameters, make it better. This is part of the refactoring step in TDD. But if you haven’t had to actually use the methods that you created, you’re less likely to see that it’s not easy for someone else to use them.

Built-In Documentation

How many of you write documentation for your code? Yeah, though so. How about putting comments into your code? More, but probably still not that many. What if you could provide any future changer of your code examples of how you expected that your methods would be called?

That’s what unit tests provide.

Again, for every reasonable combination of parameters, you have a method that demonstrates what you expect to go in and what you expect the result to be. It’s not as viewable as a help file, but it beats the heck of the ‘nothing’ that you’re currently doing.

Ultimately, the reason to unit test is not just to find bugs. It’s to allow for the natural evolution of the code you write to continue without you needing to be there. And doing something other than maintaining the code you’ve written is an ideal that we all strive for.

Creating a linked Workitem via the TFS API

I have a customer that wanted to create Approvals for a particular work item type. We decided the best way to do this would be to create an Approval work item type and a new Link type called Approvals.

I found it difficult to find an example out there of creating new work item and linking it to another using my own link type. Once I got it working I thought I would Blog it so the next person looking for this has one more example.

Here are the steps; first using the process editor I created a new Link Type (see screen shot below for details). You can use the command line tool witadmin importlinktype to import your link type to the project.


Now to write a web service that is called via bissubscribe to create approvals for my source work item when the source work item is created. In the real code this was a bit more complicated. We had to look up who many approvals were required and create on approval for each person that was required. I have trimmed the code down to the bare necessities just to illustrate how to create the link.  

Therefore here is a sample of the code to create a new work item of the type Approval and link it to the source work item with the relationship Approved By.

//Get the TFS Collection and ensure Authenticated
TfsTeamProjectCollection TfsCollection = new TfsTeamProjectCollection(new Uri "https://Server/tfs/Collection"));
//Get the Work item store
WorkItemStore workItemStore = TfsCollection.GetService<WorkItemStore>();
//Get the project 
Project project = workItemStore.Projects["MyProject"];
//Get the Source Work item (Take for granted I have been passed the ID of the work item to be approved
WorkItem source = workItemStore.GetWorkItem(ID);
//Make a copy of that as an Approval. This way all the common data is pushed into the approval
WorkItem approval = source.Copy(project.WorkItemTypes["Approval"], WorkItemCopyFlags.None);
//Remove the related link that is created by the copy method
//Save the new work item

//Create a link of the type Approvals
WorkItemLinkType linkType = workItemStore.WorkItemLinkTypes["Approvals"];
//Create a linktypeend using the foward name in out case that is Approved By
WorkItemLinkTypeEnd linkTypeEnd = workItemStore.WorkItemLinkTypes.LinkTypeEnds[linkType.ForwardEnd.Name];
//Add the link to the source work item
source.Links.Add(new RelatedLink(linkTypeEnd, approval.Id));

SSRS and Column Headers

As a starting point, the SSRS I’m talking about here is SQL Reporting Services (had a mix up with SSMS yesterday and I’m not taking any chances). And the basic scenario is a common one. The report, which happens to be in Tablix format, has a number of rows of headers that are intended to appear at the top of each page.

This is not an abnormal request. Not in the slightest. However a recent problem strained my patience as I attempted to put the silly headers at the top of every page.

The problem was that, on an irregular but consistent manner (which is to say that it didn’t happen for every combination of parameters, but once you saw the problem, it didn’t just “go away”), the header would go missing. Instead of appearing at the top of the page, it just not be there. Or perhaps it only some of the rows of the header would be there. In this later case, if you changed the page size, you could get it to appear. But then another combination of parameters would cause the same behavior. But the upshot is that I couldn’t depend on the headers to appear every time I needed them too. Frustrating doesn’t begin to describe the feelings I had towards SSRS and headers.

First off, if you’re looking for a solution, some of the pages you’ll find do cover the fundamental process. For example here, here and here. And the information provided therein was accurate. Yes, you need to get the RowGroup into Advanced Mode. And you need to set the RepeatOnNewPage property to true. And KeepWithGroup to After. And FixedData to true. However, I’m afraid this might not be enough. At least, it wasn’t for me. Those steps had already been performed and I was still seeing the problem.

For me, the key to getting to the complete answer was something that I just happened to stumble across. It was a line in an MSDN document (that I can’t seem to find again) that said that row headers were only displayed on each page if there was enough room vertically. Column headers, on the other hand, would always be displayed. In other words, if you had placed your ‘column headers’ as just values in rows within the Tablix, then SSRS wouldn’t do anything special to ensure that they appeared at the top of each page. And this would be true even if you had taken the steps mentioned in the previous paragraph. If there was “too much” report data on the current page, the headers would be cut off as part of the prioritization that SSRS does.

With that piece of information in hand, I had another clue to search with. And that led me to a post that talked about the fact that repeating column headings only worked *if* there is a column headings area on the report. And, depending on how you created the Tablix, that might not be the case.

You call tell if you have a column heading area if you see a double dotted line someplace in the Tablix. If you don’t, then you find yourself in the situation I was in. Now, you *could* create a column group and move your row headers up to that level. For me, that was not a practical choice (because of the complexity of the data being shown in the headers). So instead, I faked it.

Start by adding a Parent Column Group. It doesn’t matter what you group by, so just select an arbitrary field or type in a constant. I choose ‘0’. Doing this adds the column heading areas to the report. Now we need to get rid of the added row without getting rid of the column heading area. In the Grouping Panel at the bottom of the report, right-click on the just added column group and select Delete. In the dialog that appears, you will be given the choice to delete either the group and related rows and columns or to delete just the group. The correct choice here is to delete just the group. If you also delete the related rows and columns, you will be back where you were before with no column heading area. Once you have deleted the group, you can go into the Tablix and delete the row which is related to the column group.

At this point, you will have a Tablix that has a column heading area with no rows in it. And your report will look as it did before. But, more importantly, because there is a column heading area, the row headers which you had previously created (and which had been cut off or just plain went missing) are now visible at the top of every page, regardless of whether a soft or hard page break rendering engine is used.

And now the world can get back to spinning on it’s regular axis. Whew!