0

I know the names of some columns - FirstName, LastName, JobTitle, SAMAccountName, Department that an API serves out but I would like to know all the columns that are returned.

How do I find out the titles of all the columns?

The commented out line works.

$.ajax ({
//url: 'http://webservice/view/odata/PeopleDepartmentOData?$select=FirstName,LastName,JobTitle,SAMAccountName,Department',
url: 'http://webservice/view/odata/PeopleDepartmentOData',
dataType: 'json',
async: false,
headers: { "Accept": "application/json;odata=verbose" },
success: function(data) {
    var html = '';
    var count = 1;
var staffToShow = [];       

    for(var result in data.d.results) {

        
        console.log (data.d.results[result].FirstName + " - " + data.d.results[result].LastName);
        console.log (data.d.results[result].Department);
1
  • Are you trying to fetch the records from SharePoint list or user profiles or from somewhere else? Feb 28, 2022 at 11:58

2 Answers 2

0

To know all the columns name, you can use below:

https://<TenantName>.sharepoint.com/sites/<SiteCollectionName>/_api/web/lists/getbytitle('<ListName>')/Fields?$filter=Hidden eq false and ReadOnlyField eq false&$select=Title,InternalName

Here,

Title = Display Name

InternalName = Internal Name of a column

0

Examining the data returned from the web service call will get you the information you're looking for. There are a couple relatively easy ways to do this.

  1. Use the web browser debugging tools. Put a debugger statement in the success method and examine the data object.

Web browser debugging

  1. Use a tool like Fiddler (https://www.telerik.com/fiddler) to capture the web traffic. Select the HTTP request in the left pane, select Inspectors in the right pane, and then select JSON in the Response pane.

Fiddler

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.