Category Archives: Uncategorized

Create an organizational account to administrate azure when having a Microsoft Account

When you created your Microsoft Azure subscription with a personal Microsoft Account, it’s likely that you won’t be able to use some azure services, for example, the new Power BI service, as they require an organizational account. This blogpost describes on how to create an organizational account and delegate the azure administrator role to this account, so you’ll be free to use any azure service.

Continue reading

Getting SharePoint 2013 apps and WebAPI to work

With the release of Visual Studio 2013, Microsoft also added a very nice MVC template for remote SharePoint Apps. This is a slightly modifed version of the default MVC5 template, which doesn’t, for example, contain an own authentication provider, but does contain all the stuff like bootstrap and the latest jquery version. Some extra helper files have been added (via a nuget package) to assist in the communication with SharePoint 2013. This does work perfectly with the Actions defined in MVC controllers, but the code doesn’t work together with ApiControllers. Yet 😉 This blogpost shows us how (roughly) the same functionality can be implemented for use with the WebApi controller! At the end, the full source code is provided, it works in azure, as well as with high trust solutions. A good read on the basics of the SharePointContextProvider can be found here and here

Note: the provided code is by no means production ready! I didn’t test it thoroughly, but the basic scenario’s do work!

Continue reading

Failed to install app for SharePoint – Exception from HRESULT: 0x81070964

Sometimes, when creating new SharePoint applications, the following error occurs:

CorrelationId: 014b8442-57e1-41ef-9172-db01d9482844
3>        ErrorDetail: There was a problem with activating the app web definition.
3>        ErrorType: App
3>        ErrorTypeName: App Related
3>        ExceptionMessage: Exception from HRESULT: 0x81070964
3>        Source: AppWeb
3>        SourceName: App Web Deployment

Continue reading

signalR

How to integrate SignalR 2.0 in a SharePoint 2013 MVC App

With the introduction of Apps for SharePoint 2013 and the expansion of the SharePoint API, a whole new world opened for us, the SharePoint developers. This blogpost describes on how to integrate SignalR 2.0 into a SharePoint 2013 MVC app, with the possiblity to use SignalR from your hostweb! We will end up with a nifty SharePoint application that makes use of signalR and a remote  event receiver, which uses the signalR hub to push through new items to every registred client. An example solution is provided at the end of the document, but imagine what you could do with this. I personally always include signalR solutions when building apps, to monitor all events that I am interested in when debugging/fixing apps.

Continue reading

Posting documents to the SharePoint newsfeed from the contextmenu

SharePoint 2013 brought great things: great new social features, the API got a major extension and of course, the new introduced app model. A feature that I really missed though, was the ability to post documents to your newsfeed from the context menu. This blogpost describes how to do this.

Continue reading

I’ll be speaking at the visual studio 2013 launch in the Netherlands (13-11-2013)

November 13th is the day that Visual Studio 2013 officially will be launched to the public during a virtual Launch Event. InfoSupport organizes, toghether with the Microsoft communities a special event around this Launch, with the theme:

Step into the world of apps and cloud with Visual Studio 2013

All attendees will together watch the official Launch, live streamed from New York. After the stream 6 sessions are planned which will share technical details about Visual Studio 2013 and the Microsoft Platform: I’ll present one of these: Building SharePoint 2013 and Office Apps with Visual Studio 2013

Continue reading

Upgrading Masterpage and UIVersion from SharePoint 2007 to SharePoint 2010 without v4.master

When upgrading from SharePoint 2007 to SharePoint 2010, several scenarios are possible. When using the database attach method, it’s possible to stay in “V3” mode, or execute a visual upgrade too and make use of all SharePoint 2010 love. Whenever custom masterpages have been created for SharePoint 2007, the visual upgrade itself isn’t too much of an option: it upgrades the UIVersion of the current web to V4, but the custom masterpage is replaced by the default v4.master, which (of course) doesn’t provide any customizations. the next step is to create a new customized masterpage for SharePoint 2010, add it to your site and make sure to set this masterpage as the new default/custom masterpage.

The scenario I wanted to achieve, was the following:

  1. Deploy my custom solutions with all masterpages already upgraded to SP2010, so only the UIVersion should be upgraded
  2. Attach the content database
  3. Upgrade the site to v4 mode, without the need of a v4.master deployment

The problems of (visual) upgrading to SharePoint 2010

The problems of visual upgrading consist of several issues: it doesn’t work right out of the box (but that is expected), and some steps are needed to deploy and undeploy a masterpage, before the real SP2010 masterpage can be set, because the v4.master seems to be required

1 – Upgrade the site doesn’t work immediately

As stated above, a visual upgrade using the user interface or upgrade by code/powershell is needed to let the existing site run in v4 mode:

1: $web = Get-SPWeb http://site
2: $web.UIVersion = 4
3: $web.Update()

sadly, this will bug out, because SharePoint requires the v4.master to be able to upgrade to v4-mode. The v4.master has to be made available via a feature (or manually) in the masterpage gallery, before the upgrade can be executed.

2 – Upgrade to a masterpage that isn’t needed

Assuming that all customizations that did exist in SharePoint 2007 need to be retained, the above solution isn’t the final solution. Next steps are to create a SharePoint 2010 masterpage with the customizations, deploy that masterpage, and set that masterpage as the default/custom masterpage for that site. And because that v4.master wasn’t needed at all, that feature should be deactivated, or even better for hygienic reasons, be uninstalled and deleted.

why is this a problem?

As this isn’t to much of a hassle for a few sites, it does whenever some big portals/intranets are migrated, with a lot of different masterpages. When working with about 10.000 webs, this needs to be automated, but activating anddeactivating 10000 times a feature can be quite time consuming. A lot of time can be saved, whenever the customized masterpages are already “SP2010-ready”, so all is left to do, is to set the UIVersion to 4.

The solution of quickly applying a visual upgrade without a v4.master

As described above. I wanted to achieve the following scenario:

  1. Deploy my custom solutions with all masterpages already upgraded to SP2010, so only the UIVersion should be upgraded
  2. Attach the content database
  3. Upgrade the site.

what happens behind the scenes?

When firing up reflector, we see that the following happens in code:

When the UIVersion is set, an internal function called “SetUIVersion” is executed. This function takes the UIVersion as a parameter and a boolean which decides wether or not to set the masterpage. Unfortunately, this function is an internal function, so it can’t be used without using reflection.

The SetUIVersion function contains some logic to determine whether to rollback to UIVersion 3, or to upgrade to UIVersion 4. After the decision, the internal function SwitchMasterPages is called, with 5 parameters:

That function is called with the following parameters

And what happens in this function gets interesting. This function checks what default and custom masterpage are currently set (the V3 masterpages), and stores them in the propertybag of the current web, specified, by the parameters specified in the function. To determine what new masterpage needs to be set, that same propertybag is checked: in this case the properties “v4master” and “v4customMaster”. if they are empty, the default v4.master is used:

and in this part of the function, the error is thrown that the default masterpage couldn’t be found:

When the propertybag isn’t empty, the value of that propertybag is set as masterpage:

And that is our solution!

Simply set add the v4master and v4customMaster to the SPWeb propertybag, with the values of the current masterpage. Update the UIVersion of the web and update it. That should do the trick:

Summary

Upgrading a SP2007 site to SP2010 is easy to do, but it can consume quite some time and operations. To streamline the upgrade process of a SP2007 site to SP2010, it’s easier to upgrade the Sp2007 masterpages beforehand and include them, with the same name, in the solution. Deploy the solutions, attach the databases and upgrade every SPWeb using the above powershell. That should do the trick!