I wonder is it possible to add a file from a SharePoint hosted App to host web without setting Full permission for the Web?
function uploadFile(data) {
var url = appUrl + "/_api/SP.AppContextSite(@target)/web/GetFolderByServerRelativeUrl('Style Library')/files/add(url='a.txt',overwrite=true)?@target='" + hostUrl + "'";
var executor = new SP.RequestExecutor(appUrl.toLowerCase());
executor.executeAsync(
{
url: url.toLowerCase(),
method: "POST",
body: data,
headers: {
"Accept": "application/json;odata=verbose",
},
success: function (result) {
console.log("success");
},
error: function (result, errorCode, errorMessage) {
console.log(errorMessage);
}
}
);}
When I run it with Manage permission on Web I get 403 Access Denied. When change to Full - 200 OK. Any ideas how to overcome it?