2

I am trying to perform an approval using REST API in SharePoint 2013. I am able to successfully Approve/Reject but unable to read or save approval comments.

I couldn't figure out what is the column name. When I try to read all columns of a task list, I do not see any comments column.

How can I get/set the comments of a SharePoint task, while approving (using RSET API)?

enter image description here

2
  • try setting the field named OData__ModerationComments
    – willman
    Commented Mar 10, 2020 at 18:12
  • It's not working. I tried using that to get data as well but doesn't work.
    – Ishan
    Commented Mar 10, 2020 at 18:31

1 Answer 1

0

Internal Name of Approver Comments column is _ModerationComments. Try using this name in REST endpoint to get/set the approver comments.

Generally, you can get the internal name of any of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?

Try below endpoint to get all the details of comments field:

<siteUrl>/_api/web/Lists/getbytitle('ListName')/fields?$filter=InternalName eq '_ModerationComments'

Here is the sample result of above endpoint:

<m:properties>
    <d:AutoIndexed m:type="Edm.Boolean">false</d:AutoIndexed>
    <d:CanBeDeleted m:type="Edm.Boolean">false</d:CanBeDeleted>
    <d:ClientSideComponentId m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:ClientSideComponentId>
    <d:ClientSideComponentProperties m:null="true" />
    <d:ClientValidationFormula m:null="true" />
    <d:ClientValidationMessage m:null="true" />
    <d:CustomFormatter m:null="true" />
    <d:DefaultFormula m:null="true" />
    <d:DefaultValue m:null="true" />
    <d:Description></d:Description>
    <d:Direction>none</d:Direction>
    <d:EnforceUniqueValues m:type="Edm.Boolean">false</d:EnforceUniqueValues>
    <d:EntityPropertyName>OData__ModerationComments</d:EntityPropertyName>
    <d:Filterable m:type="Edm.Boolean">false</d:Filterable>
    <d:FromBaseType m:type="Edm.Boolean">true</d:FromBaseType>
    <d:Group>Custom Columns</d:Group>
    <d:Hidden m:type="Edm.Boolean">true</d:Hidden>
    <d:Id m:type="Edm.Guid">34ad21eb-75bd-4544-8c73-0e08330291fe</d:Id>
    <d:Indexed m:type="Edm.Boolean">false</d:Indexed>
    <d:IndexStatus m:type="Edm.Int32">0</d:IndexStatus>
    <d:InternalName>_ModerationComments</d:InternalName>
    <d:IsModern m:type="Edm.Boolean">false</d:IsModern>
    <d:JSLink>clienttemplates.js</d:JSLink>
    <d:PinnedToFiltersPane m:type="Edm.Boolean">false</d:PinnedToFiltersPane>
    <d:ReadOnlyField m:type="Edm.Boolean">true</d:ReadOnlyField>
    <d:Required m:type="Edm.Boolean">false</d:Required>
    <d:SchemaXml>&lt;Field ID="{34ad21eb-75bd-4544-8c73-0e08330291fe}" ReadOnly="TRUE" Type="Note" Name="_ModerationComments" DisplayName="Approver Comments" Hidden="TRUE" CanToggleHidden="TRUE" Filterable="FALSE" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="_ModerationComments" FromBaseType="TRUE" ColName="ntext1" /&gt;</d:SchemaXml>
    <d:Scope>/sites/SPConnect/Lists/OrderTasks</d:Scope>
    <d:Sealed m:type="Edm.Boolean">false</d:Sealed>
    <d:ShowInFiltersPane m:type="Edm.Int32">0</d:ShowInFiltersPane>
    <d:Sortable m:type="Edm.Boolean">false</d:Sortable>
    <d:StaticName>_ModerationComments</d:StaticName>
    <d:Title>Approver Comments</d:Title>
    <d:FieldTypeKind m:type="Edm.Int32">3</d:FieldTypeKind>
    <d:TypeAsString>Note</d:TypeAsString>
    <d:TypeDisplayName>Multiple lines of text</d:TypeDisplayName>
    <d:TypeShortDescription>Multiple lines of text</d:TypeShortDescription>
    <d:ValidationFormula m:null="true" />
    <d:ValidationMessage m:null="true" />
    <d:AllowHyperlink m:type="Edm.Boolean">false</d:AllowHyperlink>
    <d:AppendOnly m:type="Edm.Boolean">false</d:AppendOnly>
    <d:IsLongHyperlink m:type="Edm.Boolean">false</d:IsLongHyperlink>
    <d:NumberOfLines m:type="Edm.Int32">6</d:NumberOfLines>
    <d:RestrictedMode m:type="Edm.Boolean">true</d:RestrictedMode>
    <d:RichText m:type="Edm.Boolean">false</d:RichText>
    <d:UnlimitedLengthInDocumentLibrary m:type="Edm.Boolean">false</d:UnlimitedLengthInDocumentLibrary>
    <d:WikiLinking m:type="Edm.Boolean">false</d:WikiLinking>
</m:properties>

Your Answer

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

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