cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Netrelemo
Helper III
Helper III

How to read a file in a SharePoint site with OData and a federated login?

I've got a powerBI model created for me by someone else. It works just fine, and seems to have a OData connection to the complete SharePoint online (Tenancy?) sites with a federated login cookie etc. 

I want to modify it to read a specific file in one of those online SharePoint sites, but I can't work out the OData parameters. 

Haven't had much luck with the documentation eaither. 

 

I'm hoping to establish a connection, and get a list of available files in the site. 

From a working model

= OData.Feed("https://" & Domain & #"Search Site URL" & "/_api/search/query?querytext='ContentClass:STS_Site "&#"Site Path Filter"&"'&trimduplicates=false&rowlimit="&Text.From(ResultsPerPage)&"&rowsperpage="&Text.From(ResultsPerPage)&"", null, [Headers=[Cookie="FedAuth="&getFedAuthCookieValue()&""],Implementation="2.0"])

 

My hack:

let
     yooarl = "https://xxxxxxxx/_api/search/query",
    Source = (yooarl & "?querytext='ContentClass:STS_Site "&"xxxxxxxxxxxxxxxxxxxxx"& "'&trimduplicates=false&rowlimit=1"& "&rowsperpage=1"),

    SSource = OData.Feed(Source , [Headers=[Cookie="FedAuth="&getFedAuthCookieValue()&""],Implementation="2.0"])

 

 

Which just produces

Expression.Error: OData: The header with name 'Headers' has a value type 'Record' that is invalid. Only DateTime, Logical, Number, and Text are supported.

 

Any pointers? 

2 REPLIES 2

I forgot to mention that it's a federated login environment. 

These options don;t work

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!