To create apps using Visual Studio 2015 Community, you need to make sure create sharepoint teamsite as developer site. We should make apps on developer site, then it need to deploy to app store. If you use not developer site but teamsite, on debugging , you can meet error as “Error occurred in deployment step “Install SharePoint-Add in’ : Sideloading of apps is not enabled on this site.”
Today I’ll show how to create javascript apps on online sharepoint
Create new project on visual studio 2015 communtiy
- Open Visual Studio 2015 community as administrator
- Make new project , select to Office Add-ins as “SharePoint Add-In” as name of JavaScriptDemo2
- You need to input “What SharePoint site do you want to use for debugging your add-in?” to sharepoint developer site, and also select “SharePoint-hosted”
- You need to select “SharePoint Online” on the Specify the target SharePoint version
- It creates “JavaScriptDemo2” project as automatically
See around project which you created.
You can see Default.aspx page , it have SharePoint Script as “sp.js” , jquery and app.js.
Let me explain those components.
SP.ClientContext object (sp.js) : Represents the context for objects and operations.ClientContext constructor initializes a new instance of the ClientContext object for the specified SharePoint site.
app.js : you can add javascript code and jquery code also
Let’s do it as easy example.
Create button on Default.aspx as Html Tag
Move to App.js then remove all scripts except ‘use strict’ on top of this script.
After you save all changes then you need to “Execute” Button on Visual Studio, you can see deployed apps on this sharepoint like below.
If you click “Load” Button, you can show below site as changed to message as “JavaScriptDemo1”
This post which I recently uploaded to this blog to study online sharepoint as client object model. Since now I’ll create and concentrate on online sharepoint development