SharePoint 2013 - App Development
Pre-Requisite: Have your virtual machine ready with Microsoft SharePoint 2013 and Visual Studio 2012 installed on it.
This article is divided into following three sections:
- Setup App Catalog
- Develop a SharePoint-Hosted App
- Deploy the App
Setup App Catalog:
For App development in SharePoint 2013, first we need to setup an App Catalog. What is an App Catalog? App Catalog is a special Site Collection where all the apps are published and stored. App Catalog site collection is setup per web application. So once an app is hosted in an app catalog, it is available to all the site collections within that web application.
Below are the steps to create and setup an App Catalog to deploy a SharePoint-Hosted App:
- Go to the Central Administration and select Apps from the left menu
- From the App Management section, select Manage App Catalog

- On the Manage App Catalog page, select Create a new app catalog site and hit OK.

- On the Create App Catalog page, provide the required fields along with the Farm account and hit OK.

- Once done, you should see following screen.

- Browse to the App Catalog site and it should look like this:

- Apps are designed to run from a separate Domain name. To configure that we need an entry in the Domain Name Server (DNS). I have created a new domain apps.com. * in the domain is used so that we can use the app name there.

- You should be able to ping the domain name after its configured.

- Run the following script to create a new service application running in its own pool
Script:
01add-pssnapin"Microsoft.Sharepoint.Powershell"0203$account= Get-SPManagedAccountDomain\go-SvcSpSetupDev0405Remove-SPServiceApplicationPool-IdentitySettingsServiceAppPool0607$appPoolSubSvc= New-SPServiceApplicationPool-NameSettingsServiceAppPool-Account$account0809$appSubSvc= New-SPSubscriptionSettingsServiceApplication-ApplicationPool$appPoolSubSvc-NameSettingsServiceApp-DatabaseNameSettingsServiceDB1011$proxySubSvc= New-SPSubscriptionSettingsServiceApplicationProxy-ServiceApplication$appSubSvc
Verify:Go to Central Administration -> Application Management -> Service Applications -> Manage Service Applications
You should be able to see SettingsServiceApp
- Now, let's configure App URL.
Enter the domain and prefix
Develop a SharePoint-Hosted App
- Launch Visual Studio 2012 and create an App for SharePoint 2013.
- Give the app name, site name and select SharePoint-hosted

- Write your Client Object Model (CSOM) code in App.js.
- Select Build -> Publish and then Finish. You will get an App1.app ready to deploy.
Deploy the App
- Go to the App Catalog site and select Apps for SharePoint library.
- Upload App1.app here by selecting new app link.

- Go to the home page and select Settings icon -> Add an app

- Look for App1 and select it and then click Trust It. < style="text-align: center">

- The App1 will take some time to get installed and will be visible in Site Content.


- Click the app to run it.
- If you observe the URL of the app. It looks something like this:
http://[app prefix]-[app hash].[app domain]/[relative site URL]/[app name]/Pages/Default.aspx
e.g.
http://app-441ae93071a873.apps.com/sites/AppCat/App1/Pages/Default.aspx

Ref 2: http://msdn.microsoft.com/en-us/library/jj164070.aspx
Hi Friends its my post for my Blog...please give your comments...
ReplyDelete