Sharepoint 2013 provider hosted app with claim base authentication

  • We have Sharepoint 2013 single server farm – Server 1
  • another one server with ADFS 2.0 – Server 2
  • MVC webapplication (hosted in iis) – Server 3 – Remote Computer

We are using Sharepoint 2013 Provider hosted app.

Provider Hosted App is getting installed successfully with Windows Authentication on SharePoint 2013 site. This is working fine.

Case 2:

We have configured ADFS 2.0 for authenticating users.
ADFS 2.0 is successfully installed and configured. Users are getting authenticated. After configure claim base authentication we are also able to login with adfs user into our sharepoint site and authenticate users.

However, Issue is

  • Now whenever we deploy our provider hosted app with this SharePoint site from visual studio 2012 it will give an error.

Error occurred in deployment step ‘Install app for SharePoint’: The System Account cannot perform this action.>

  • another way we have added app package file into our app catalog then try to add an app from app catalog it is ask for trust and then can not able to redirect our provider hosted app
    Sharepont Log file Error

Application error when access /_layouts/15/appInv.aspx, Error=This App is not installed on this site. at Microsoft.SharePoint.Lifecycle.SprocWrappers.GetAppInstanceById(SqlSession dbSessionWrapper, Guid siteId, Guid webId, Guid instanceId, Int32 lcid) at Microsoft.SharePoint.Administration.SPAppCatalog.GetAppInstance(SPWeb web, Guid appInstanceId) at Microsoft.SharePoint.ApplicationPages.AppInvPage.SetControlStateUsingAppInstanceId(String appInstanceId) at Microsoft.SharePoint.ApplicationPages.AppInvPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Thanks in advance.

Change content type order via Javascript/ECMAscript

In my SharePoint-hosted app, I use javascript to apply a content type called “Order” to a list in my app.

When users click “new item” to upload a document, I want that document to derive from my new content type.

Is it possible to programmatically change the content type order to make this “Order” content type the default one? This can of course be done in the GUI, but I need to do it via script.

SharePoint Apps Getting the GUID of App-Provisioned List using JavaScript and CSOM

I’m a Sharepoint App beginner. I have a SharePoint 2013 App that provisions List. How can I get the GUID of those list using CSOM and JavaScript?

Here’s what I got so far:

    var lists;

    function getLists()
        var context = SP.ClientContext.get_current();
        var web = context.get_web();
        context.load(web, "Title", "Description");
        lists = web.get_lists();
        context.load(lists, "Include(Id, Title, Hidden, ItemCount)");
        context.executeQueryAsync(onSuccess, onFail);

    function onSuccess() {
        var ul = $("#listsList");
        var listsEnum = lists.getEnumerator();
        while (listsEnum.moveNext())
            var list = listsEnum.get_current();
            if (list.get_hidden() == false )
                var title = list.get_title();
                var elem = $("<li>" + title + " with GUID " +  + "</li>");
                ul.append(elem); // append the details to a list

    function onFail() {
        alert("Request failed");

The is always undefined. How do I access the GUID property, or am I doing something else wrong?


How do I add a digital signature to an Infopath form in Sharepoint 2013

How to add a digital signature to Infopath form. You need to have a Infopath filler but that is not what resides in SharePoint. Is there a way to add a digital signature line?

How far can I go with SharePoint 2013 Apps?

I am really new to SharePoint 2013 and only worked for a brief period of time in SharePoint 2007 about 5 years ago (so i do not remember much).

I have to plan now an extranet and it will probably be based on SharePoint 2013.

I already read a lot of information about the new Cloud App Model but i cannot figure out how far can I go with Apps.

I understand that apps cannot access Server-Side Object Model. But what does this means in pratical terms?

For example, Our extranet will have a couple of custom sections on a menu accessed and viewed by different types of users. And there is a power user that determines wich persons on his Institution can view which sections.

This is fairly complex as you can see. Can i make an App for this case? or am i accessing user lists that cannot be accessed and this should be a farm solution?

SharePoint Server Throws exception when doing a long operation

I have a SharePoint application with SP server 2010 installed, everything is working well, but there is a special method which is performed in 12 – 14 minutes. What’s done in this method is that i’m requesting a web service to fetch all data (big amount). So what i did is a Thread.sleep(5000), every 5 seconds i check for response.

The problem, is after exactly 10 minutes, i have exception thrown

Category : Error
Level    : Unexpected
Message  : - Message : message additionnel : Configuration problem to access Si
       mulWebservice exception : Thread was being aborted. - Stack Trace : 
         at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout
       )     at Tegaz.Simul.Web.SPSSiLog.Services.SimulServiceRequest.GetBa
       lancing(Int32 simuId, Int32 userId)

 Category : Error
Level    : Unexpected
Message  : - Message : message additionnel : Error during run balancing button 
           click exception : Thread was being aborted. - Stack Trace :   at Services.SimulServiceRequest.GetBalancing(Int32 simuId, Int32 userId)     at Services.SimulServiceRequest.GetAndOptimBalancing(BalancingFetchingParam fetchingParam, Int32 userId)    at WebParts.Simul
           k(Object sender, EventArgs e)

At first, i was thinking that it was a problem linked to the web.config or app.config timeout value (but this value is set at 59 minutes).
Then i thought that may be it comes from idle Timeout in the web site app pool, but the Value was set correctly (at 0).
Right now, i have absolutely no idea, what is the reason of this problem. This is very weird, because i’m barely sure that is a configuration problem linked to the IIS server.

Your suggestions are welcome.
Best regards.

Error while deleting keys from SPWebConfigModification

I got following error when I tried to remove item from the WebConfigModification.

Exception calling “Remove” with “1″ argument(s): “Object reference not
set to a n instance of an object.”

I need to remove all the entries from webConfigModification where owner is PowerShell.

$webApp = Get-SPWebApplication ""

**This returns:**

Name                        : add[@key="RedirectToHelloPage"]
Path                        : configuration/appSettings
Sequence                    : 0
Owner                       : PowerShell
Value                       : <add key="RedirectToHelloPage" value="Hello.aspx" />
Type                        : EnsureChildNode
UpgradedPersistedProperties : {}

Name                        : add[@key="IsString"]
Path                        : configuration/appSettings
Sequence                    : 0
Owner                       : PowerShell
Value                       : <add key="IsString" value="false" />
Type                        : EnsureChildNode
UpgradedPersistedProperties : {}

Name                        : add[@key="IsString"]
Path                        : configuration/appSettings
Sequence                    : 0
Owner                       : PowerShell112
Value                       : <add key="IsString" value="false" >
Type                        : EnsureChildNode
UpgradedPersistedProperties : {}

And I want to Remove all entries with Owner = PowerShell

$config = $webApp.WebConfigModifications | Where-Object {$_.Owner -eq "PowerShell"}

$config contains:

PS C:> write-host $config

But I always get above mentioned error:
Can somebody help?

Custom Site Creation with CSOM

I have the need to customize the site creation process in SharePoint Online. Is this possible via an app using JavaScript CSOM? If so can anyone point me in the right direction.

Prefered way of custom styling for 2013 apps?

I created some autohosted apps ( for Office 365) and by default there’s a script setStyleSheet(); that makes the app look like the rest of the page. This is something I want but I would also like to override a few things, for example I want the same border color around text boxes as on the rest of the page but instead of the white button make it blue (among other things).

I don’t want to remove the call to setStyleSheet() because then I would have to style every single element of the app, I can’t add a reference to a custom stylesheet in the masterpage because the app is in an iframe. I prefer to not have a bit of <style></style> elements in each app.

What’s considered the best way to do this?

Thanks in advance.


Like I mentioned the app is loaded in an iframe so whatever stylesheet reference I add to the masterpage won’t get picked up.

By default the app is blended in with the rest of the page look and feel with this script

<script type="text/javascript">
    // Set the style of the client web part page to be consistent with the host web.
    function setStyleSheet() {
        var hostUrl = ""
        if (document.URL.indexOf("?") != -1) {
            var params = document.URL.split("?")[1].split("&");
            for (var i = 0; i < params.length; i++) {
                p = decodeURIComponent(params[i]);
                if (/^SPHostUrl=/i.test(p)) {
                    hostUrl = p.split("=")[1];
                    document.write("<link rel="stylesheet" href="" + hostUrl + "/_layouts/15/defaultcss.ashx" />");
        if (hostUrl == "") {
            document.write("<link rel="stylesheet" href="/_layouts/15/1033/styles/themable/corev15.css" />");

Sure I can load another stylesheet there but I wanted to check if this is the intention or if there are any other (new) smarts around branding in SP2013 for this case?

Pass Item ID to webpart

We are creating a ClientWebPart that we want to be present on the Default Display Form for items on a custom list view that’s part of our application.

I can’t work out how to pass the Id of the selected ListItem to the WebPart so that it can adjust it’s behaviour. I’m assuming it can be passed with the URL to the WebPart.

I’ve considered using properties on the WebPart but they seem to be hard coded when the WebPart is placed on the form.

The built in controls seem to allow this. We can display a list of related ListItems to this ListItem. That seems to use something called “Connections” which I’ve been unable to re-create.

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam