AnswerBun.com

SharePoint Online rest api to declare item as record

does SharePoint Online have a rest api to declare an item as a record?
I will use it in MS Flow

Thanks
Maurizio

SharePoint Asked by Maurizio on January 21, 2021

2 Answers

2 Answers

There is not a REST API to achieve it, as a workaround, we can create a Azure Function with CSOM(Microsoft.SharePoint.Client.RecordsRepository.Records namespace can help to declare/undeclare item as record) to achieve it.

Refer to: How to call SharePoint from Microsoft Flow with the help of an Azure Function

Or we can create a separate library with Automatic Declaration (under Record declaration settings) and copying there the documents, so they are automatically set as record.

Here is a discussion for your reference: SharePoint Action to 'Declare as Record'

Correct answer by LZ_MSFT on January 21, 2021

I know this is old but with SharePoint 2010 workflows going away, I thought someone else may need this. This is the same call that CSOM would make.

When a HTTP Request is received.

Schema:
{
    "type": "object",
    "properties": {
        "web": {
            "type": "string"
        },
        "list": {
            "type": "string"
        },
        "item": {
            "type": "integer"
        }
    }
}

Then Send an HTTP request to SharePoint.

Site Address: @{triggerBody()?['web']}
Method: POST
Uri: _api/contextinfo
Headers: 
    Accept: application/json; odata=nometadata

Then Send an HTTP request to SharePoint.

Site Address: @{triggerBody()?['web']}
Method: POST
Uri: _vti_bin/client.svc/ProcessQuery
Headers: 
    Content-Type: application/xml
    X-RequestDigest: @{body('Send_an_HTTP_request_to_SharePoint')?['FormDigestValue']}
Body: 
    <Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
      <Actions>
        <ObjectPath Id="2" ObjectPathId="1" />
        <ObjectPath Id="4" ObjectPathId="3" />
        <ObjectPath Id="6" ObjectPathId="5" />
        <ObjectPath Id="8" ObjectPathId="7" />
        <ObjectIdentityQuery Id="9" ObjectPathId="7" />
        <ObjectPath Id="11" ObjectPathId="10" />
        <StaticMethod TypeId="{ea8e1356-5910-4e69-bc05-d0c30ed657fc}" Name="DeclareItemAsRecord" Id="12">
          <Parameters>
            <Parameter ObjectPathId="10" />
          </Parameters>
        </StaticMethod>
      </Actions>
      <ObjectPaths>
        <StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
        <Property Id="3" ParentId="1" Name="Web" />
        <Property Id="5" ParentId="3" Name="Lists" />
        <Method Id="7" ParentId="5" Name="GetByTitle">
          <Parameters>
            <Parameter Type="String">@{triggerBody()?['list']}</Parameter>
          </Parameters>
        </Method>
        <Method Id="10" ParentId="7" Name="GetItemById">
          <Parameters>
            <Parameter Type="Int32">@{triggerBody()?['item']}</Parameter>
          </Parameters>
        </Method>
      </ObjectPaths>
    </Request>

Answered by benxford on January 21, 2021

Add your own answers!

Related Questions

Workflow task – How to set priority when assigning a task

1  Asked on December 28, 2021 by etho201

     

SharePoint 2010, how to change column width in list view

2  Asked on December 28, 2021 by j-osborn

     

Logical Architecture of SharePoint

1  Asked on December 26, 2021 by dasarp

   

Link Tracking Breaks Large List Views in Modern

2  Asked on December 26, 2021 by eliot-at-projectfive

       

Manipulate Filters in Javascript

1  Asked on December 24, 2021 by out-shire

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.