Develop the project using the following method in the NAPA Tool.
On your Developer Site, open the "Napa" Office 365 Development Tools and then choose Add New Project.
- Choose the App for SharePoint template, name the project Create Site and then choose the Create button.
- Replace APP.js with the following source code below.
- Publish Your App.

The following are the important steps to be done before creating the app. Specify the permissions that your app needs as in the following. Choose the Properties button at the bottom of the page.
- In the Properties window, choose Permissions.
- In the Content category, set Write permissions for the Tenant scope.
- In the Social category, set Read permissions for the User Profiles scope.
- Close the Properties window.


Source Code
- 'use strict';
- var hostweburl;
- var appweburl;
- // Get the URLs for the app web the host web URL from the query string.
- $(document).ready(function() {
- //Get the URI decoded URLs.
- hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
- appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
- // Resources are in URLs in the form:
- // web_url/_layouts/15/resource
- // Load the js file and continue to load the page with information about the folders.
- // SP.RequestExecutor.js to make cross-domain requests
- $.getScript(hostweburl + "/_layouts/15/SP.RequestExecutor.js", filecheckin);
- });
- //Retrieve all of the folders from root Site
- function filecheckin()
- {
- var executor;
- // Initialize the RequestExecutor with the app web URL.
- executor = new SP.RequestExecutor(appweburl);
- executor = new SP.RequestExecutor(appweburl);
- executor.executeAsync({
- url: appweburl + "/_api/SP.AppContextSite(@target)/web/getfilebyserverrelativeurl('/sites/apps/Shared Documents/filename1.txt')/checkin(comment='Check-in comment.',checkintype=0)?@target='" + hostweburl + "'",
- method: "POST",
- headers:
- {
- "accept": "application/json; odata=verbose"
- },
- success: function(data)
- {
- alert("success:File Checked IN");
- },
- error: function(err)
- {
- alert("error: " + JSON.stringify(err));
- }
- });
- }
- //Utilities
- // Retrieve a query string value.
- // For production purposes you may want to use a library to handle the query string.
- function getQueryStringParameter(paramToRetrieve)
- {
- var params = document.URL.split("?")[1].split("&");
- for (var i = 0; i < params.length; i = i + 1)
- {
- var singleParam = params[i].split("=");
- if (singleParam[0] == paramToRetrieve) return singleParam[1];
- }
- }
Publish the App and Click the Trust it Button.

Output
File updated successfully in Document Library SharePointLibraray:



Gowtham RajamanickamPosted Apr 11, 2016, 2:54 AM
thank you vijay
Gowtham RajamanickamPosted Apr 11, 2016, 2:54 AM
thanks all
Vijay SPosted Apr 8, 2015, 9:15 AM
Nice
Karthik Muthu KaruppanPosted Mar 27, 2015, 11:54 AM
nice
Tom MohanPosted Mar 26, 2015, 11:05 PM
good