使用sharepoint中的REST检索签入注释?

时间:2015-03-25 05:44:58

标签: javascript rest sharepoint

我曾尝试更新,结帐,签入和审核签到评论,但我获得的值不属于范围错误?我错过了什么?

               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

});


  

1 个答案:

答案 0 :(得分:0)

错误:

  

价值不在预期范围内

因为SP.Web.getFileByServerRelativeUrl MethodserverRelativeUrl参数应指定作为文件的服务器相对URL,因此发生

,例如:

/_api/web/GetFileByServerRelativeUrl('/site/web/library/filename')

<强>解决方案

以下列格式指定文件网址:

/site/hostweb/library/filename

例如:

var fileurl = _spPageContextInfo.siteServerRelativeUrl + "/documents/filename";