CHunky Universe of Vigouros Astonishing SHarepoint :)

My first Office Add-In

Yesterday I participated in the Hackathon at European SharePoin Conference in Stockholm. The main goal was to learn more about Office Add-Ins. I wanted to create a very very simple app to learn the basics. Here in this post I’ll provide some links and describe the steps needed to start developing your Office Add-Ins.

The Add-in I created is an Outlook Add-In, it is called “Joke Inserter” and with it you can insert a random Chuck Norris joke. It is just for fun, but it demonstrated how an add-in can be installed, made available in “New E-mail” and interact with the e-mail you are writing.

All the code is on github. The random jokes come from The Internet Chuck Norris Database. As I said, the jokes were just for fun, this add-in is of course, not a business app. During the hackathon I got help from Pretish Abraham, Jeremy Thake and …

This is the result:



  • Any OS, I happened to have Windows :)
  • git, nodejs, npm (they should be in the $env:PATH)

Install following npm packages globally:

npm install -g tsd yeoman generator-office gulp

Creating the Add-In

Now with the yeoman support it is very easy:

Create a folder and scaffold an app:

mkdir joke-inserter
yo office

After that update the manifest file: Icon Url, and Support Url

Start the application on localhost:

gulp serve-static

Go to your Click on Manage Apps and add the manifest file from your solution. I uploaded this app on azure: You can try this app by installing the manifest file in you Outlook client.

Now when one is done with that simple fun add-in, it is very easy to go ahead and create real add-ins that provide value to you and your colleages.





Working with resx files in Visual Studio

Today I found a nice Visual Studio Extension for working with localization and resx files: Resx Resource Manager. This extension provides an additional view in your project and scans all the resx files. I would recommend it to all projects where you have to translate your interface. Here is how it looks in my project:


It can also assist with some machine translation from Bing and MyMemory:


Another good thing is the Export and Import to and from Excel. Wonderful if you need help from Non-developers.


Copy SharePoint WebDav Address to Clipboard

While configuring SharePoint sites and helping users I often use File Explorer View for editing pages, resources like css and javascript. In IE there is a dedicated button in the ribbon for that. Sometimes it works, sometimes it doesn’t, because of permissions or other restrictions. Anyway, I use Firefox and Chrome while troubleshooting and developing, so I have created a bookmarklet for copying the webdav address of a site that is open in the browser.

var uri = _spPageContextInfo.webAbsoluteUrl.replace(/https?:\/\//i, "\\\\").replace(/\//g, "\\");
window.prompt("Copy to clipboard: Ctrl+C, Enter", uri);

Unfortunately, there is no copy function in javascript, the prompt solution plus Ctrl-C works fine.

The bookmarklet:




S01E01 IoT: Posting Temperature from Raspberry Pi to Azure

Recently I have looked more at IoT, Raspberry Pi in my spare time. In my blog post I want to share my experience in a series of posts. This post is about measuring temperature, humidity and pressure with Raspberry Pi 2 Model B and Sense Hat and posting this data to Azure Table Storage.

I followed this tutorial for connecting to azure with python and these instructions for reading data from Sense Hat.

The python script is on github. Along the way I learned that only python 2.x can be used with azure and table names cannot contain underscore (I got Bad Request error when I tried to create a table with the name “climate_data”). But overall, the process was straightforward. The temperature is not correct, maybe because the sensor is inbetween Raspberry Pi and Sense Hat where it gets warm. But it is just a Proof-of-Concept.

I have used Visual Studio 2015 to see the data in Azure Table Storage. For that I needed to install Azure SDK 2.7. There are many other “explorers” for Azure Storage.


Other resources

Accessing Azure from Linux and Mac

Improvement #1 Corrected Temperature

I found a formula for calculating more correct temperature on the raspberry pi forum.

Ta = 0.0071*Tm*Tm+0.86*Tm-10.0
Tm = measured with the temp+humidity sensor
Ta = ambient temperature

I also added a notifcation when data is sent by showing an “S” on the Sense Hat.

Trying out Visual Studio Code on Ubuntu

I am very curious about the new .NET Core, ASP.NET 5, EF 7 and Visual Studio Code for Linux, Mac and Windows. I have tried it out on an Ubuntu 15.04 machine. The installation and configuration required a few steps, so it is not an usual “Next-next-next”-installation. But, hey, it is just a beta, a preview so far, and first of all: It worked. I am sharing a couple of screenshots and the commands I ran in the terminal, mixed with comments and links:





#install latest node and npm
curl -sL | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g yo
sudo npm install -g generator-aspnet
# download VS Code and make a link
# make a folder
mkdir workspace/tryvs
cd workspace/tryvs
# create "src/global.json" file:
  "sdk": {
    "version": "1.0.0-beta7"
nano src/global.json
# start VS Code 
# create 
# install omnisharp:
curl -sSL | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/
#install dnx
sudo apt-get install -y libunwind8 gettext libssl-dev libcurl3-dev zlib1g libicu-dev
dnvm upgrade -r coreclr
cd EmptyApplication
dnu restore

#install libuv
sudo apt-get install make automake libtool curl
curl -sSL | sudo tar zxfv - -C /usr/local/src
cd /usr/local/src/libuv-1.4.2
sudo sh
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/
sudo ldconfig

#build, I got an error here
dnu build

#start the web server
dnx web

Export Any Web Part using a Bookmarklet

My blog post about exporting any webpart from a SharePoint Page is one of the most read articles on my blog. I use this method a lot. Now what I want to do is to simplify the process. Inspired by my colleague Dan Saedén’s awesome bookmarklet for reading and updating web properties, I decided to make my own bookmarklet. That was easy. Now we can export any web part from any SharePoint page without even looking at any ids in the html markup and assembling the export url manually. Just add the bookmarklet or run  the javascript code in the browser console. The code (js and bookmarklet) is on Github.

Here is an animated gif that explains how to use it:


Add Search Verticals by code


Adding own search verticals is a common task in the Search Configuration in SharePoint. Here I want to share a code sample for achieving this programmatically. I hope, this model can be added to SPMeta2.

First of all, Search Verticals are dedicated Search Results Pages and links to them. How to add them manually is described on technet:

There is no API in CSOM for that. Luckily, Mikael Svenson found how to get the Search Navigation and contributed to PnP by writing an Extension: web.LoadSearchNavigation.

Here is my sample code for adding new Search Verticals programmatically:

NavigationNode searchNav = context.Web.Navigation.GetNodeById(1040);
NavigationNodeCollection nodeCollection = searchNav.Children;
NavigationNodeCreationInformation everything = new NavigationNodeCreationInformation
    Title = "Everyting",
    Url = "/search/Pages/results.aspx",
NavigationNodeCreationInformation myresults = new NavigationNodeCreationInformation
    Title = "My Results",
    Url = "/search/Pages/myresults.aspx",

What is a SharePoint application

SharePoint Artefacts in a meaningful assembly like a lego toy

A meaningful collection of Lego bricks is a toy. A meaningful collection of Lists, Fields, Files and other SharePoint artefacts becomes a SharePoint Application. Private picture.

App, Add-In, List, Web, Site, Sandbox solution, Workflow. There are too many words flying around in SharePoint that confuse users and Non-SharePoint-Developers. I want to introduce a “new” concept that is so simple and that a company can understand and govern: a SharePoint Application.

That is so simple. It can be called a tool, a functionality. That can be a SharePoint list, a document library with a workflow, or a document library with custom jslink. All they can be SharePoint Applications. Let’s use lego as a metaphor. Have you seen this?

SharePoint Artefacts as lego bricks

The same toy car in just brics. SharePoint Artefacts like Webs, Lists, Fields, Content Types, JSLink etc are just lego bricks. Private picture.

These lego bricks together become a cool toy that you can play with (as you can see in the picture above). So it is with SharePoint Applications, too. SharePoint Applications solve actual business needs. A List, or a JSLink by themselves do not solve a business need. It must be a meaningful collection of SharePoint Artefacts that becomes a SharePoint Application.


Does the lego metaphor make sense to you? To go back to SharePoint, I’ll give you an example of a SharePoint Application. I would say everybody has done such Applications. In a project we created a document library for product icons that were used for all products in a company. Easy? Yes. But the icons had several states (active, inactive…). Versioning and Approval was required. A workflow for new requests and submits was implemented, too, permissions for different roles, metadata navigation in the document library and so on. Sure, SharePoint provided us with great “lego bricks”. But we created a tool, a functionality – a SharePoint Application, that makes sense to our business.

What’s new then? Well, we all have done such applications. The new is to understand SharePoint Applications as an own alternative and quality assurance. See more below.

Another example is an “App” for SharePoint Online that I converted into a SharePoint Application by adjusting it for SPO and OnPrem. That’s when I came up with the idea of the SharePoint Application.


A SharePoint Application is a meaningful collection of SharePoint Artefacts, like Webs, Lists, Fields, Views etc that becomes an entity and solves a business need. SharePoint Applications follow best practices and quality policies as all other applications.

To understand more, let’s compare with the related concepts:

SharePoint Application vs SPList

An SPList (an “app”) is often only a part of an entity. Users often create two or more lists, update views and so on. A SharePoint Application contains a list and everything else ready for satisfying business needs.

SharePoint Application vs. SharePoint Hosted App (Add-In)

An SP Hosted App resides in a different domain, it is a subsite that is only trusted to do some predefined actions. An SP Hosted App allows separation of trust, it can be uninstalled easily and it is always a separate site (Web). A SharePoint Application is more flexible (it might be a list in the same site). It is closer to the actual site where users need this functionality. A SharePoint Application is in the same domain name and has the full user trust. A SharePoint Application does not require App Infrastructure and separate domains. It is searchable and can benefit from BlobCache (Style Library) to ensure good web performance.

SharePoint Application vs. Provider Hosted App (Add-In)

SharePoint Application uses SharePoint Templates, Information Architecture, Search, Identity Management etc. A Provider Hosted App is a dedicated web application outside SharePoint. A Provider Hosted Application is powerful because it is not bound to SharePoint. All advantages and disadvantages are the same as the ones for a custom ASP.NET application. A Provider Hosted App has a connection to SharePoint, it requires a Trust and App Infrastructure in your environment. A SharePoint Application is not that powerful, but as long your business need can be solved by SharePoint lists, Page Layouts, Workflows, then a SharePoint Application is the right choice for you.

Quality and Governance

To ensure quality, every SharePoint application should comply with policies and fit into the overall Govenance model. Treat them as they were other Applications. They must have system documentation, application lifecycle management including versions, upgrades and rollbacks. They must be staged and tested before going to production. Another example of a quality policy is that a SharePoint Application is provisioned, maintained and operated using only Client Side Object Model – no farm solutions. All SharePoint Applications are tracked in a system for a better supportability.

Provisioning Framework for SharePoint Applications

I would strongly recommend using a framework for provisioning your SharePoint applications. My favourite is SPMeta2. There is also PnP which is a strong community. It might be okay with manual setups (click-click in SP) for smaller applications. My advice, though: Require code based, repeatable, code-documented and tested provisioning of SharePoint Applications even for smaller ones.


SharePoint Applications have been around for a long time. My goal is to give them a name so we don’t need to be confused by apps, add-ins, lists. A SharePoint Application is not a technical term, it is just a meaningful solution for a business need, done in SharePoint that leverages high quality by following policies and standards within a company.

Http to Https Redirect in Provider Hosted Apps

It is strongly recommended to use https in SharePoint Provider Hosted Apps. In many provider hosted apps I have seen, only https works. I would recommend to configure a simple http to https redirect in IIS and make solutions better. Many Provider Hosted Apps can be done in that way that they are available without SharePoint Context, e.g. for browsing information. In that case that is important to have an easy url and an automatic http -> https redirect.

In this post I’ll give a short manual for doing that. I would recommend this step for all provider hosted apps.

1. In the Provider Hosted Apps Server install the URL Rewrite IIS Module using Web Platform Installer:


2. Next step is to add the http binding to your solution (this is needed for the future redirect):


Then you can configure the automatic http to https redirect using the GUI or the web.config update. My instructions originally come from blog.

I suggest updating the web.config file directly in the Provider Hosted App:


3. Add this section to the web.config file:


    <rule name="Redirect to HTTPS" stopProcessing="true">
     <match url="(.*)" />
       <add input="{HTTPS}" pattern="^OFF$" />
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />

It is important to know that his web.config section will cause failure on the server if URL Rewrite module is not installed.


These steps are very easy to accomplish and I recommend it for every Provider Hosted App, especially those ones that are accessible without going through SharePoint (Web Content -> Apps). This also reflects the configurations in Azure Apps (WebSites).

Kom igång med SPMeta2

SPMeta2 (eller bara M2) är ett relativt nytt ramverk för provisionering av SharePoint-artefakter. Bakom ramverket ligger ett gediget arbete. I den här posten vill jag skriva upp mina steg för att sätta upp ett litet projekt. För mig är SPMeta2 nytt och huvudprincipen i den här bloggposten att få en fungerande lösning så snabbt som möjligt. Informationen här kan snabbt bli inaktuell, eftersom SPMeta2 förändras och förbättras väldigt snabbt.

Vad är SPMeta2
SPMeta är ett ramverk för att provisionera SharePoint-artefakter, allt från fält, innehållstyper, listor, dokumentbibliotek, user custom actions, ladda upp filer med mera. Klassiskt har vi gjort provisionering med hjälp av XML-baserade moduler och features. SPMeta2 erbjuder ett Fluent API som är kodbaserat. Med hjälp av SPMeta2 definierar man en modell (enkla objekt POCOs) som inte har beroendet till SharePoint. Modellen används sedan av Provision-delen som anropar modellen för specifika versioner: SharePoint 2013, SharePoint 2010, Office 365 med mera. Man kan välja CSOM och SSOM. Provision är också flexibel vad som gäller paketering: det kan vara en konsolapplikation, en SharePoint-app, ett wsp-paket, en PowerShell-modul. Se följande länkar:


För att testa behöver vi en site. Jag använder min http://dev/sites/004 som jag skapat just för det här. Av någon anledning gick det inte att använda Visual Studio 2015. Så jag har min Visual Studio 2013 på en virtuell maskin med SharePoint.


Provisionera jQuery och ett enkelt skript till min site collection.


Installera Visual Studio Template


Det här kommer leda till github. Ladda ner den därifrån:


Godkänn och Installera


Skapa ett nytt projekt. Solution ska vara Takana. Projektet ska vara Takana.Model


Välj “Pocos only” och Takana som prefix och gruppnamn (i mitt litet labb kommer de här inte användas, men det går så snabbt att ställa in dem här):


Man får en bra struktur över modellen, allt prefixat och enligt best practices.


Jag kommer att använda de här modellerna sedan:


Nästa steg är att skapa Provision-delen. Skapa ett nytt projekt i samma VS Solution. Kalla det Takana.Provision:


Välj SharePoint Standard och SP2013 CSOM


Efter det har vi en VS Solution med två projekt: Takana.Model och Takana.Provision. I Takana.Provision finns CSOMProgram.cs som startar provisioneringen:


För att börja med, behöver man sätta Takana.Provision som Startup Project (blir fetstilt)


Efter det måste ett tillfälligt problem lösas – referensen 16-foldern. Det här ett känt problem och kommer förmodligen lösas inom kort.


Den snabbaste vägen till att ersätta referensen är att installera ett nuget-paket som heter SharePoint Online Client Side Object Model. Även om det är för SharePoint Online, funkar det alldeles utmärkt för OnPrem också.


Efter det lägg till Takana.Model som referens


Byt ut siteUrl, siteModel och rotWebModel:


Det går fort att köra den här konsolapplikationen. Nu när jag går in på min site, ser jag att jQuery har provisionerats och ett litet skript också som skriver till konsolen.



Det här en liten manual för hur man lätt kan komma igång och prova SPMeta2. SPMeta2 är ett kraftfullt ramverk som kan användas för provisionering och uppdatering av SharePoint-applikationer. Det kan finnas en tröskel i att börja använda det. Jag hoppas att med den här bloggposten jag kan göra fler nyfikna på att prova SPMeta2 och kodbaserad provisionering för att det är ett framtidssäkert sätt att arbeta med SharePoint.

Discovering SharePoint

And having fun doing it

Bram de Jager's SharePoint blog

My view and thoughts on SharePoint.

My programming life

and everything in between

SharePoint Development Lab by @avishnyakov

It is a good place to share some SharePoint stories and development practices.

SharePoint Dragons

Nikander & Margriet on SharePoint

Mai Omar Desouki - Avid SharePointer

Egyptian & Vodafoner - Senior SharePoint Consultant

Cameron Dwyer | SharePoint, Outlook, OnePlaceMail

OnePlaceMail, SharePoint, Outlook & Life's Other Little Wonders


Me and My doings!

Share SharePoint Points!!

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén


SharePoint for everyone

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode, ya mama

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint


Mostly what I know about SharePoint - CommunicoCuspis


Get every new post delivered to your Inbox.

Join 298 other followers