Sharepoint GetFileByServerRelativeUrl返回文档不存在

时间:2019-10-03 12:17:54

标签: sharepoint

我正在尝试通过POSTMAN调用SharePoint Api来获取文档。 调用这两个网址时:

https://<MY_SITE>.sharepoint.com/sites/Test/_api/web/GetFileByServerRelativeUrl('/sites/Test/Documents/testFolder/Document.docx')/$value

https://<MY_SITE>.sharepoint.com/_api/web/GetFileByServerRelativeUrl('/sites/Test/Documents/testFolder/Document.docx')/$value

我收到以下答复:

{
    "error": {
        "code": "-2130575338, Microsoft.SharePoint.SPException",
        "message": {
            "lang": "en-US",
            "value": "The file /sites/Test/Documents/testFolder/Document.docx 
                       does not exist."
        }
    }
}

有人可以帮忙吗

1 个答案:

答案 0 :(得分:0)

创建网站时,图书馆是否记录默认文档?如果是这样,则应在rest api中使用Shared%20Documents。像这样:

GetFileByServerRelativeUrl('/sites/Test/Shared%20Documents/testFolder/Document.docx')