cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
darrenfloyd666
Post Prodigy
Post Prodigy

Retrieving data from Library Fields

Hi 

 

@Pieter_Veenstraand @v-yuazh-msft excuse the tagging but I'm reaching out to you as I see you've helped solve a similar problem to one I've got.

 

I'm building a Scheduled Flow which will check the date in a Library field called 'Expiry Date' and will fire off an email alert when it comes within a certain date range. Fine, but I can't get the Flow to find the 'Expiry Date' field. I'm pointing the Flow at a View of the library containing the field but I wouldn't think that would cause a problem.

 

From a previous post I tried using the 'Send an HTTP request to SharePoint' action but I've never used it before. 

 

Here's how I've got it configured, but I'm getting a 401 UNATHORIZED error when I run the Flow although I've give the account full permissions on the site and the library? Any ideas on how I solve that and also when I get it working what's the next steps for capturing and using the 'Expiry Date' field?

Thanks in advance.

 

SendanHTTP request.png

15 REPLIES 15

Thanks @Pieter_Veenstra That's really helpful. I've looked through your posts and I think I'm edging in the right direction. The flow is running, but I'm not getting the Output option on the Compose action but it does pop up in an email action straight after?

Also this will return the filed I want in a Library not a List?


API.png


This is some of the Output I get which seems to be picking up the right library, so I need to get the 'Expiry Date' field out of this...?

2fabf0190155;637158955026270000;112954065"},"DefaultContentApprovalWorkflowId":"00000000-0000-0000-0000-000000000000","DefaultItemOpenUseListSetting":false,"Description":"","Direction":"none","DisableGridEditing":false,"DocumentTemplateUrl":"/sites/ /Supplier Certificates/Forms/template.dotx","DraftVersionVisibility":0,"EnableAttachments":false,"EnableFolderCreation":true,"EnableMinorVersions":false,"EnableModeration":false,"EnableRequestSignOff":true,"EnableVersioning":true,"EntityTypeName":"Supplier_x0020_Certificates"

@darrenfloyd666  you might want to run the output through a parse json action. That way you can get to the data through dynamic content

Thanks @Pieter_Veenstra would I parse the entire output? There was a lot of it: 

 

Schema.png

I would optimize only at a later stage. So in short yes, I would do all sin the beginning.

Thanks @Pieter_Veenstra I'll give it a go 

v-alzhan-msft
Community Support
Community Support

Hi @darrenfloyd666 ,

 

Please take a try with @Pieter_Veenstra 's suggestion and let me know if your problem could be solved.

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Pieter_Veenstra @v-alzhan-msft 

That didn't work

JSONQuery.png

When I click on the Condition Value I get this:

DynamicContent.png
And from the 'Send a HTTP' action I just get 'Body' but not getting the 'Expiry Date' field I need from the SP Library. It doesn't seem to be finding any of the fields on that Library. Any ideas? 
 

Hi @darrenfloyd666 ,

 

It looks like your are collecting the libraries rather than an item in a library.

 

I would expect that the URI in your http call would look like this:

 

_api/web/lists/getByTitle('WhateverListOrLibrary')/items(123)

 

123 being the id of the field. You can of course use Dynamic content  for the ID.

 

You might want to open the follo0wing urls in your browser and check that you get data back. ( update urls and the listname and the item id)

 

https://mysite.sharepoint.com/sites/anysite/_api/web/lists/getByTitle('WhateverListOrLibrary')/items...)

or 

https://mysite.sharepoint.com/_api/web/lists/getByTitle('WhateverListOrLibrary')/items(123)

 

Once you get data then try using that url in your flow.

 

 

 

 

 

 

Thanks @Pieter_Veenstra 

 

 

I've got the Send HTTP action written like this: 

SENDREQUEST.png

 

I understand what you're saying, that it's bringing back the library and not the columns in  the library.

 

I think I've found the ID of the column which is  ID="{02636507-xxx-a9f3-a05a1c9c201c}" I change the Uri to:

_api/web/lists/getbytitle('Supplier%20Certificates')/items(02636507-xxx-a9f3-a05a1c9c201c) I get 'Bad Request' at that action when I run the Flow, Am I going wrong with the item/column ID? I tried the URLS you posted and didn't get anything back. Thanks for your help BTW

This is my URLSite.png

The item should be something like a small number. It is the ID field on your library. So if you add the ID column to your SharePoint view. Then find the ID of one of your documents. Then use that then you should get data back.

Cheers. I picked an ID for one of the items and wrote in the Uri:

_api/web/lists/getbytitle('Supplier%20Certificates')/items(189)

 

and still the only thing that Send a HTTP brings back is 'Body'? 

Do you get any data returned if you do that in the browser

 

https://xyz.sharepoint.com/_api/web/lists/getbytitle('Supplier%20Certificates')/items(189)

I get a text file which does contain this:

 

...pe="Edm.DateTime">2019-10-09T15:00:00Z</d:Expiry_x0020_Date><d:Supplier_x0020_NameId m:type="Edm...

You might want to try to just query the json then as described in my post below:

https://sharepains.com/2019/09/16/query-json-in-microsoft-flow/

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,285)