3

我查看了其他有同样问题的答案,但这些答案似乎并没有解决这个问题。如何获得包含作者姓名的请求?尽管此请求在响应中返回作者,但它没有实际的作者详细信息。

我是否遗漏了请求中的某些内容,或者是否需要进行一些配置调整?

设置 我们在本地配置了使用 Sharepoint 2013 的 ADFS。

端点我点击 https://SHAREPOINTURL/_api/web/GetFolderByServerRelativeUrl ('Documents')?$select=Author/Id,Author/Name,Author/Title,Editor/Id,Editor/Name,Editor/Title,* &$expand=文件/作者、编辑

回复

{
"d": {
    "__metadata": {
        "id": "https://SHAREPOINT_URL/_api/Web/GetFolderByServerRelativeUrl('Documents')",
        "uri": "https://SHAREPOINT_URL/_api/Web/GetFolderByServerRelativeUrl('Documents')",
        "type": "SP.Folder"
    },
    "Files": {
        "results": [
            {
                "__metadata": {
                    "id": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')",
                    "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')",
                    "type": "SP.File"
                },
                "Author": {
                    "__metadata": {
                        "id": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/Author",
                        "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/Author",
                        "type": "SP.User"
                    },
                    "Groups": {
                        "__deferred": {
                            "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/Author/Groups"
                        }
                    },
                    "Id": 1073741823,
                    "IsHiddenInUI": false,
                    "LoginName": "SHAREPOINT\\system",
                    "Title": "System Account",
                    "PrincipalType": 1,
                    "Email": "",
                    "IsSiteAdmin": false,
                    "UserId": {
                        "__metadata": {
                            "type": "SP.UserIdInfo"
                        },
                        "NameId": "S-1-0-0",
                        "NameIdIssuer": "urn:office:idp:activedirectory"
                    }
                },
                "CheckedOutByUser": {
                    "__deferred": {
                        "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/CheckedOutByUser"
                    }
                },
                "ListItemAllFields": {
                    "__deferred": {
                        "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/ListItemAllFields"
                    }
                },
                "LockedByUser": {
                    "__deferred": {
                        "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/LockedByUser"
                    }
                },
                "ModifiedBy": {
                    "__deferred": {
                        "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/ModifiedBy"
                    }
                },
                "Versions": {
                    "__deferred": {
                        "uri": "https://SHAREPOINT_URL/_api/Web/GetFileByServerRelativeUrl('Documents/FILENAME.xls')/Versions"
                    }
                },
                "CheckInComment": "",
                "CheckOutType": 2,
                "ContentTag": "{71501108-7ACC-46F6-82D7-33E5C5F0124C},3,4",
                "CustomizedPageStatus": 0,
                "ETag": "\"{71501108-7ACC-46F6-82D7-33E5C5F0124C},3\"",
                "Exists": true,
                "Length": "390144",
                "Level": 1,
                "MajorVersion": 1,
                "MinorVersion": 0,
                "Name": "FILENAME.xls",
                "ServerRelativeUrl": "Documents/FILENAME.xls",
                "TimeCreated": "2013-07-10T13:55:39Z",
                "TimeLastModified": "2013-07-10T13:55:39Z",
                "Title": "",
                "UIVersion": 512,
                "UIVersionLabel": "1.0"
            }
        ]
    },
    "ListItemAllFields": {
        "__deferred": {
            "uri": "https://SHAREPOINT_URL/_api/Web/GetFolderByServerRelativeUrl('Documents')/ListItemAllFields"
        }
    },
    "ParentFolder": {
        "__deferred": {
            "uri": "https://SHAREPOINT_URL/_api/Web/GetFolderByServerRelativeUrl('Documents')/ParentFolder"
        }
    },
    "Properties": {
        "__deferred": {
            "uri": "https://SHAREPOINT_URL/_api/Web/GetFolderByServerRelativeUrl('Documents')/Properties"
        }
    },
    "Folders": {
        "__deferred": {
            "uri": "https://SHAREPOINT_URL/_api/Web/GetFolderByServerRelativeUrl('Documents')/Folders"
        }
    },
    "ItemCount": 18,
    "Name": "Documents",
    "ServerRelativeUrl": "Documents",
    "WelcomePage": ""
}

}

4

1 回答 1

0

尝试这个。我在 MSDN 论坛上找到了这个。 https://social.msdn.microsoft.com/Forums/office/en-US/04fc252c-adb9-4f50-b9b0-c326f88ad69e/retriving-author-name-using-rest-api?forum=appsforsharepoint

----- 更新 https://{SITE_URL}/_api/web/Lists/getbytitle('{DOCUMENT_PATH}')/items?$select=Title,Author/ID,Author/FirstName,Author/LastName,Author/职务、作者/部门、作者/EMail&$expand=作者/ID

于 2018-10-29T16:22:38.703 回答