Office 365 Cloud Business Apps

    In the previous part, we looked at building applications for SharePoint Online using the built-in NAPA tool. In this article, we will give a brief overview of another simple way - the O365 Cloud Business App project (also known as LightSwitch for SharePoint).

    The LightSwitch development project, which appeared 3 years ago as part of Visual Studio, aims to quickly create relatively simple applications according to a predetermined scheme, which is a fairly general approach to programming most typical business tasks. First, data sources are determined (SQL Server Express is used as the default source, although data can be taken from a host of places, including, for example, SQL Azure or the same SharePoint). The business logic for handling data is written using WCF and the Entity Framework. Graphic designers of entities and relationships between them are widely used, up to the visual design of queries. In the next step, screen forms are designed to display data. Initially, the client side was focused on Silverlight, regardless of Whether a thick or browser (read IE) version of the client was developed. Starting with VS2012, in LightSwitchsupported byHTML5 / JavaScript client side development, including a client for Windows 8 Modern UI. Also, C # and VB.NET are supported as a language for customizing business logic, although, as they write in beautiful glossy leaflets, LightSwitch is focused on solving problems without writing any code manually, including by non-professional users programmers. Leaflets, of course, write the truth. You just need to understand that in real life life is not so glossy, and there are enough rough edges in it, but miracles, on the contrary, are very few. In a good way, you still have to write code. The value of LightSwitch is that, firstly, the code, as a rule, is required, indeed, a little, because it takes care of the main infrastructure binding and component docking; Secondly,

    The O365 Cloud Business App is the same LightSwitch, but applied to SharePoint. By its nature, this is a typical App for SharePoint (a new type of application introduced in SPS 2013, for more details see the previous article ), where the client part is LightSwitch HTML5 Client, and the business logic will be concentrated in the components of SharePoint. Let's create a new project in Visual Studio: open the templates for Visual C # (or Visual Basic), open the Office / SharePoint group, see three project templates in it: App for Office 2013, App for SharePoint 2013 and Cloud Business App, here we click on it . You will immediately be prompted to specify the SharePoint site. In the previous exercises, we created the Office365 Developer site, and I will indicate it:


    Fig . 1

    An empty project opens, in which you can immediately see three characteristic blanks corresponding to the three levels of the LightSwitch application. In general, a typical business application, I would say. These are the data layer (2), the business logic level (3), and the display level (1). Digits are how they go to Solution Explorer. There is also the 0th project - this is the usual manifest for any App for SharePoint.


    Fig.2

    Note that, unlike App for SharePoint, we were not asked where we want to host. Cloud Business App is always created as povider-hosted. Open the manifest to see this.

    Let's consider how to integrate an existing solution into O365, and also add some SharePoint functionality to it. I have some conditional application that symbolizes the work of the support center, where each employee has a list of incidents that he conducts, each with its own status. At the moment, this is a regular LightSwitch application without any SharePoint functionality. What is the matter now? We add integration with SharePoint into it:


    Fig

    . 3 We start the solution. It is successfully installed on SharePoint:


    Fig . 4

    And indeed, now you can see it on our portal:


    Fig . 5

    The application uses its own database, which it inherited from the initial LightSwitch project. To mark the integration with SharePoint, we’ll add a list of data sources. Now there will be little text and even less code, but many pictures, because the Cloud Business App, as we recall, allows an inexperienced user in programming to achieve a meaningful business application with minimal coding. We add a new data source such as SharePoint to the server component of the application:


    Fig.6

    We say that SharePoint will be the same and specify the desired list among the artifacts. We made this list in the previous part when we created the NAPA application.


    Fig. 7

    I forgot to say that our application uses SharePoint authentication for access control, which can be seen in the properties of the web project. It turned on automatically when we locked it in for SharePoint (Fig. 3).

    So, employees are stored in a database on SQL Server, incidents - in the list of SharePoint. Create a relationship between the two data sources to link incidents to the employee. The key field by which the connection is built will be the employee’s email address, which, of course, is incorrect from the point of view of relational theory, but it will come down as an illustration of the idea.


    Fig. 8

    Now you need to change the UI to show incidents. We go to the client project of the solution and slightly modify the screen form of ViewEmployeeDetails, adding to it the display of data from the Source Issues related to the current employee based on the connection built above.



    Fig. 9

    Add the Layout of the new group to the Tabs: Fig.


    10

    Add the Issues to the new group:


    Fig . 11

    Then select the Columns Layout and delete the extra fields:


    Fig . 12

    Add a new screen to edit incidents. You see that in the properties of the List (F4) node, now when clicked, it is None.


    Fig. 13

    Click on None and select Choose an Executing Method = Issues -> editSelected, Navigate To = (New Screen ...)


    Fig. 14

    We edit the screen, removing the extra fields:


    Fig

    . 15 Launch the application. We see that a new Tab group is now displayed on the form. We fall into it and get a list of incidents accompanied by the selected employee, as we filled it in Fig . 8 of the previous article . A somewhat peculiar list of incidents, but overall, I hope, is understandable.


    Fig. 16

    I tried to fulfill the advertising slogan and do without a single line of code. In fact, approaching formally, custom code was present even in this simple solution, for example, to display the current user name on the top line:


    Fig.17

    however, minimal coding, as you understand, does not negate the convenience of O365 Cloud Business App as a tool for the rapid development of typical simple business applications using portal technologies.

    Also popular now: