Hello!
I have this small piece of code that is the beginning of a bigger procedure:
procedure ImportItemPictureFromURL()
var
Item: Record Item;
Client: HttpClient;
Content: HttpContent;
Response: HttpResponseMessage;
InStr: InStream;
begin
if PictureURL = '' then
Error('Please enter a URL');
Client.Get(PictureURL, Response);
Response.Content.ReadAs(InStr);
Item.SetRange("No.", ItemNo);
The procedure was made to upload images via a URL to items in Business Central, and it works really well.
However, I have encountered an issue, and that is the fact that all the images are stored in a SharePoint environment, and the URL's also reflect that.
When making a Client.Get() to the SharePoint URL, I get a 403 FORBIDDEN response, which is expected I suppose.
My question is - how can I modify my code to make sure I am authorized and can do a Client.Get() call to the URL and get the image in response?