0
votes

I have a office 365 sharepoint list with the following columns: Title, URL, Category, DepartmentHead, and Email. The values for DepartmentHead and Email are returning null. These were two columns that I've just added as "single line of text" columns. Why would they be returning null in my api response???

Here is the api call I'm using: /api/spdata/GetListItems('${this.listName}')/items

1
How did you add the columns, Via the library add column or via the + functionality? - Truezplaya

1 Answers

0
votes

I eventually figured out that what I wanted was a person object in which I would need to expand in my query to retrieve the email instead of just a text email column. Ended up with the following data url to fetch the items. I believe the issue before was that I was not using the internal name for the column. I found the name by going to the sharepoint list settings and clicking the column name. Once on that page, the column name is displayed in the url at the top of the page.

/api/spdata/GetListItems('${this.allContentListName}')/items?$expand=DepartmentHead&$select=*,DepartmentHead/JobTitle,DepartmentHead/Id,DepartmentHead/EMail,DepartmentHead/Title&$filter=OData__ModerationStatus eq 0;