0

I have a mydata.txt file under SiteAssets whose contents are JSON (SharePoint prevented my use of a .json extension). I shared the file with Everyone. I can make a getJSON request with jQuery in the browser to access and read the file's contents. When I attempt to read the file's contents on the back end in SharePoint workflows using Call HTTP Web Service I get a 401.

I was careful to get context info as per: http://blog.appliedis.com/2014/10/09/sharepoint-designer-2013-workflow-working-with-web-services/

I should make the distinction that if I point the Call HTTP Web Service to some list I successfully get the contents of that list. It's only when I point the URL at a flat file that I get the Unauthorized exception so this seems to indicate some particulars with files access.

It made no difference whether I tried to read an .xml or .html file or relocate the file to a Documents library. Access was denied. I can't see as to why a flat file (one that gets periodically updated) couldn't be used as a valid source of information via a REST endpoint.

What am I missing? Why is this at all complicated?

1

Instead of pointing at /SiteAssets/mydata.txt I pointed at /_api/web/GetFolderByServerRelativeUrl('/SiteAssets')/Files('mydata.txt')/$value and used these headers:

 Accept: application/octet-stream
 Content-Type: application/octet-stream
 X-RequestDigest: <obtained in an earlier request>

I was then able to process the response (which I left as JSON) as a dictionary.

This resource helped:

https://msdn.microsoft.com/en-us/library/office/dn292553.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.