1

I created a MediaAlbum List added an existing column called "Page Image".

$.ajax({
        url: siteurl + "/_api/web/lists/getbytitle('MediaAlbum')/items?$filter=IsActive%20eq%201&$expand=ContentType",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
        console.log(data);
        },
        error: function (error) {
        alert("Error: "+ JSON.stringify(error));
        }
      });

The problem here is in the log I am unable to retrieve see the 'Page Image' column details.

1

Add a parameter to your query URL to specify what columns you want to retrieve:

$select=Page Image

e.g.

$.ajax({
        url: siteurl + "/_api/web/lists/getbytitle('MediaAlbum')/items?$filter=IsActive%20eq%201&$expand=ContentType&$select=Page Image",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
        console.log(data);
        },
        error: function (error) {
        alert("Error: "+ JSON.stringify(error));
        }
      });
1

$select :

Use the $select query option to specify which fields to return for a given list, list item, or other SharePoint object represented by an entity set. You can use $select=* to return all available fields.

In General Case :

In general, if you do not specify the $select query option, the REST service returns all available fields by default. However, in a few cases, some SharePoint objects include properties that are very resource intensive to retrieve; to optimize REST service performance, these properties are not included in the default query, and must be explicitly requested.

(Source: https://msdn.microsoft.com/en-us/library/office/fp142385.aspx)

E.g.

var Ownurl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle(' Divisions’)/items?$select="ColumnName"&$filter=Title eq 'test1'";

In Your Code :

$.ajax({
        url: siteurl + "/_api/web/lists/getbytitle('MediaAlbum')/items?$select="Page Image"&$filter=IsActive%20eq%201&$expand=ContentType&,
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
        console.log(data);
        },
        error: function (error) {
        alert("Error: "+ JSON.stringify(error));
        }
      });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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