IT tutorials
 
Technology
 

UNDERSTANDING THE THREE APPS FOR SHAREPOINT DEPLOYMENT MODELS (part 1) - SharePoint-Hosted

8/22/2013 9:43:47 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Because SharePoint 2013 is moving in the direction of the cloud, there are three new types of deployment models available to help you achieve this goal for the Apps for SharePoint:

  • SharePoint-hosted
  • Autohosted
  • Provider-hosted

Each one of these types of deployment models possesses characteristics that make it ideal for different types of app development. The following sections examine the deployment models in greater detail.

SharePoint-Hosted

The SharePoint-hosted deployment type represents a way to deploy client-side, lightweight apps to SharePoint 2013. The easiest way to think about the SharePoint-hosted app is as an application that has no server-side code. It is an application made up of static application files or pages that reside on your SharePoint tenancy or instance. Think of HTML and JavaScript files that enable client-side coding. When users access the SharePoint-hosted app, they are redirected to the page that contains your application. The SharePoint-hosted deployment type is good for lighter-weight apps such as branded list views, media apps, or weather apps.

If you decide to leverage the SharePoint-hosted deployment model, then you are limited to code that does not run on the server. However, also know that client-side applications can be quite powerful. For example, you can still use Silverlight with SharePoint 2013, and as mentioned, you also can take advantage of HTML (more specifically the newer HTML5 standards) along with JavaScript. You can use these in tandem with the client-side object model to interact with SharePoint data (for example, list data).

To help illustrate how you build a SharePoint-hosted app, let’s go ahead and create a simple SharePoint-hosted app using the following steps.

TRY IT OUT: Creating a SharePoint-Hosted App (SPHostedApp_SimpleDateApp.zip)
To complete this exercise, ensure you have the following:
  • Visual Studio 2012 downloaded and installed
  • SharePoint Developer Tools installed
  • An Office 365 trial site set up for your use
You can reference the following TechNet article to walk through the process to set up your development environment: http://msdn.microsoft.com/zh-cn/library/sharepoint/ee554869_v=office.15_.

After you have your environment set up and ready, you can begin to create your first SharePoint-Hosted app:
1. Open Visual Studio, and click File ⇒ New Project. Navigate to Office/SharePoint ⇒ Apps, and then select App for SharePoint 2013.
2. Provide a name for the app (SPHostedApp_SimpleDateApp), select a location for the project, and click OK, as shown in Figure 1.

FIGURE 1

image
3. In the New App for SharePoint wizard, add the SharePoint site URL that you want to debug and then select the SharePoint-hosted model as the way you want to host your app for SharePoint (see Figure 2).

FIGURE 2

image
4. Click Finish.
5. After Visual Studio generates the project, double click the AppManifest.xml file, which is located within the SharePoint project.
6. In the Scope drop-down list, select Web, which is the scope of permissions that you’re configuring. See Figure 3.

FIGURE 3

image
7. In the Permission drop-down list, select Read, which is the type of permission you’re configuring. See Figure 4.

FIGURE 4

image
8. Double-click the Default.aspx file and replace PlaceHolderAdditionalPageHead and PlaceHolderMain with the following bolded code.
<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, 
Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" 
MasterPageFile="~masterurl/default.master" language="C#" %>
<%@ Register Tagprefix="SharePoint" 
Namespace="Microsoft.SharePoint.WebControls" 
Assembly="Microsoft.SharePoint, Version=15.0.0.0, 
Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" 
Assembly="Microsoft.SharePoint, Version=15.0.0.0, 
Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" 
Assembly="Microsoft.SharePoint, 
Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 
<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderAdditionalPageHead" 
runat="server">
    <script type="text/javascript" src="../Scripts/jquery-1.6.2.min.js"></script>
 
    <link rel="Stylesheet" type="text/css" href="../Content/App.css" />
    <script type="text/javascript" src="../Scripts/App.js"></script>
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <script type="text/javascript">
        function hello() {
            var currentTime = new Date();
            $get("timeDiv").innerHTML = currentTime.toDateString();
        }
    </script>
    <div id="timeDiv"></div>
    <input  type="button" value="Push me!" onclick="hello();"/>
</asp:Content>
9. After you finish adding the code snippet, right-click the SharePoint app (for example, SPHostedApp_SimpleDateApp) and click Publish, as shown in Figure 5. This builds your SharePoint-hosted app (that is, the .APP package discussed earlier) and prepares it for you for deployment to your SharePoint site.

FIGURE 5

image
10. When prompted, click Finish to complete the build process.
11. Windows Explorer automatically opens when the app is built, so copy the Windows Explorer folder path to the clipboard (see Figure 6). You’ll use this folder path when uploading the .APP package to SharePoint.

FIGURE 6

image
12. Navigate to your SharePoint Online site, and then click the New App to Deploy link.
13. In the Deploy App dialog, click the Upload link.
14. Click Browse, and then paste the folder path you copied to the clipboard in the Choose File to Upload dialog. Click Open.
15. Click OK, and then click Deploy.
16. When prompted to trust the app, click Trust It (see Figure 7).

FIGURE 7

image
17. When the app has been deployed, click the Site Contents link. You should now see your app listed on the page.
18. Click the app tile to load your SharePoint-hosted app (see Figure 8). Click the Push me! button.

FIGURE 8

image

How It Works

The SharePoint-hosted app is a lightweight application, and in this example you created and deployed a simple app that displayed the current time when you clicked a button object. To accomplish this, you can see in the following code that you added the hello function, created a new var object called currentTime, and then set the inner HTML of the timeDiv DIV object to be the string representation of the current Date.
...
<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <script type="text/javascript">
        function hello() {
            var currentTime = new Date();
            $get("timeDiv").innerHTML = currentTime.toDateString();
        }
    </script>
    <div id="timeDiv"></div>
    <input  type="button" value="Push me!" onclick="hello();"/>
</asp:Content>
...
You then deployed the App for SharePoint using the Publish feature in Visual Studio 2012. You also explicitly set the permissions level of the app before you deployed it, so when you clicked the Trust It button, this level of permission was enabled by SharePoint for your application. Setting permissions is a common task that you’ll do across many different SharePoint apps.

The benefits here are that you can not only get code off of the server, but you’re now leveraging JavaScript to bring your app to life on the client. The SharePoint-hosted deployment technique is lightweight, but you will find yourself doing a lot of client-side coding such as JavaScript or HTML, so make sure if you’re not up to speed on either of these two technologies you spend a little time learning them. If you want to move beyond the client and build cloud-based apps, you can use the Autohosted deployment model.

 
Others
 
- SHAREPOINT 2013 APP MODEL : Apps for Office, Apps for SharePoint
- Microsoft Dynamic AX 2009 : The Database Layer - Unicode Support
- Microsoft Dynamic AX 2009 : The Database Layer - Company Accounts
- Microsoft Dynamic AX 2009 : The Database Layer - Record Identifiers
- SQL Server 2008 R2 : Filtered Indexes and Statistics - Creating and Using Filtered Indexes
- SQL Server 2008 R2 : Index Design Guidelines - Indexed Views, Indexes on Computed Columns
- SQL Server 2008 R2 : Index Design Guidelines
- Windows Server 2008 : Manipulating Users and Groups with the net Command, Modifying NTFS Permissions with icacls
- Windows Server 2008 : Manipulating Shares with net share, Mapping Drives with net use
- Windows Server 2008 : Manipulating Shadow Copies with vssadmin
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us