Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 是否在sharepoint中使用REST检索签入注释?_Javascript_Rest_Sharepoint - Fatal编程技术网

Javascript 是否在sharepoint中使用REST检索签入注释?

Javascript 是否在sharepoint中使用REST检索签入注释?,javascript,rest,sharepoint,Javascript,Rest,Sharepoint,我已尝试更新、签出、签入和检索签入注释,但im获取的值不在范围内错误?我错过了什么 var getfileurl=document.getElementByIdgetfileurl.value; //我输入了/lib/folder/test.docx这样的路径 alertgetfileurl; 风险值执行人; //使用应用程序web URL初始化RequestExecutor。 executor=new SP.RequestExecutorappweburl; executor.execute

我已尝试更新、签出、签入和检索签入注释,但im获取的值不在范围内错误?我错过了什么

var getfileurl=document.getElementByIdgetfileurl.value; //我输入了/lib/folder/test.docx这样的路径 alertgetfileurl; 风险值执行人; //使用应用程序web URL初始化RequestExecutor。 executor=new SP.RequestExecutorappweburl; executor.executeAsync{ url:appweburl+/\u api/SP。AppContextSite@target/web/GetFileByServerRelativeUrl'+getfileurl+'/CheckInComment?@target='+hostweburl+', 方法:获取, 标题:{ 接受:application/json;odata=verbose }, success:SuccessHandler, 错误:ErrorHandler }; 错误:

值不在预期范围内

发生的原因是应将的serverRelativeUrl参数指定为文件的服务器相对URL,例如:

/_api/web/GetFileByServerRelativeUrl('/site/web/library/filename')
var fileurl = _spPageContextInfo.siteServerRelativeUrl + "/documents/filename";
解决方案

以以下格式指定文件url:

/site/hostweb/library/filename
例如:

/_api/web/GetFileByServerRelativeUrl('/site/web/library/filename')
var fileurl = _spPageContextInfo.siteServerRelativeUrl + "/documents/filename";