Creating SharePoint List with columns and content types using Power Automate Flow

 Rest API Uri:

https://gitbrent.github.io/SpRestLib/blog/2018/04/20/create-sharepoint-list-columns-using-rest.html

Create SharePoint List:

site address: Enter URL
method: Post
URi: /_api/web/lists
headers:

Accept:application/json;odata=verbose

Content-Type:application/json;odata=verbose

Body:

{

  "__metadata": {"type": "SP.List"},

  "AllowContentTypes": true,

  "BaseTemplate": 100,

 "Description": "Admin configuration list",

 "Title": "AdminConfigList"

}

--------------------------------------------------------------------------------------

Multi line text field:

create a multiline text column:

Site URL: Target Site

URi: _api/lists/getbytitle('CI_CompanyNews')/fields

Type: POST

Body:

{

    '__metadata': {'type':'SP.Field', 'addToDefaultView': 'true' },

    'FieldTypeKind': 3,

    'Title': 'Blurb'

}

Headers: 

Accept:application/json;odata=verbose

Content-Type:application/json;odata=verbose


add to view

Uri: _api/web/lists/GetByTitle('CI_CompanyNews')/views/getbytitle('All Items')/ViewFields/AddViewField('bylineDate')

-------------------------------------------------

Date&Time column:

BODY:

{

    '__metadata': {'type':'SP.FieldDateTime', 'addToDefaultView': 'true' },

    'FieldTypeKind': 4,

    'Title': 'bylineDate',

    'DisplayFormat': 0

}

--------------------------------------------

Yes/No type column

BODY:

{

    '__metadata': {'type':'SP.Field', 'addToDefaultView': 'true' },

    'FieldTypeKind': 8,

    'Title': 'Deprecated'

}

--------------------------------------------

Hyperlink or Picture column

{

    '__metadata': {'type':'SP.Field' },

    'FieldTypeKind': 11,

    'Title': 'Logo'

}

--------------------------------------------

Choice:

{ '__metadata':

    { 'type': 'SP.FieldChoice' },

    'Title': 'PreferredSentNotification',

    'FieldTypeKind': 6,

    'Required': 'true',

    'Choices': { 'results': ['email', 'Teams notification', 'Push notification' ] }

}

------------------------------------------

Comments