I’m trying to use the StoreURLtoFileDocument (for the first time here), but am receiving an error. For the three parameters, I’ve entered the URL of the web document (i.e., file stored on OneDrive), a variable object of type System File (ie., ExcelImporter.TemplateDocument) and finally, the name of the file if downloaded via a browser. (This is an XLS file). I’m receiving the following: A problem occurred while reading from URL https://my.sharepoint.com/:x:/p/john/EaRnkj7NoaRMqjmpt2_6kMIBtKD9W-rC3ZshdS0IzdQ4ZA?e=TrT41M: Server returned HTTP response code: 403 for URL: https://my.sharepoint.com/personal/john_com/_layouts/15/doc2.aspx?sourcedoc=%7B3e9267a4-a1cd-4ca4-aa39-a9b76ffa90c2%7D&action=default&slrid=829dbf9f-4058-b000-eb72-83b8b5a28f0b&originalPath=aHR0cXM6Ly96aW1tZm9yLN15LnNoYXJlcG9pbnQuY29tLzp4Oi9wL3J5YW4vRWFSbmtqN05vYVJNcWptcHQyXzZrTUlCdEtEOVctckMzWnNoZFMwSXpkUTRaQT9ydGltZT1HSFJZaTg4QzJVZw&cid=65f5130e-1ecf-43af-ba24-97b5e5f8e588 Any ideas as to what I’m doing wrong here? Studio Pro Version 9.0.5
A 403 code is a Forbidden error, so it looks like your Mendix app doesn’t have permission to access the SharePoint URL.
I’m guessing that this is a protected resource so you need to login or authenticate somehow first?
Thanks for the response Robert. What I don’t understand is that the URL (as entered as the first argument to the function) is working perfectly when entered on a browser address bar. I.e., the file opens up as expected – without any prompting for an authentication.
My understanding is that the StoreURLtoFileDocument allows one to open a URL file (such as a OneDrive document), like I would through an Open File Dialog in Windows (aka FileDocument). So there’s two other arguments, besides the URL, for StoreURLtoFileDocument: 2) Document – which I understand to be the object in Mendix which will reference the file (like the target of the selected file for the Open File Dialog), and 3) the Filename – this one I’m not sure what (the purpose of) it is…
Is an actual copy of the URL “file” downloaded and saved locally, or is this just into the application – FileDocument?