0

I want to create provider hosted app which will create one custom list and app part will display data which is entered in custom list. I also want to display the custom list on default.aspx page.

How can I do this using code behind:

var contextToken = TokenHelper.GetContextTokenFromRequest(Page.Request);
        var hostWeb = Page.Request["SPHostUrl"];

        using (var clientContext = TokenHelper.GetClientContextWithContextToken(hostWeb, contextToken, Request.Url.Authority))
        {
            clientContext.Load(clientContext.Web, web => web.Title);
            clientContext.ExecuteQuery();
            Response.Write(clientContext.Web.Title);
        }

Please suggest me for correct steps for create this App.

  • the above code is not working for me...the authorization error will occur. – Sameer Vaghela Jun 9 '14 at 10:22
1

You would first need a Developer site to begin with, where you will develop and test your app.

If that is in place make sure you have properly set up your development environment with all the necessary installations for Visual Studio.

If you are creating provider hosted app, you can add a list in the App project and in web project implement your code to show this custom list.

Please go through this blog by Chris O'Brien for details on deployment.

UPDATE - I recently came across a MSDN article which explains in detail Create a provider-hosted add-in that includes a custom SharePoint list and content type. Ref to its troubleshooting section for some great steps to identify issue/s with you deployment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.