Provider hosted app - Site Provisioning activities

Hi ,
I am creating a Provider hosted app which does site provisioning activities like create site , create site columns, content types etc. I have almost 50 or more fields to be added. I am using the Provider hosted app - Process Event, and used SPRemoteEventType
- App Installed.
When the app is installed the above functionalities are done, as I need to code to do these activities synchronously.
I am facing an issue in App Installed event that,during the code execution (consider the field creation method), since it takes some time to add all the fields, after some time limit,  the runtime comes to the start point of code execution , which is
creation of token helper, and the methods already executed is also called again.
I have executed the code in Release mode, the logs show the above behavior.
I am not sure how I am getting this weird behavoir.
Please advise.

msdn (Handling events in apps for SharePoint):
Your implementation of the App Installed event must complete and return an SPRemoteEventResult object
within 30 seconds or the SharePoint installation infrastructure will think it has failed. The infrastructure will rerun the event, and repeat your code from the beginning, up to four times. After four timeouts,
SharePoint will roll back the entire app installation. We recommend the following practices:
If there is any code in your handler that should not be repeated after a timeout, put it in a conditional block that tests to see if it has already run. You must test the actual installed component. Simply setting
a variable to true when a block of code completes does not work as a test because all variables are reinitialized when the event times out and restarts.
Move installation code that takes more than 30 seconds into the app itself. You can add it to "first run" logic that executes the first time the app is launched. Alternatively, the app can prompt the
user to run the installation code.
If the preceding bullet item is not feasible for your app, another option is to have your event handler start a remote asynchronous process and then immediately return a SPRemoteEventResultobject.
A weakness of this strategy is that if the remote process fails, it has no way to tell SharePoint to roll back the app installation.
[custom.development]

Similar Messages

  • Provider hosted app error message: The remote server returned an error: (429) Too Many Requests.

    Hi,
    I have a customer running a provider hosted app and in Sharepoint 2013. Things have been working fine but recently they keep experiencing an issue where the all the app parts on the page show the following error message. Does anyone have an idea what
    could be causing this problem and how I can fix it? The Sharepoint site and provider hosted app site are running on a Server 2008 R2 box with IIS 7.5.
    Server Error in '/Test.Sharepoint.App' Application.
    The remote server returned an error: (429) Too Many Requests.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.           
    Exception Details: System.Net.WebException: The remote server returned an error: (429) Too Many Requests.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [WebException: The remote server returned an error: (429) Too Many Requests.]
    System.Net.HttpWebRequest.GetResponse() +8527180
    Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() +58
    Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) +975
    Test.Sharepoint.AppWeb.Pages.LatestAnnouncement.GetLatestAnnouncement(Boolean showFullText) +610
    Test.Sharepoint.AppWeb.Pages.LatestAnnouncement.Page_Load(Object sender, EventArgs e) +764
    System.Web.UI.Control.LoadRecursive() +71
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
    Impreza Software Development

    Hi GuYumming,
    I have checked the Sharepoint site using Fiddler and my X-SharePointHealthScore stays consistently on 1, I have even refreshed the site and had the "(429) Too Many Requests" error happen right in front of me whilst Fiddler is running and when I look at the
    200 response for the Sharepoint site it is still showing "X-SharePointHealthScore: 1".
    I assume because of this I do not need to make any of the changes suggested in your article above?
    I have also been through the ULS logs and found the following 3 log entries that appear to relate to the issue but they do not really mean much to me so I am hoping that you can help:
    Begin CSOM Request ManagedThreadId=59, NativeThreadId=12476
    SPResourceTally(ClientServiceRequestDuration) value 1 + 150425 > 150000
    ResourceBudgetExceeded, sending throttled status code. Exception=Microsoft.SharePoint.SPResourceBudgetExceededException: ResourceBudgetExceeded     at Microsoft.SharePoint.SPResourceTally.Check(Int32 value)    
    at Microsoft.SharePoint.SPAggregateResourceTally.Check(SPResourceKind kind, Int32 value)     at Microsoft.SharePoint.Client.SPClientServiceHost.OnBeginRequest()
    Impreza Software Development

  • HTTPS SharePoint site with HTTPS Provider hosted app - The remote certificate is invalid according to the validation procedure

    We have SharePoint 2013 site configured with SSL and we have developed a provider hosted app which interacts with SharePoint list.
    If we try accessing the Provider hosted app from the SharePoint site with HTTP [http://mysharepointsite.com/] there are no any errors thrown.
    But whenever the same Provider hosted app is tried accessing from the same SharePoint site using https address
    [https://mysharepointsite.com/] we are getting below error:
    The remote certificate is invalid according to the validation procedure.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [AuthenticationException: The remote certificate is invalid according to the validation procedure.]
    System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception) +2983172
    System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +473
    System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) +86
    System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +262
    System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +473
    System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) +86
    System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +262
    System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +473
    System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) +86
    System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +262
    System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +473
    System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) +8530566
    System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) +230
    System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +645
    System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +9
    System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) +87
    System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) +1467
    System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) +84
    System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) +22
    System.Net.ConnectStream.WriteHeaders(Boolean async) +761
    [WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.]
    System.Net.HttpWebRequest.GetResponse() +8534156
    Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() +58
    Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) +975
    ProviderHostedHTTPSWeb.Default.Page_Load(Object sender, EventArgs e) +348
    System.Web.UI.Control.LoadRecursive() +71
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
    We have already added the certificate used for the SharePoint site and the provider hosted app in the SharePoint central admin trusts.
    Any idea's how can I resolve this issue?

    Hi,
    According to your post, my understanding is that you failed to access provider host app using https.
    The reason for this is that SharePoint implements its own certificate validation policy to override .NET certificate validation.
    Fix is to setup a trust between SharePoint and the server requiring certificate validation.
    For more information, you can refer to:
    http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/06/13/could-not-establish-trust-relationship-for-ssl-tls-secure-channel.aspx
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • SharePoint remote provider hosted apps - confusion around key questions

    For some time, I have been trying to get a provider hosted app setup to work, and I am afraid that I - as a relative novice - must have missed some key points despite hours of googling and reading. Here's my questions:
    A remote, provider hosted app, would have its AppWeb in a domain that is different from the host SharePoint Farm in which it is gets installed and used. In other words, the AppWeb may be located at remote.contoso-apps.com, where as the SharePoint farm uses
    for instance spslocal.mycorp.com. However, when you - in the SharePoint host farm - set up your App Domain/App isolation - you can only provide one value - which in this case would then need to be remote.contoso-apps.com??? Does that mean that each SharePoint
    Farm can only contain Apps from one vendor delivering remote apps? Or is the key in hard coding the app web in the manifest? (However, even if I've tried this it seems like the token SPAppWebUrl still translates into the pattern defined in the App Isolation
    Settings in the host farm???).
    Back to the AppWeb: Many bloggers have mentioned that you have to add some kind of SharePoint element to your App project (not the Web Project part) to get the AppWeb provisioned from Visual Studio 2013. But at what stage are these SharePoint elements actually
    provisioned - during some kind of publish operation of the Web Project part (the Pages, Scripts etc.) or when you install the app package (hardly the latter, since the first installation may be when a customer installs the app???). The reason I ask is (of
    course) that my SharePoint Elements do not seem to get provisioned. And just to test my very basic understanding: the AppWeb can be any pure IIS web site from the start - i.e., not a SharePoint Web App?
    Thanks for any help on these challenging issues!

    Paul,
    thanks for your effort, but unfortunately the answers do not get me much further.
    Question 1: You write "You can only use one domain, because cross-domain IFrame requests are blocked in SharePoint 2013". This is contrary to numerous other articles that explain how the SharePoint cross-domain library (SP.RequestExecutor.js) can be
    used to communicate across domains. From the outset, the whole idea about an AppWeb is - according to Microsoft documentation - that the AppWeb should be isolated from the HostWeb and therefore in a separate domain. 
    This article,
    http://msdn.microsoft.com/en-us/library/office/jj612823(v=office.15).aspx, even talks about scenarios where the SharePoint Host Web and App Web are in different security zones!
    So according to a load of other documentation it is indeeed a valid scenario I am addressing, but I still miss the key answers to the questions above. I suspect that the key is to hardcode certain URIs in your app that points to the cloud AppWeb
    (so the single App Domain specified in the Host Farm is not used at all), but I have failed to find the necessary documentation on this.
    Question 2: The article mentioned does not talk about the issues that I have asked about, specifically when the SharePoint elements in the App are created.
    Anyone with experience in this area? Thanks!

  • Retrieve data from a list in SharePoint 2013 provider hosted App using CSOM

    I have developed a provider hosted app in SharePoint 2013. As you already know, Visual Studio creates web application and SharePoint app. The web application gets hosted inside IIS and the SharePoint App in SharePoint site collection. I'm trying to get
    data from a list hosted in SharePoint using CSOM. But I get ran insecure content error. 
    here is my code in Default.aspx
        <script type="text/javascript" src="../Scripts/jquery-1.8.2.js"></script>
        <script type="text/javascript" src="../Scripts/MicrosoftAjax.js"></script>
        <script type="text/javascript" src="../Scripts/SP.Core.js"></script>
        <script type="text/javascript" src="../Scripts/INIT.JS"></script>
        <script type="text/javascript" src="../Scripts/SP.Runtime.js"></script>
        <script type="text/javascript" src="../Scripts/SP.js"></script>
        <script type="text/javascript" src="../Scripts/SP.RequestExecutor.js"></script>
        <script type="text/javascript" src="../Scripts/App.js"></script>
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
            <title></title>
        </head>
        <body>
            <form id="form1" runat="server">
            <div>
                <input id="Button1" type="button" value="Get title via CSOM" onclick="execCSOMTitleRequest()" /> <br />
                <input id="Button2" type="button" value="Get Lists via CSOM" onclick="execCSOMListRequest()" />
            </div>
                <p ID="lblResultTitle"></p><br />
                <p ID="lblResultLists"></p>
            </form>
        </body>
        </html>
    and App.js is:
        var hostwebUrl;
        var appwebUrl;
        // Load the required SharePoint libraries
        $(document).ready(function () {
            //Get the URI decoded URLs.
            hostwebUrl =
                decodeURIComponent(
                    getQueryStringParameter("SPHostUrl")
            appwebUrl =
                decodeURIComponent(
                    getQueryStringParameter("SPAppWebUrl")
            // resources are in URLs in the form:
            // web_url/_layouts/15/resource
            var scriptbase = hostwebUrl + "/_layouts/15/";
            // Load the js files and continue to the successHandler
            //$.getScript(scriptbase + "/MicrosoftAjax.js",
            //   function () {
            //       $.getScript(scriptbase + "SP.Core.js",
            //           function () {
            //               $.getScript(scriptbase + "INIT.JS",
            //                   function () {
            //                       $.getScript(scriptbase + "SP.Runtime.js",
            //                           function () {
            //                               $.getScript(scriptbase + "SP.js",
            //                                   function () { $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest); }
        function execCrossDomainRequest() {
            alert("scripts loaded");
        function getQueryStringParameter(paramToRetrieve) {
            var params = document.URL.split("?")[1].split("&");
            var strParams = "";
            for (var i = 0; i < params.length; i = i + 1) {
                var singleParam = params[i].split("=");
                if (singleParam[0] == paramToRetrieve)
                    return singleParam[1];
        function execCSOMTitleRequest() {
            var context;
            var factory;
            var appContextSite;
            var collList;
            //Get the client context of the AppWebUrl
            context = new SP.ClientContext(appwebUrl);
            //Get the ProxyWebRequestExecutorFactory
            factory = new SP.ProxyWebRequestExecutorFactory(appwebUrl);
            //Assign the factory to the client context.
            context.set_webRequestExecutorFactory(factory);
            //Get the app context of the Host Web using the client context of the Application.
            appContextSite = new SP.AppContextSite(context, hostwebUrl);
            //Get the Web
            this.web = context.get_web();
            //Load Web.
            context.load(this.web);
            context.executeQueryAsync(
                Function.createDelegate(this, successTitleHandlerCSOM),
                Function.createDelegate(this, errorTitleHandlerCSOM)
            //success Title
            function successTitleHandlerCSOM(data) {
                $('#lblResultTitle').html("<b>Via CSOM the title is:</b> " + this.web.get_title());
            //Error Title
            function errorTitleHandlerCSOM(data, errorCode, errorMessage) {
                $('#lblResultLists').html("Could not complete CSOM call: " + errorMessage);
        function execCSOMListRequest() {
            var context;
            var factory;
            var appContextSite;
            var collList;
            //Get the client context of the AppWebUrl
            context = new SP.ClientContext(appwebUrl);
            //Get the ProxyWebRequestExecutorFactory
            factory = new SP.ProxyWebRequestExecutorFactory(appwebUrl);
            //Assign the factory to the client context.
            context.set_webRequestExecutorFactory(factory);
            //Get the app context of the Host Web using the client context of the Application.
            appContextSite = new SP.AppContextSite(context, hostwebUrl);
            //Get the Web
            this.web = context.get_web();
            // Get the Web lists.
            collList = this.web.get_lists();
            //Load Lists.
            context.load(collList);
            context.executeQueryAsync(
                Function.createDelegate(this, successListHandlerCSOM),
                Function.createDelegate(this, errorListHandlerCSOM)
            //Success Lists
            function successListHandlerCSOM() {
                var listEnumerator = collList.getEnumerator();
                $('#lblResultLists').html("<b>Via CSOM the lists are:</b><br/>");
                while (listEnumerator.moveNext()) {
                    var oList = listEnumerator.get_current();
                    $('#lblResultLists').append(oList.get_title() + " (" + oList.get_itemCount() + ")<br/>");
            //Error Lists
            function errorListHandlerCSOM(data, errorCode, errorMessage) {
                $('#lblResultLists').html("Could not complete CSOM Call: " + errorMessage);
    Any solution is appreciated.

    Hi,
    To retrieve data from list in your provider-hosted app using SharePoint Client Object Model(CSOM), you can follow the links below for a quick start:
    http://msdn.microsoft.com/en-us/library/office/fp142381(v=office.15).aspx
    http://blogs.msdn.com/b/steve_fox/archive/2013/02/22/building-your-first-provider-hosted-app-for-sharepoint-part-2.aspx
    Best regards
    Patrick Liang
    TechNet Community Support

  • SharePoint Provider Hosted App that can update existing SharePoint Task List

    Note: I am unable to take advantage of the Microsoft.SharePoint library directly. Adding a reference results in a 32bit/64bit library mismatch error.
    I have to find a solution that uses only the Microsoft.SharePoint.Client extension. 
    I am looking for example code where provider-hosted SharePoint App loads a SharePoint Task List View that allows users to interact with the tasks.
    So far I have only been able to programmatically create and then load the SharePoint tasks list, create and populate a DataTable object and set the datasource of a GridView object to that DataTable.
    I am unable to trigger my method linked to my checkbox within the gridview.
    Ideally I would like to just customize a Task View that already has this functionality.
    Here is my default.aspx.cs code-behind file:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using SP = Microsoft.SharePoint.Client;
    namespace SPAppBasicWeb
    public partial class Default : System.Web.UI.Page
    protected void Page_PreInit(object sender, EventArgs e)
    Uri redirectUrl;
    switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
    case RedirectionStatus.Ok:
    return;
    case RedirectionStatus.ShouldRedirect:
    Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
    break;
    case RedirectionStatus.CanNotRedirect:
    Response.Write("An error occurred while processing your request.");
    Response.End();
    break;
    protected void Page_Load(object sender, EventArgs e)
    // The following code gets the client context and Title property by using TokenHelper.
    // To access other properties, the app may need to request permissions on the host web.
    var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
    using (var clientContext = spContext.CreateUserClientContextForSPHost())
    //clientContext.Load(clientContext.Web, web => web.Title);
    //clientContext.ExecuteQuery();
    //Response.Write(clientContext.Web.Title);
    SP.ClientContext cc = new SP.ClientContext("http://server/sites/devapps");
    SP.Web web = cc.Web;
    SP.List list = web.Lists.GetByTitle("General Tasks");
    SP.CamlQuery caml = new SP.CamlQuery();
    Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(caml);
    cc.Load<Microsoft.SharePoint.Client.List>(list);
    cc.Load<Microsoft.SharePoint.Client.ListItemCollection>(items);
    //try
    //const int ColWidth = 40;
    cc.ExecuteQuery();
    DataTable dt = new DataTable();
    dt.Columns.Add("Task Name", typeof(string));
    dt.Columns.Add("ID", typeof(int));
    foreach (Microsoft.SharePoint.Client.ListItem liTask in items)
    DataRow dr = dt.NewRow();
    dr["Task Name"] = liTask["Title"];
    dr["ID"] = liTask["ID"];
    //dr["chkTask"] = liTask["Checkmark"];
    dt.Rows.Add(dr);
    GridView1.DataSource = dt;
    GridView1.DataBind();
    protected void chkTask_CheckedChanged(object sender, EventArgs e)
    //add code here to update Task Item by ID
    Response.Write("checkbox event triggered");
    Here is my simple default.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SPAppBasicWeb.Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:GridView ID="GridView1" runat="server">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <asp:CheckBox ID="chkTask" runat="server" OnCheckedChanged="chkTask_CheckedChanged" AutoPostBack="true" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    </div>
    </form>
    </body>
    </html>
    http://www.net4geeks.com Who said I was a geek?

    Hi,
    Please try to modify your code as below:
    using (var clientContext = spContext.CreateUserClientContextForSPHost())
    SP.Web web = clientContext.Web;
    SP.List list = web.Lists.GetByTitle("General Tasks");
    SP.CamlQuery caml = new SP.CamlQuery();
    Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(caml);
    clientContext.Load(items);
    clientContext.ExecuteQuery();
    If the code still not works, I suggest you debug the code or following the blog below to create a Provider-Hosted App for SharePoint and read list items from SharePoint list.
    http://blogs.msdn.com/b/steve_fox/archive/2013/02/22/building-your-first-provider-hosted-app-for-sharepoint-part-2.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Provider-hosted Apps debug error: The remote server returned an error: (401) unauthorised

    Hi,
    Any help appreciated!!
    I'm getting this error: "The remote server returned an error: (401) unauthorised when I debug a provider-hosted app.  I get the error on this line:  
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    See code below
    I created a high trust development environment following the instructions provided here:
    http://msdn.microsoft.com/en-us/library/office/fp179901(v=office.15).aspx and
    http://msdn.microsoft.com/library/office/fp179923
    I created a provider-hosted app with the intent to:
    create a SharePoint list in the appweb
    Use self-signed certificate, tokenhepler.cs and sharepointcontext.cs to retrieve current user context and access on SharePoint.  (No changes were made to tokenhelper.cs and sharepointcontext.cs)
    retrieve list items from the SharePoint list in a button click event handler on a default.aspx of the remote web
    What happens:
    The app is deployed successfully to the Dev site
    The SharePoint feature is deployed and activated
    The default.aspx page of the remote web loads
    The error (see image) is returned on clicking of the button
    My environment is an on-premise SharePoint 2013 with AD and my dev box is standalone windows 8.1 running Visual Studio Professional 2013 Update 3.
    The code block below is a copy of the default.aspx code-behind
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.SharePoint.Client;
    using Microsoft.IdentityModel.S2S.Tokens;
    using System.Net;
    using System.IO;
    using System.Xml;
    using System.Data;
    using System.Xml.Linq;
    using System.Xml.XPath;
    namespace Idea.GeneratorWeb
    public partial class Default : System.Web.UI.Page
    SharePointContextToken contextToken;
    string accessToken;
    Uri sharepointUrl;
    protected void Page_PreInit(object sender, EventArgs e)
    Uri redirectUrl;
    switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
    case RedirectionStatus.Ok:
    return;
    case RedirectionStatus.ShouldRedirect:
    Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
    break;
    case RedirectionStatus.CanNotRedirect:
    Response.Write("An error occurred while processing your request.");
    Response.End();
    break;
    protected void Page_Load(object sender, EventArgs e)
    //// The following code gets the client context and Title property by using TokenHelper.
    //// To access other properties, the app may need to request permissions on the host web.
    var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
    //var spContext = new ClientContext("MySPDevInstance");
    //spContext.Credentials = new NetworkCredential("username", "password");
    //using (var clientContext = spContext.CreateUserClientContextForSPHost())
    // clientContext.Load(clientContext.Web, web => web.Title);
    // clientContext.ExecuteQuery();
    // Response.Write(clientContext.Web.Title);
    string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
    if (contextTokenString != null)
    // Get context token
    contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);
    // Get access token
    sharepointUrl = new Uri(Request.QueryString["SPAppWebUrl"]);
    accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;
    // Pass the access token to the button event handler.
    Button1.CommandArgument = accessToken;
    protected void Button1_Click(object sender, EventArgs e)
    // Retrieve the access token that the Page_Load method stored
    // in the button's command argument.
    string accessToken = ((Button)sender).CommandArgument;
    if (IsPostBack)
    sharepointUrl = new Uri(Request.QueryString["SPAppWebUrl"]);
    // REST/OData URL section
    string oDataUrl = "/_api/Web/lists/getbytitle('Diagrams In Idea Generator')/items?$select=Title,Diagram,SharingStatus";
    // HTTP Request and Response construction section
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + oDataUrl);
    request.Method = "GET";
    request.Accept = "application/atom+xml";
    request.ContentType = "application/atom+xml;type=entry";
    request.Headers.Add("Authorization", "Bearer " + accessToken);
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    // Response markup parsing section
    XDocument oDataXML = XDocument.Load(response.GetResponseStream(), LoadOptions.None);
    XNamespace atom = "http://www.w3.org/2005/Atom";
    XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
    XNamespace m = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
    List<XElement> entries = oDataXML.Descendants(atom + "entry")
    .Elements(atom + "content")
    .Elements(m + "properties")
    .ToList();
    var entryFieldValues = from entry in entries
    select new
    Character = entry.Element(d + "Title").Value,
    Actor = entry.Element(d + "Diagram").Value,
    CastingStatus = entry.Element(d + "SharingStatus").Value
    GridView1.DataSource = entryFieldValues;
    GridView1.DataBind();
    Any ideas what I might be doing wrong

    Hi ,
    Use the below code
    Public string GetAccessToken(){
    string sharePointSiteUrlHost =  Page.Request["SPHostUrl"].Tostring();
    string AccessToken = tokenHelper.GetS2SAccessTokenWithWindowsIdentity(sharePointSiteUrlHost, Request.LogonUserIdentity);
    return accessToken;
    Than initialize the ClientCOntext with the below Method
     private static ClientContext GetClientContextWithAccessTokenString(string targetUrl, object accessToken)
                ClientContext clientContext = new ClientContext(targetUrl);
                clientContext.AuthenticationMode = ClientAuthenticationMode.Anonymous;
                clientContext.FormDigestHandlingEnabled = false;
                clientContext.ExecutingWebRequest +=
                    delegate(object oSender, WebRequestEventArgs webRequestEventArgs)
                        webRequestEventArgs.WebRequestExecutor.WebRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
                        webRequestEventArgs.WebRequestExecutor.RequestHeaders["Authorization"] =
                            "Bearer " + accessToken;
                return clientContext;
    use this clientCOntext and it will work.
    Do not use
    SharePointContextProvider
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Error with Provider Hosted App on Edit Form of a list item

    We have an error on the Edit Form of one of our pages.
    We have developed a SharePoint Online Provider Hosted app which replaces the standard edit form of a list item and has some further events behind the save button. Since this is rather new territory for us, we're using a roundabout way of achieving this by
    using a script editor web part to display an iFrame of our app. That way we can pass the Url through to our app and retrieve query strings from them.
    Our issue comes quite intermittently in that we sometimes get a "web page cannot be found" error or sometimes a "resource cannot be found" error, however, when we load another app on the site (from the same app project, but using an app
    part), then go back to the Edit Form, the information in the iFrame suddenly renders.
    Any ideas on what might be causing this issue at all? Ideally, we should be rendering the app to the Edit Form is the proper manner, rather than scripting an iFrame that points to out app in Azure. Would this be the cause of the problem?
    Thanks
    Tom

    Hi thumper, if you have access to InfoPath, you can add the form to a page using the InfoPath web part. Otherwise, use SP Designer with instructions below:
    http://sharepoint.stackexchange.com/questions/70287/display-new-form-of-a-list-in-a-web-part-page
    cameron rautmann

  • Redirection error An error occurred while processing your request in provider-hosted app which is hosted in Windows Azure

    Hello,
    I developed one simple provider hosted app and I published it in my Azure website. I also published the SharePoint App of this solution in O365 site. I'm using Visual Studio 2013 Premium edition. I've followed all the steps to do this work e.g.
    generate the client ID and client secret through my O365 site and updated the AppManifest.xml as well as web.config etc. In my AppWeb project, I've TokenHelper.cs and SharePoint.cs classes.
    When I'm clicking the app from my O365 site, I get the following error "An error occurred while processing your request" which is due to the following code:
     protected void Page_PreInit(object sender, EventArgs e)
                Uri redirectUrl;
                switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
                    case RedirectionStatus.Ok:
                        return;
                    case RedirectionStatus.ShouldRedirect:
                        Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
                        break;
                    case RedirectionStatus.CanNotRedirect:
                        Response.Write("An error occurred while processing your request.");
                        Response.End();
                        break;
    It's always executing the case RedirectionStatus.CanNotRedirect. Why?
    I've checked the method "CheckRedirectionStatus" of SharePointContext.cs class completely and I am not understanding why am I getting this error.
    When I browse my Azure website http://sitename.azurewebsites.net, even there I'm getting this error. I believe that error is because there is no query string parameter there e.g. SPHostURL etc.
    Please let me know why I'm having this redirection error.
    Thanks,
    Ashish

    Hi,
    For a better troubleshooting,
    I suggest you do as the following:
    Debug the code step by step to find the reason of the issue.
    For the remote debug your app from Windows Azure, you need to download Azure SDK:
    http://azure.microsoft.com/en-us/downloads/
    After installing the SDK, it will have “Attach Debugger” for Azure web site, you
    also need to set "Attach Debugger" to on in the Windows Azure Management Portal
    More detailed information about how to debug provider-hosted app:
    http://blogs.technet.com/b/speschka/archive/2013/11/25/debugging-sharepoint-apps-that-are-hosted-in-windows-azure-web-sites.aspx
    Best regards,
    ZhengyuGuo
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if
    they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Zhengyu Guo
    TechNet Community Support

  • Error occurred in deployment step 'Install app for SharePoint': Failed to install app for SharePoint. provider-hosted app sharepoint on premise

    Error occurred in deployment step 'Install app for SharePoint, ULS log as below:
    0x0BA8 SharePoint Foundation          App Deployment                 acjjg Medium   The current user has System.Threading.Thread.CurrentPrincipal.Identity.Name
    = 0#.w|perf\abraham.lincoln, System.Security.Principal.WindowsIdentity.GetCurrent().Name = NT AUTHORITY\IUSR, System.Web.HttpContext.Current.User.Identity.Name = 0#.w|perf\abraham.lincoln. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.39  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ag8d6 Medium   SPApp: CreateAppUsingPackageMetadata: isCabStream is false. Treating the stream as a ZIP. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.39  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ahkn9 High     Deleting App with fingerprint TJQrYuD5N+kEe38LZtl6wSs3Ak3yYvWcmwuNLTqtpdFzb4qSMopN3SWCRdWvntrKoM7qIS2S2llpA5omi8iHqQ==
    on site 264dc389-d394-4985-a43c-ad91a383c0df dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.39  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ahkob High     The App with fingerprint TJQrYuD5N+kEe38LZtl6wSs3Ak3yYvWcmwuNLTqtpdFzb4qSMopN3SWCRdWvntrKoM7qIS2S2llpA5omi8iHqQ==
    on site 264dc389-d394-4985-a43c-ad91a383c0df was to be deleted, but it did not exist dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 abnqa Medium   App Packaging: CreatePackage: There are 10 parts in the package.  There are 1 package-part relationships
    in the package. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 afyz6 Medium   SPAppResources: ParseResources: No default resource file was found. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 afyzx Medium   SPAppResources: ParseResources: no resource file relationships were found. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aebgs Medium   SPPackageUtility: ExtractPart: Creating directory 'C:\Users\abraham.lincoln.PERF\AppData\Local\Temp\71345ca6-3565-43d8-9017-2d3336965d8f\extract' dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aebgt Medium   SPPackageUtility: ExtractPart: Creating file 'C:\Users\abraham.lincoln.PERF\AppData\Local\Temp\71345ca6-3565-43d8-9017-2d3336965d8f\extract\AppManifest.xml' dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddw Medium   SPPackageUtility: ExtractPart: Part stream length is '1072'. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddz Medium   SPPackageUtility: ExtractPart: Length is '1072', not locking before copying the stream. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aebgt Medium   SPPackageUtility: ExtractPart: Creating file 'C:\Users\abraham.lincoln.PERF\AppData\Local\Temp\71345ca6-3565-43d8-9017-2d3336965d8f\extract\AppIcon.png' dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddw Medium   SPPackageUtility: ExtractPart: Part stream length is '3540'. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddz Medium   SPPackageUtility: ExtractPart: Length is '3540', not locking before copying the stream. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.41  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aidi7 Medium   SPIconAppPartValidator: IsSupportedFormat: image raw format is 'b96b3caf-0728-11d3-9d7b-0000f81ef32e'. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 afyz6 Medium   SPAppResources: ParseResources: No default resource file was found. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 afyzx Medium   SPAppResources: ParseResources: no resource file relationships were found. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aebgt Medium   SPPackageUtility: ExtractPart: Creating file 'C:\Users\abraham.lincoln.PERF\AppData\Local\Temp\71345ca6-3565-43d8-9017-2d3336965d8f\extract\featurecc1deab7-efdf-4cc2-80ae-60e073577d64.xml' dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddw Medium   SPPackageUtility: ExtractPart: Part stream length is '321'. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddz Medium   SPPackageUtility: ExtractPart: Length is '321', not locking before copying the stream. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aebgt Medium   SPPackageUtility: ExtractPart: Creating file 'C:\Users\abraham.lincoln.PERF\AppData\Local\Temp\71345ca6-3565-43d8-9017-2d3336965d8f\extract\elements4d87f314-4b0a-4b89-8a7e-9cb73c99f25f.xml' dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddw Medium   SPPackageUtility: ExtractPart: Part stream length is '849'. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajddz Medium   SPPackageUtility: ExtractPart: Length is '849', not locking before copying the stream. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aerhy Medium   App Packaging - List of App Parts (count ='2'): Name='SPIconAppPart',Name='SPFeatureAppPart', dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 aerhz Medium   App Packaging - List of Deployment Groups (count ='3'): Name='SPIconDeploymentGroup',Name='SPTargetWebDeploymentGroup',Name='SPQuickLaunchDeploymentGroup', dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.42  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 mq71 Medium   Creating App with fingerprint TJQrYuD5N+kEe38LZtl6wSs3Ak3yYvWcmwuNLTqtpdFzb4qSMopN3SWCRdWvntrKoM7qIS2S2llpA5omi8iHqQ==
    to site 264dc389-d394-4985-a43c-ad91a383c0df. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.44  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 afpd2 Medium   Committing package with fingerprint TJQrYuD5N+kEe38LZtl6wSs3Ak3yYvWcmwuNLTqtpdFzb4qSMopN3SWCRdWvntrKoM7qIS2S2llpA5omi8iHqQ==
    and data length 8010 to site 264dc389-d394-4985-a43c-ad91a383c0df. dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.46  w3wp.exe (0x2170)                        0x0BA8 SharePoint Foundation        
     App Deployment                 ajk9e Medium   Writing 8010 bytes to database for app with fingerprint TJQrYuD5N+kEe38LZtl6wSs3Ak3yYvWcmwuNLTqtpdFzb4qSMopN3SWCRdWvntrKoM7qIS2S2llpA5omi8iHqQ== dcf1d59c-94c5-5071-47bf-07cd3f2ead95
    12/14/2014 23:54:27.50  w3wp.exe (0x2170)

    Hi Jerry,
    I agree with Nikhil, I think you have posted partial ULS log, we could not find effective errors for the issue.
    For Provider Hosted app in SharePoint server on-premise,
    the TokenHelper class will try to access your Azure Security Principle by default.
    Did you have a valid Azure account?
    If not, the issue may be caused that you don't have a valid account, to resolve this issue, you can use
    a valid Azure account or not going to use Azure Platform for hosting the app as the article
    below.
    http://pratapreddypilaka.blogspot.jp/2012/12/sharepoint-2013-avoiding-azure-on-dev.html
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

  • Report Viewer control in sharepoint 2013 provider hosted app

    sharepointSite/_vti_bin/ReportServer
    We are migrating sp 2010 site to SP 2013 provider hosted app. we are using Report viewer control (version 10.0.0) in .net application app server, And the reporting service is configured in sharepoint site and report is uploaded in the document
    library. We are using claims based authentication
    ReportViewer1.ServerReport.ReportServerUrl =
    newUri("sharepointSite/_vti_bin/ReportServer");
    ReportViewer1.ServerReport.ReportPath = @"sharepointSite/_vti_bin/ReportServer?sharepointSite/Reports/Report1.rdl";
    and am getting an error
    ReportServerException: For more information about this error navigate to the report server on the local server machine, or enable remote errors]
    [ReportServerException: The user does not exist or is not unique.]
    [ReportServerException: Report Server has encountered a SharePoint error. (rsSharePointError)]
       Microsoft.Reporting.WebForms.ServerReportSoapProxy.OnSoapException(SoapException e) +82
       Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.ProxyMethodInvocation.Execute(RSExecutionConnection connection, ProxyMethod`1 initialMethod,
    ProxyMethod`1 retryMethod) +770
       Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession() +105
       Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters) +163
       BP.SDC.eXPP.UIAppsWeb.UserControls.Baseline.ProgressDashboard.RefreshDashboardReport(Int32 userRoadMapDisciplineId, String roadmapSection)
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
    Can you please help me to solve this issue

    Hi,
    According to your post, my understanding is that you had issues about the provider hosted app.
    Per the error, the issue may be related to the permission issue.
    For a better troubleshooting, we can check with the following steps.
    To norrow down the issue, please create a new and clean app to test whether it has the same issue.
    You can check the ULS log to see if anything unexpected occurred when you deploy the app and open the site page.
    For SharePoint 2013, by default, ULS log is at
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    You can check the ULS log by the methods here:
    http://blogs.msdn.com/b/opal/archive/2009/12/22/uls-viewer-for-sharepoint-2010-troubleshooting.aspx
    http://msdn.microsoft.com/en-us/library/gg193966(v=office.14).aspx
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • How to Use Office 365 api in Provider Hosted App

    Hi,
    I want to use outlook api in SharePoint Provider Hosted App.
    when I use :-
     $.ajax({
                url: 'https://outlook.office365.com/api/v1.0/me/contacts',
                type: 'GET',
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('Authorization', 'Bearer');
                Accept: "application/json",
                "client-request-id": "9de3d763-a8d9-4433-92f3-096d6be36d86",
                success: function () {
                alert("Welcome to Outlook ")},
                error: function (e) {
                    alert(' Error121212 :' +e);
    Error:-
    XMLHttpRequest cannot load https://outlook.office365.com/api/v1.0/me/contacts. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:44309' is therefore not allowed access. The response had HTTP status code
    401.
    Please Provide me a good example.
    Thanks in Advance

    Hi SharePlus,
    You probably want to use the Office 365 API's to authenticate and communicate with the API's. 
    There's several resources available for this:
    Ultimate LinkRoll for Getting Started with the Office 365 API's
    Download Office 365 API Tools for Visual Studio 2013
    Getting Started with O365 Dev - Communicate with Exchange
    If you don't want to use the pre-compiled typed objects in the Office 365 API's for communicating with the Mail service (Exchange), you can always just make sure to handle the authentication properly and then construct your queries as raw queries, like Chaks
    describes here: http://chakkaradeep.com/index.php/working-with-office365apis-the-raw-version/
    Also, as a general rule; When working with anything Office 365, you should always keep an eye out for the example code, articles and news published from the Office 365 Patterns & Practices team here: https://github.com/OfficeDev/PnP
    I hope this will guide you in the right direction :-)
    Tobias Zimmergren
    Microsoft MCP, MCTS, MCT, MVP (SharePoint)
    Blog: www.zimmergren.net
    Twitter: twitter.com/zimmergren
    Corporate site: www.tozit.com

  • Creating app scoped external content type using Provider Hosted App in sharepoint 2013 using visual studio 2012

    Hi,
    I am creating provider hosted app in visual studio 2012 using app scoped external content type having OData with Northwind url
    App manifest start page url  :
    ODataNewAppWeb/Pages/Default.aspx
    In XML it is:
    <StartPage>~remoteAppUrl/Pages/Default.aspx</StartPage>
    When i am deploying app pressing F5 the app gets deployed successfully....
    Now i am changing my start page url in Appmanifest like this:
    ODataNewApp/Lists/Employees
    In XML it looks like:
    StartPage>~appWebUrl/Lists/Employees</StartPage>
    When i am deploying app pressing F5 the app..
    Getting register SOD error.....
    I have followed all the steps like:
    1)Creating app domain
    2)Starting all the required services
    3)Creating root site collection
    But still no success.. Please help me on this.... I am struggling with this from two weeks...

    Have you set up a wildcard DNS entry for the spapps.com domain?
    Also if you're trying to connect from the server you might be hitting loop back check issues.

  • The remote server returned an error :(401) unauthorized in Provider hosted app deployment

    Hi,
    We are trying to deploy the provider hosted app in server environment . we are getting the "The remote server returned an error :(401) unauthorized" error after deploy the app in server.
    stack Trace:
    [webException:Te remote server returned an error:(401) UnAuthorized.]
    System.Net.HeepWebRequest.GetResponse().
    Followed the same MSDN steps , but sill same error. We have attached the certificate and using the same issuer ID in the app web.config.
    Verified the IIS setting and still getting the same error when we call the "Clientcontext.ExecuteQuery()" method.
    Same code is working fine in my Local dev environment.
    If anyone have idea about this issue, please let me know.
    Thank you,
    Mylsamy

    Hi ,Thank you for your response. We have tried all the options and everything is same (Client ID,Issuer ID...etc) and finally figured out the issue.The below link saved my day.http://msdn.microsoft.com/en-us/library/office/dn762439(v=office.15).aspxIn "TokenHelper.cs" GetRealmFromTargetUrl method always return null andWhen we analyze the issue we found some variable name assigned for "Realm" Instead of GUID in SP server.Power shell command to get the Realm in SP server:  Get-SPAuthenticationRealmWe have followed below article to generate the new GUID for realm.http://technet.microsoft.com/en-us/library/jj219756(v=office.15).aspx$c =Get-SPServiceContext -Site "http://<websiteurl>"Set-SPAuthenticationRealm -ServiceContext $c -Realm "a686d436-9f16-42db-09b7-cb578e110ccd".
    Thankyou,Mylsamy

  • Unable to deploy the provider hosted app on sharepoint server !!!

    Hello,
    I have simply created the provider hosted app by assigning the issuer ID !
    Now, the SharePoint version of the app project is set as SharePoint Online.
    However, when I deploy this project to SharePoint site, it shows following error :
    Unknown SharePoint version: 16.0
    In order to resolve this I changed the SharePoint version as SharePoint 2013
    of the app project.
    Though , I am getting following error on deployment:
    The target version of the SharePoint site is 15.0.4569.1000, which is lower than the minimum supported SharePoint version of the app. To fix this, go to the SharePoint tab on the app for SharePoint project’s properties page, and change the Target
    SharePoint Version property to the version of the SharePoint site or lower.
    Would you please let me know how can I resolve this deployment error ?
    Note : I am using MVC web Application template for web project
    Thank you in advance.
    Kind Regards,
    Dipti Chhatrapati

    Not sure, but this is straight.
    Project type - apps for sharepoint --> Enter URL --> select type as provider hosted app -->  MVC --> Authentication Option.
    Now when publishing the project  - SP App to SharePoint/Office Store  and web portion to any web server ( i generally do it in Azure).
    Thanks, Ashish | Please mark a post helpful/answer if it is helpful or answer your query.

Maybe you are looking for

  • BADI for movement type 601 and COGS GL account

    Hello SAP expert, I am searching a solution from SAP enhancements. The requirement is to provide different COGS GL account based on the Customer Account Assignment Group value(KNVV-KTGRD) when SAP performs goods issue. for example, movement type 601,

  • Upgrade 9i to 10g Performance Issue

    Hi All, DBA team recently upgraded the database from 9i to 10g (Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi). There is a process as follows Mainframe --> Flat file --> (Informatica) --> Oracle DB --> (processing through SPs) -->

  • Internal error: Cannot obtain XAConnection

    I am porting my application from WL8.1-SQl2000 to Sql Server2005. I went in for the Microsoft’s <i><b>MS SQL Server Driver(Type 4 XA) Versions:2000</b></i> and the corresponding one for non-XA also. Then in the next step where we usually give the o

  • Recommend an external firewire hard drive

    i need an external fire wire hard drive to use for audio storage that is both FAST and QUIET. any recommendations?

  • Firefox not rendering fonts [SOLVED]

    I'm having this problem for some time, but it never bugged me too much. Yet, I still want to find the cause and fix this issue. Firefox doesn't show me the correct fonts on some websites - not even on this forum. I'm using infinality patches, if that