我曾尝试更新,结帐,签入和审核签到评论,但我获得的值不属于范围错误?我错过了什么?
var getfileurl = document.getElementById("getfileurl").value;
//i have entered the path like /lib/folder/test.docx
alert(getfileurl);
var executor;
// Initialize the RequestExecutor with the app web URL.
executor = new SP.RequestExecutor(appweburl);
executor.executeAsync({
url: appweburl + "/_api/SP.AppContextSite(@target)/web/GetFileByServerRelativeUrl('" + getfileurl + "')/CheckInComment?@target='" + hostweburl + "'",
method: "GET",
headers: {
"Accept": "application/json; odata=verbose"
},
success: SuccessHandler,
error: ErrorHandler
});
答案 0 :(得分:0)
错误:
价值不在预期范围内
因为SP.Web.getFileByServerRelativeUrl Method的serverRelativeUrl
参数应指定作为文件的服务器相对URL,因此发生
,例如:
/_api/web/GetFileByServerRelativeUrl('/site/web/library/filename')
<强>解决方案强>
以下列格式指定文件网址:
/site/hostweb/library/filename
例如:
var fileurl = _spPageContextInfo.siteServerRelativeUrl + "/documents/filename";