cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Partisan
Post Partisan

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
Highlighted

Re: Retrieving data from Library Fields

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

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"

Highlighted

Re: Retrieving data from Library Fields

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

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

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

 

Schema.png

Highlighted

Re: Retrieving data from Library Fields

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

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

Thanks @Pieter_Veenstra I'll give it a go 

Highlighted
Community Support
Community Support

Re: Retrieving data from Library Fields

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.

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

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? 
 

Highlighted

Re: Retrieving data from Library Fields

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.

 

 

 

 

 

 

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

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

Highlighted

Re: Retrieving data from Library Fields

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.

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

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'? 

Highlighted

Re: Retrieving data from Library Fields

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)

Highlighted
Post Partisan
Post Partisan

Re: Retrieving data from Library Fields

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...

Highlighted

Re: Retrieving data from Library Fields

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
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (5,640)