1

I am in need of creating a custom column for a SharePoint list. I need to add custom metadata to the files I will be saving under that list. I followed the instructions in the official documentation; Nonetheless, I'm getting an unexpected result when it comes to a certain property specifically.

My intention is to create a Multiple lines text column. This is the body I am sending on the PATCH request:

{
    "columnGroup": "Custom Columns",
    "description": "Custom app metadata",
    "displayName": "App Data",
    "enforceUniqueValues": false,
    "hidden": false,
    "indexed": false,
    "name": "AppData",
    "readOnly": false,
    "required": false,
    "text": {
        "allowMultipleLines": true,
        "appendChangesToExistingText": false,
        "linesForEditing": 6,
        "textType": "plain"
    }
}

However, the response I am getting back is this:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('777xxx77-x77x-7xx7-xx77-7x7x7x7x7x')/columns/$entity",
    "columnGroup": "Custom Columns",
    "description": "Custom app metadata",
    "displayName": "App Data",
    "enforceUniqueValues": false,
    "hidden": false,
    "id": "777xxx77-x77x-7xx7-xx77-7x7x7x7x7x", //replaced original with dummy id
    "indexed": false,
    "name": "AppData",
    "readOnly": false,
    "required": false,
    "text": {
        "allowMultipleLines": true,
        "appendChangesToExistingText": true,
        "linesForEditing": 6,
        "textType": "plain"
    }
}

The key point here is that the property appendChangesToExistingText, which is set to false in the request body, is returned as true in the response body.

That little thing is driving me nuts. The reason for that is that I get this "View Entries" thing in the sharepoint column. I have done some research an apparently, it is caused by that property set to TRUE.

enter image description here

My question is.... Why is not the API working as expected? Am I doing something wrong? Is it a bug in the API? Is it not ready for production yet? Can anyone shed some light please?

Dev
  • 2,428
  • 2
  • 14
  • 15
Morfinismo
  • 4,985
  • 4
  • 19
  • 36
  • I'm getting this issue both with PATCH requests on existing columns and also POST requests when creating new columns. Always sending `"appendChangesToExistingText": false` but getting back `true`. Infuriatingly confusing! You're correct that this is what's causing the page to show "View Entries" but I can't seem to get it to behave. – scign Apr 25 '22 at 01:44

1 Answers1

1

When the text column has allowMultipleLines set to true, appendChangesToExistingText is either true for versioned fields, or omitted. If present, it will create a versioned text field. Why? ‍♂️

When creating or modifying a column, I therefore needed to precede the API call with code to remove the property if set to false:

try:
    if field_props['text']['appendChangesToExistingText] == False:
        del field_props['text']['appendChangesToExistingText]
except:
    pass

Source: I asked ChatGPT for this, out of sheer desperation. It told me that "The documentation explains that this property can only be set to "true" or omitted for multi-line text columns in SharePoint Online" but I have been unable to locate this "documentation".

scign
  • 812
  • 5
  • 15