3

I looked over other answers that was having the same problem, but those answers don't seem to resolve this problem. How can I get the request to include the Author name? Although, this request returns Author in the response, it doesn't have the actual author details.

Am I missing something on the request or does it need some configuration adjustments?

Setup We have ADFS configured with Sharepoint 2013 on Premise.

Endpoint I'm hitting https://SHAREPOINTURL/_api/web/GetFolderByServerRelativeUrl('Documents')?$select=Author/Id,Author/Name,Author/Title,Editor/Id,Editor/Name,Editor/Title,*&$expand=Files/Author,Editor

Response

{
"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": ""
}

}

Suthan Bala
  • 3,209
  • 5
  • 34
  • 59

1 Answers1

0

Try this. I found this on the MSDN forum. https://social.msdn.microsoft.com/Forums/office/en-US/04fc252c-adb9-4f50-b9b0-c326f88ad69e/retriving-author-name-using-rest-api?forum=appsforsharepoint

----- update https://{SITE_URL}/_api/web/Lists/getbytitle('{DOCUMENT_PATH}')/items?$select=Title,Author/ID,Author/FirstName,Author/LastName,Author/Title,Author/Department,Author/EMail&$expand=Author/ID

Photops
  • 312
  • 2
  • 6
  • 20
  • The endpoint https://{SITE_URL}/_api/web/Lists/getbytitle('{DOCUMENT_PATH}')/items?$select=Title,Author/ID,Author/FirstName,Author/LastName,Author/Title,Author/Department,Author/EMail&$expand=Author/ID returns the author data as expected returns the author details as expected. Can you update your answer to include this URL, I'll award you the bounty. – Suthan Bala Oct 29 '18 at 17:50