CopyPastehas never been so tasty!

Steps to create a SharePoint 2013 App with Ruby on Rails

by anonymous

  • 0
  • 0
  • 0
The SharePoint model is quite new to everybody and the recent launch of the 2013 version had made it even more ambiguous to developers around the world. Now, when it comes to creating an application pertaining to the software with Ruby on Rails, most developers seem to have a tough time in embracing the appropriate approach. Well, here is a guide for all Rails developers looking forward to creating an app successfully on the particular framework. However, please note that this particular guide should never be used as the best practice of Ruby on Rails development.

Steps to create a SharePoint 2013 App with Ruby on Rails

Well, before beginning the process, you must register a new application in Office 365. Ensure that a Site Collection has been created by making use of the Developer Site Template. This can be done from the Office 365 admin screens. Following the creation of the same, browse site collection and register the SharePoint application with Office 365 as well as Azure Access Control Services (ACS). For any sort of development purpose, the registration of the new app can be easily done through appregnew.aspx page present within Office 365. Since there is no such link available for the actual page, you need browse the URL directly.

Always remember that since the registration of the application is done through appregnew.aspx, the secret of the particular app will only be known by the ACS and you. Therefore, the series of characters that will be generated will be specifically used for decoding information coming from ACS/SharePoint. Always make sure to take note of the id of the app, as you will not be having any access of the same again.

Since the application will be only used for testing and development purposes, registering it through appregnew.aspx comes across as a wise choice. If there arises a need of making the app thoroughly and widely available or list in the official store of SharePoint, then an account must be registered at the Seller Dashboard.

1. Visual Studio

The next step of work rests with Visual Studio where an application package must be created, which would eventually be uploaded to SharePoint. To make this happen, you need to follow the following steps:
* Open Visual Studio (through 'Run as Administrator') for creating a new project. Go for project creation using the template 'App for SharePoint 2013'. You will find this under the SharePoint /Office project node.
* Following this, you will be asked about the type of SharePoint app that you would like to create. Always remember to offer your app a similar name to that you have given in the appregnew.aspx and submit the URL of the Developer site collection. Ensure choosing an application type of Provider – hosted as the hosting model.
* In the last screen, leave the top option by selecting 'Use a client secret'. Once, you click on the button OK, you will get to see the creation of 2 projects in Solution Explorer.
* It is to be noted that the first project usually implies to the SharePoint App that generates the application package. This particular app will be uploaded.
* The following step requires you to double click AppManifest.xml that consists of all the details related to the app. Upon opening the Manifest Designer, you need to remember to insert some specific values.
Always remember that the application needs to take permissions for being able to read and write data to the SharePoint site where the application is installed. This can be easily done through the permission tab. All you need to do is request just the permission that is actually needed. Always note that the more permission the app would request, the more it will run the risk of not being installed as users will be concerned about the security risk. Always remember to save and then close the AppManifest designer.

2. Ruby on Rails and Apple MacOS

To be able to work with SharePoint 2013, there stands a requirement of installing Ruby Gems to make things easier. Here is a look at the needs:
* jwt – this helps in decoding the JSON web token that emerges from the application software
* rest-client – this enables placing rest requests
* nokogiri – a library that helps querying XML that is usually returned from the SharePoint
the next step of action lies in creating a new application based on Ruby on Rails in your preferred code folder. All you need to do is type into Terminal. Rails is now ready for getting a MVC web application.

Open the gemfile and under the gem stated as 'jquery-rails', integrate the gems that were downloaded as pre-reqs.
* gem 'jwt'
* gem 'rest-client'
* gem 'nokogiri'
This particular step is quite similar to the task of adding new reference in Visual Studio assembly.

3. Https Configuration

You must have noticed that while registering the application in appregnew.aspx, a Redirect URL is set that is https://localhost:3001. The app will be making use of the OAuth for being able to authorize the user and the application. Remember, that the for ensuring OAuth specification, both ends of communication must be https. After all, you would definitely not want any poor interception of unencrypted tokens to be transmitted over the Internet and have an access to the Office 365 or SharePoint site. Rails usually make use of WEBric, which is developed in web server. This is quite similar to the IISExpress of the Visual Studio.

To get the SharePoint 2013 mobile development right, you would have to follow the steps above. Then hopefully, you will be able to successfully create a SharePoint app with Ruby on Rails.

We provide SharePoint portal development services. If you would like to know more about the expertise of our expert SharePoint developers, please get in touch with us at Mindfire Solutions.

Add A Comment: