06 October, 2013

Introducing MVC Support for Apps for SharePoint

SharePoint, which has already established itself as one of the most popular and preferred web application development platforms, works more effectively when incorporated with certain apps. Apps are those powerful website applications that add to the effectiveness of the platforms. These days, the ASP.NET.MVC has become a preferred mode of project application.


ASP.NET.MVC offers web developers with several advantages. To begin with, it comes up with a really pattern- based and powerful platform that allows easy building of dynamic websites. These websites, in turn, pave the way for separating different aspects such as that of the view, model and controller of the app. At the same time, the app provides full control over markup to offer a good experience of development.

SharePoint portal development with MVC as a remote project requires one to follow a two-step process. Firstly, this particular sort of project development needs to be created and secondly, one has to engage in what can be considered as the 'app-etizing' of the concerned web project. This is done with the purpose of adding an application for SharePoint.

When an auto-hosted or provider- hosted app for SharePoint is created in the Preview of the Visual Studio 2013, you get the option of choosing the type of the web application project. Once the procedure is accomplished and you click on the Finish button, the Visual Studio automatically takes up the following tasks:
  • Creation of the application for the project
  • Creation of the MVC website application project
  • Addition of the SharePoint-references to the said project
  • Addition of helper classes to that of the particular project
A working app for SharePoint with this advanced sort of web app is now ready. The following steps would encompass pressing F5 to debug the app. Now, Visual Studio deploys this app for SharePoint to the site of the specified developer. This is accompanied by a starting of the Internet Information Services or IIS Express and finally, running of your MVC website application. A browser is then opened to the home page of the app, in this case, the particular app that we are talking about.

A default template is created out of the box and it comes with the About, Home and Contact pages apart from some sample code. These sample code show you the way of interacting with SharePoint. The code helps in the creation of a client context for the host web while also retrieving the current user name, which is displayed in the home page.

The MVC website application project also offers a set of APIs, which involves a series of steps for the web project to communicate to SharePoint in a rather smooth manner and that too, in a single call. The SharePoint context filter takes up the additional processing for getting standard information when redirected from SharePoint to the remote web application, for instance, Host Web URL. Additionally, it also determines as to whether the application has to be redirected to SharePoint for the user to sign in. This is particularly applicable in case of bookmarks. This filter can be applied either for the purpose of viewing or to the controller.

The context classes of SharePoint incorporate all the data and information so that one can quite easily create particular contexts for the app web as well as the host web directly and thereby communicate with the platform. The introduction of the MVC support for apps turns out to be of substantial help provided that one is aware of the right ways of engaging in the process.

We provide SharePoint development services. If you would like to hire SharePoint developer from our team, please get in touch with us at Mindfire Solutions.

No comments: