cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OliverR-82
Helper V
Helper V

How to get previous Content Type from a SharePoint list item

Hello again, wonderful community.

For a flow I'm building I need to check if the Content Type of a SharePoint list item has changed. The "Get Changes for an item or a file" action does not seem to include the Content Type of an item, so it looks like I can't use that action.

I'm trying to work around this using an HTTP action to retrieve the version history for the item, but I'm not making much progress 😞

This is what I've got so far:

OliverR-82_0-1610537778392.png

 

I parse the JSON using the scheme that I get from the output of the 'GetVersions' action. I think that is correct so far. However, I'm struggling with the next step which is going through all the data. Obviously, I need an Apply to each for this, but the problem is I don't know what to "feed" it.

OliverR-82_1-1610537402172.png

From what I understand I should be able to choose "results" but the problem is I get multiple entries and none of them are the right one; all the "results" entries that show up are related to multi-choice or multi-people picker fields in the item. This is not giving me the expected result.

Can someone please assist? If there is an easier way to check if the content type changed, then that would be even better.

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @OliverR-82,

 

You can avoid the apply to each by using the following expression.

 

This will get you the ContentTypeId value from the last version [0]. If you want to compare it with the version before that just change the [0] to [1].

body('Parse_JSON')?['d']?['results']?[0]?['ContentTypeId']['StringValue']

 

View solution in original post

2 REPLIES 2
Expiscornovus
Dual Super User
Dual Super User

Hi @OliverR-82,

 

You can avoid the apply to each by using the following expression.

 

This will get you the ContentTypeId value from the last version [0]. If you want to compare it with the version before that just change the [0] to [1].

body('Parse_JSON')?['d']?['results']?[0]?['ContentTypeId']['StringValue']

 

Hi @Expiscornovus ,

That works like a charm.

You're a lifesaver. This is the third time that you've helped me with a Flow problem in the past week, I can't thank you enough! 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,209)