In this post I will explain how to add a view of your provider-hosted MVC app as an App part in your sharepoint tenant.
- To start with create a provider-hosted MVC app using visual studio 2013
- It creates two projects in your solution. One is a sharepoint app and other is the web app that is the normal MVC project.
- In the solution add a new item in the sharepoint project. Select Office/Sharepoint in the types and then select ‘Client Web Part (Host Web)’ . Give it a suitable name according to your view.
- On the next screen set Url for the app part, since I wanted to load Survey controller’s Index View, I put below Url
- Press F5 which re-installs the app with new changes and asks to verify if you ‘trust it’ again.
- After that go to the page where you want to install the app part and in the Page menu tab, hit Edit. Then click on insert and select App Part:There in the list you can see the Client Web part which we added in the sharepoint App (AppPollWebPart). Select that, hit add and Voila! Its added on the page. Hit save to save the page and your web app is rendered in the little Iframe on the page. You can see the index view in that Iframe.
- Further you can make changes in the appearance of the app part by editing it. Here are the screen caps for that.
You can create a cool dashboard page in your sharepoint tenant with many such cool app parts to display stats, News feeds etc.