【问题标题】:How to expand a lookupfield in a sharepoint document library using rest如何使用 rest 扩展共享点文档库中的查找字段
【发布时间】:2018-07-31 00:47:23
【问题描述】:

我有一个包含一些自定义列的 SharePoint(SP) 库。 其中一列包含指向 SP 列表的查找字段。

我需要检索列表中的文档和所有自定义字段,包括查找列表中的字段(加入)。

stackoverflow 上有一些关于这个主题的问答,但它们是关于 SP 列表而不是 SP 文档库。

这是我到目前为止想出的(使用 javascript 执行 GET):

{
"url": "sites/mysite/_api/Web/GetFolderByServerRelativeUrl('/sites/mysite/myfilelibrary')
/files?$select=Name,LinkingUrl,TimeCreated,TimeLastModified,Title,ListItemAllFields
&$expand=ListItemAllFields/myListIdId"
}

这会导致:

{
"value": [
    {
        "ListItemAllFields": {
            "FileSystemObjectType": 0,
            "Id": 1,
            "ServerRedirectedEmbedUrl": "https://mydomain.sharepoint.com/sites/mysite/_layouts/15/WopiFrame.aspx?sourcedoc={abababab-efff-4e69-94de-128ff7c14256}&action=interactivepreview",
            "ContentTypeId": "0x010100769480B9F5404447A43367BFC5B86AAB",
            "Title": null,
            "checkResponsible": null,
>>>>>>>>>>>>"myListIdId": 15, <<<<<<<<<<<<<<<<<<<<<
            "SharedWithUsersId": null,
            "SharedWithDetails": null,
            "ID": 1,
            "Created": "2016-07-25T06:04:56",
            "AuthorId": 9,
            "Modified": "2016-07-26T15:11:27",
            "EditorId": 11,
            "OData__CopySource": null,
            "CheckoutUserId": null,
            "OData__UIVersionString": "9.0",
            "GUID": "898770aa-da56-40ae-9db1-430bba2da9bd"
        },
        "LinkingUrl": "https://mydomain.sharepoint.com/sites/mysite/myFileLibrary/Document.docx?d=w3028f42eefff4e6994de128ff7cd6e48",
        "Name": "Document.docx",
        "TimeCreated": "2016-07-25T13:04:56Z",
        "TimeLastModified": "2016-07-26T22:11:27Z",
        "Title": ""
    }
]
}

字段 myListIdId 已返回但未展开。

$expand=ListItemAllFields/myListIdId

应该可以解决问题,但显然不是。 我错过了什么?

【问题讨论】:

    标签: javascript rest sharepoint sharepoint-2013


    【解决方案1】:

    根据this article,您在选择参数中指定扩展字段。

    修订:

    "...$select=Name,LinkingUrl,TimeCreated,TimeLastModified,Title,ListItemAllFields/myListIdId &$expand=ListItemAllFields"

    【讨论】:

      猜你喜欢
      • 2010-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      • 1970-01-01
      相关资源
      最近更新 更多