Monthly Archives: November 2015

Running high trust apps / plugins with Sharepoint Foundation 2013

The User Profile service is not available on Sharepoint Foundation and therefore high trust apps are not supported.   However I found that after installing a high trust app it worked until restarting IIS, and after that it would generate authentication errors.  Re-uploading the app package to the app site fixed the authentication errors and allowed the app to run properly again.

I could not find an API to automate this re-upload process, so instead it can be done using a headless browser.

Here’s an example in casperjs (note that on Windows casperjs must be installed in a path without spaces):

[sourcecode language=’js’]

var url = ‘’
var file = ‘’
var user = ‘username’
var pass = ‘password’

var casper = require(‘casper’).create();

casper.setHttpAuth(user, pass);

casper.thenOpen(url, function() {
this.waitForSelector(‘#idHomePageNewDocument-WPQ2’, function() {
this.echo(“Found selector”);

casper.thenClick(‘#idHomePageNewDocument-WPQ2’, function() {
this.echo(“Clicked button”);
this.waitForSelector(‘.ms-dlgFrameContainer > iframe’, function() {
this.echo(“Got the iframe”);

casper.withFrame(1, function() {
this.waitForSelector(‘#aspnetForm’, function() {
this.echo(“Found form”);
this.fill(‘#aspnetForm’, {
‘ctl00$PlaceHolderMain$ctl01$ctl04$InputFile’: file,
}, false);
this.wait(3000, function() {‘#ctl00PlaceHolderMainctl00RptControlsbtnOK’);
this.echo(“Clicked button”);