SharePoint list column exists but REST API call fails with 'Column <ColumnName> does not exist'. Possible interference of Computed coulmn with $expand clause (?)

Artyom Shegeda (AMAXRA) 1 Reputation point
2022-12-21T21:06:29.02+00:00

Hello everyone!

I found REST API weird behavior while querying items from SharePoint list.

Here is the [Edit] column (came from base calendar type):
272969-111.jpg

[Edit] field's SchemaXml contains this:

<Field ID="{503f1caa-358e-4918-9094-4a2cdc4bc034}" ReadOnly="TRUE" Type="Computed" Name="Edit" Sortable="FALSE" Filterable="FALSE" DisplayName="Edit" ClassInfo="Icon" AuthoringInfo="(link to edit item)" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Edit" FromBaseType="TRUE"><DisplayPattern><IfHasRights><RightsChoices><RightsGroup PermEditListItems="required" /></RightsChoices><Then><HTML><![CDATA[<a href="]]></HTML><URL Cmd="Edit" /><HTML><![CDATA[" onclick="EditLink(this, ]]></HTML><Counter Type="View" /><HTML><![CDATA[);return false;" target="_self">]]></HTML><HTML><![CDATA[<img border="0" alt="]]></HTML><HTML>Edit</HTML><HTML><![CDATA[" src="/_layouts/15/images/edititem.gif?rev=47"/>]]></HTML><HTML><![CDATA[</a>]]></HTML></Then><Else><HTML><![CDATA[&#160;]]></HTML></Else></IfHasRights></DisplayPattern></Field>  

Here is the request for list items:

/_api/web/lists('7da4e267-2e9f-45bb-a343-4a4e7a4ece20')/items?$select=EventContact%2FID,EventContact%2FTitle,EventContact%2FName,EventContact%2FEMail,Speaker%2FID,Speaker%2FTitle,Speaker%2FName,Speaker%2FEMail,Edit&$expand=EventContact,Speaker&$top=300

EventContact and Speaker are User fields.

Here is the response [code: 400 Bad request]:

272900-222.jpg

If i remove Edit from $select clause then REST API call finishes corect:

/_api/web/lists('7da4e267-2e9f-45bb-a343-4a4e7a4ece20')/items?$select=EventContact%2FID,EventContact%2FTitle,EventContact%2FName,EventContact%2FEMail,Speaker%2FID,Speaker%2FTitle,Speaker%2FName,Speaker%2FEMail&$expand=EventContact,Speaker&$top=300

If i remove both columns EventContact and Speaker from $select clause and from $expand clause then REST API call finishes corect:

/_api/web/lists('7da4e267-2e9f-45bb-a343-4a4e7a4ece20')/items?$select=Edit&$top=300

So, my question is: WHAT the freaking strange thing? Can anyone explain what rule affects this?

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-12-22T05:42:25.233+00:00

    Hi @Artyom Shegeda (AMAXRA)
    Per my test, I can call the api with corect without '/' in column name. I can run with following url

    /_api/web/lists('id')/items?$select=EventContactID,EventContactTitle,EventContactName,EventContactEMail,SpeakerID,SpeakerTitle,SpeakerFName,SpeakerEMail,Edit&$expand=EventContact,Speaker&$top=300

    The %2F in column name might cause the error. You could try to rename the column without '/', and call the first url again.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.