I've already tried to connect Business Central with Sharepoint using Postman, and both the GET and POST operations were successful. I'm currently attempting to do it on BC, but while the token has been created, it isn't functioning. I believe there may be a connection issue or a URL issue.
procedure HttpGet(AccessToken: Text; Url: Text /*var JResponse: JsonObject*/): Boolean
var
Client: HttpClient;
Headers: HttpHeaders;
RequestMessage: HttpRequestMessage;
ResponseMessage: HttpResponseMessage;
RequestContent: HttpContent;
ResponseText: Text;
IsSucces: Boolean;
begin
Headers := Client.DefaultRequestHeaders();
Headers.Add('Authorization', StrSubstNo('Bearer %1', AccessToken));
Headers.Add('Accept', 'application/json;odata=verbose');
RequestMessage.Content.GetHeaders(Headers); //asd
Headers.Remove('Content-Type');
Headers.Add('Content-Type', 'application/json;odata=verbose');
RequestMessage.SetRequestUri(Url);
RequestMessage.Method := 'GET';
if Client.Send(RequestMessage, ResponseMessage) then
if ResponseMessage.IsSuccessStatusCode() then begin
if ResponseMessage.Content.ReadAs(ResponseText) then
IsSucces := true;
// end else// ResponseMessage.Content.ReadAs(ResponseText);// JResponse.ReadFrom(ResponseText);exit(IsSucces);
end;
end;
This below link may help you:
https://www.msnjournals.com/post/how-to-connect-sharepoint-with-business-central