How to Get Last & First Item ID from SharePoint List in Power Automate?

Power Automate Get items action retrieves all the item information from a SharePoint list. It also allows you to filter items based on condition while retrieving items from the SharePoint list.

In this Power Automate tutorial, I will explain how to get last & first item ID from SharePoint list in Power Automate. Moreover, we will discuss how to get the last and first item IDs from a SharePoint custom column using Power Automate.

Get Last Item ID from SharePoint List in Power Automate

Let’s find out how to get the last item ID from a SharePoint ID column using Power Automate.

Here, I have used a SharePoint list named ‘Events’ with a few columns and data types.

Columns Data Types
IDNumber
Event Name(renamed Title column)Single line of text
Event DescriptionMultiple lines of text
Event Date & TimeSingle line of text
Event OrganizerPerson or Group
How to get last item ID from a SharePoint ID Column using Power Automate

Here, I want to retrieve the last item ID from a SharePoint list, so I have created a Power Automate cloud flow that will get triggered when an item is created or modified in a SharePoint List. Then, I want to reflect that last ID and details of that SharePoint item in an email.

The screenshot below shows the last item ID details of the SharePoint List in an email.

How to get last item ID from a SharePoint ID column in Power Automate
how to export SharePoint list to excel

To achieve this, follow the steps below.

1. Open the Power Automate home page in your browser, click on + Create -> Select the Automated cloud flow -> Enter the flow name and choose the trigger’s flow (When an item is created and modified)

  • In this trigger, provide the Site Address and List Name.
how to export SharePoint list in excel

2. To filter items based on condition while retrieving items from the SharePoint list, add the ‘Get items’ flow action and set the details

  • Site Address: Provide the SharePoint site address.
  • List Name: Select the SharePoint list.
Get last item ID from SharePoint in Power Automate

3. Next, to get the last item ID from a SharePoint list using the last function, add the ‘Compose’ flow action.

last(outputs('Get_items')?['body/value'])?['ID']

Where ID is the SharePoint in-built column.

how can i open a SharePoint list to excel

4. Add the ‘Send an email (V2)’ flow action and set all the details.

  • To: Give the user the email address to whom you want to send email.
  • Subject: Provide the purpose for sending this email.
  • Body: Here, I have given the Output of Compose action from dynamic content. To provide a Link to Item, we used an expression in Code view (</>) mode, as shown below.
<a href='@{items('Apply_to_each')?['{Link}']}'>Click Here</a>
How to get last item ID from SharePoint list in Power Automate

5. Now click on Save and Test. Test it Manually and click on Run flow. The Compose flow action will display the output based on the expression inserted in the Inputs of the Compose flow action, as shown below.

Get SharePoint last item ID from SharePoint custom ID column using Power Automate

This is how to get the last item ID from a SharePoint ID column using Power Automate.

Get Last Item ID from a SharePoint Custom Column using Power Automate

I will show how to get the last item ID from a SharePoint custom column using Power Automate.

For this, I have taken a SharePoint list named ‘Product Inventory’ with a few columns and their data types.

ColumnsData Types
Product NameSingle line of text
Product IDSingle line of text
Product BrandChoice
Product QuantityNumber
Product Manufacture DateDate and Time
Access to the resource is forbidden in excel

Example:

Suppose I have created a SharePoint list with a custom ID column. Now, I want to retrieve the last item ID from the SharePoint list and reflect the details of that SharePoint item in an email.

The screenshot below shows the ID of a SharePoint List, and the second image shows the ID we retrieved after the flow ran successfully in an email.

Get last SharePoint item ID from a SharePoint custom ID column using Power Automate
How to get the last item ID from a SharePoint custom column using Power Automate

To achieve this, follow the steps below.

1. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page; click on + Create -> Select the Automated cloud flow -> Provide the flow name and choose trigger’s flow (When an item is created and modified).

  • Provide the Site address and List Name for this trigger.
Get last item ID from SharePoint custom column in Power Automate

2. Add the Get itemsflow action to filter items based on condition while retrieving from the SharePoint list and setting the required fields.

  • Site Address: Provide the SharePoint site address.
  • List Name: Select the name of the SharePoint list.
How to get SharePoint last item ID using Power Automate

3. Next, add the ‘Compose’ flow action to retrieve the SharePoint last item ID, as shown below.

last(outputs('Get_items')?['body/value'])['ProductID']

Where Product ID is the SharePoint custom column for ID.

Get last item ID from SharePoint custom ID column using Power Automate

4. Add the ‘Send an email’ flow action to send the details of the SharePoint last item with the ID and set all the details.

  • To: Here, provide the user email address; I have given Modified By Email from dynamic content.
  • Subject: Give the purpose of this email.
  • Body: Select values from Dynamic content as shown below. To provide the Link to Item use an expression in Code view (</>) mode.
<a href='@{items('Apply_to_each')?['{Link}']}'>Click Here</a>
How to get last item ID from SharePoint custom column in Power Automate

5. Now, it’s time to Save and Test. Click on Test and test it Manually -> The Compose flow action will display the output based on the SharePoint custom column below.

Get last item ID from custom column of a SharePoint list in Power Automate

This is how to get the last item ID from a SharePoint custom column using Power Automate.

Get First Item ID from SharePoint List in Power Automate

Follow the instructions below to get the first item ID from a SharePoint ID column using Power Automate.

I have taken a SharePoint List named ‘Subscription Details’ with a few columns and their data types.

ColumnsData Types
IDNumber
Subscriber NameSingle line of text
Subscription Renewable DateDate and Time
Subscription Expire DateDate and Time
Subscription StatusChoice
Subscriber Email IDSingle line of text
Get first SharePoint item ID from SharePoint ID column in Power Automate

Example:

Suppose I want to retrieve the first item ID from a SharePoint list. So, I have created a Power Automate cloud flow that will be triggered when an item is created or modified in a SharePoint List.

The screenshot below shows the SharePoint List ID column, and the second image shows the first item ID that we retrieved after the flow ran successfully in an email.

Get first item ID from SharePoint ID column using Power Automate
How to get first item ID from SharePoint ID column using Power Automate

To achieve this, follow the steps below.

1. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page; click on + Create -> Select the Automated cloud flow -> Provide the flow name and choose trigger’s flow (When an item is created and modified).

  • Provide the Site Address and List Name for this trigger.
Get first item ID from SharePoint ID column in Power Automate

2. To filter items based on condition while retrieving from the SharePoint list, add the ‘Get items’ flow action and set the required fields.

  • Site Address: Provide the SharePoint site address.
  • List Name: Enter the name of the SharePoint List.
How to get first item ID from SharePoint ID column in Power Automate

3. Next, add the ‘Compose’ flow action to retrieve the SharePoint first item ID from the ID column and set the required fields.

first(outputs('Get_items')?['body/value'])?['ID']
Get SharePoint first item ID from SharePoint column using Power Automate

4. Then add the ‘Send an email(V2)’ to send the details of the SharePoint first item with the ID. Set all the required fields.

  • To: I gave the Subscriber Email ID from Dynamic Content [from SharePoint list].
  • Subject: Enter the purpose of this email.
  • Body: I have selected the Output of compose flow action from Dynamic content here. Also, to provide the Link to the Item, use an expression in Code view (</>) mode.
How to get SharePoint first item ID using Power Automate

5. Now, it’s time to Save and Test. Click on Test and test it Manually -> The Send an email(V2) flow action will display the output below.

How to create list in sharepoint

This is how to get the first item ID from a SharePoint ID column using Power Automate.

Get the First Item ID from a SharePoint Custom Column in Power Automate

Let’s find out how to get the first item ID from a SharePoint custom column using Power Automate.

For this, I have created a SharePoint list named ‘Project List’ with a few columns and their data type.

Columns Data Types
Project IDSingle line of text
Project Name (renamed title column)Single line of text
Project StatusChoice
Project Start DateDate and Time

Example:

I have created a SharePoint list with a custom ID column. Now, I want to retrieve the first item ID from the SharePoint list and include that information in an email.

Get First SharePoint Item ID from SharePoint Custom Column using Power Automate

The screenshot below shows the ID of a SharePoint List, and the second image shows the ID we retrieved after the flow ran successfully in an email.

How to get SharePoint first item ID from a SharePoint custom column using Power Automate
export SharePoint list to excel

To work around this, follow the steps below.

1. Open the Power Automate home page, click + Create -> Select the automated cloud flow -> Enter the flow name and choose the trigger’s flow (When an item is created and modified).

  • In this trigger, provide the Site Address and List Name.
Get first item ID from SharePoint custom column in Power Automate

2. Next, add the ‘Get items’ flow action to filter items based on condition while retrieving items from the SharePoint list. And set all the details.

  • Site Address: Provide the SharePoint site address.
  • List Name: Select the name of the SharePoint list.
How to add column in sharepoint list

3. Add the ‘Compose’ flow action to get the first item ID from a SharePoint list using the first function.

first(outputs('Get_items')?['body/value'])['ProjectID']

Where the ‘Project ID’ field is a string, and the data returned by outputs(‘Get_items’)? [‘body/value’] is an array of items, each with a ‘Project ID’ field.

Get first item ID from SharePoint List ID column using Power Automate

4. Add the ‘Send an email(V2)’ to send the details of the SharePoint last item with the ID. Set all the required fields.

  • To: Give the user an email address. I have given the Project Lead from Dynamic Content.
  • Subject: Provide the purpose of this email.
  • Body: I have selected the Output of compose flow action from Dynamic content here. Also, to provide the Link to the Item, use an expression in Code view (</>) mode.
Get SharePoint first item ID from SharePoint custom column in Power Automate

5. Now, click on Save and Test. Then test it Manually -> The Send an email(V2) flow action will display the output below.

Get SharePoint first item ID from SharePoint List ID column using Power Automate

This is how to get the first item ID from a SharePoint custom column using Power Automate.

Conclusion

I hope this Power Automate tutorial taught you how to get the last and first item ID from the SharePoint list using Power Automate.

Also, you may like some more Power Automate tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…