diff --git a/src/System Application/App/MicrosoftGraph/src/GraphClient.Codeunit.al b/src/System Application/App/MicrosoftGraph/src/GraphClient.Codeunit.al index a6bd7e9e73..e3afa0b693 100644 --- a/src/System Application/App/MicrosoftGraph/src/GraphClient.Codeunit.al +++ b/src/System Application/App/MicrosoftGraph/src/GraphClient.Codeunit.al @@ -112,6 +112,21 @@ codeunit 9350 "Graph Client" exit(GraphClientImpl.Patch(RelativeUriToResource, GraphOptionalParameters, RequestHttpContent, HttpResponseMessage)); end; + /// + /// Put any request to the microsoft graph API + /// + /// Does not require UI interaction. + /// A relativ uri including the resource segment + /// A wrapper for optional header and query parameters + /// The HttpContent object for the request. + /// The response message object. + /// True if the operation was successful; otherwise - false. + /// Authentication failed. + procedure Put(RelativeUriToResource: Text; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; RequestHttpContent: Codeunit "Http Content"; var HttpResponseMessage: Codeunit "Http Response Message"): Boolean + begin + exit(GraphClientImpl.Put(RelativeUriToResource, GraphOptionalParameters, RequestHttpContent, HttpResponseMessage)); + end; + /// /// Send a DELETE request to the microsoft graph API /// diff --git a/src/System Application/App/MicrosoftGraph/src/GraphClientImpl.Codeunit.al b/src/System Application/App/MicrosoftGraph/src/GraphClientImpl.Codeunit.al index 294865cbf0..c5bc81456f 100644 --- a/src/System Application/App/MicrosoftGraph/src/GraphClientImpl.Codeunit.al +++ b/src/System Application/App/MicrosoftGraph/src/GraphClientImpl.Codeunit.al @@ -79,6 +79,16 @@ codeunit 9351 "Graph Client Impl." exit(HttpResponseMessage.GetIsSuccessStatusCode()); end; + procedure Put(RelativeUriToResource: Text; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; RequestHttpContent: Codeunit "Http Content"; var HttpResponseMessage: Codeunit "Http Response Message"): Boolean + var + GraphUriBuilder: Codeunit "Graph Uri Builder"; + begin + GraphUriBuilder.Initialize(MicrosoftGraphBaseUrl, GraphAPIVersion, RelativeUriToResource, GraphOptionalParameters.GetQueryParameters()); + GraphRequestHelper.SetRestClient(RestClient); + HttpResponseMessage := GraphRequestHelper.Put(GraphUriBuilder, GraphOptionalParameters, RequestHttpContent); + exit(HttpResponseMessage.GetIsSuccessStatusCode()); + end; + procedure Delete(RelativeUriToResource: Text; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; var HttpResponseMessage: Codeunit "Http Response Message"): Boolean var GraphUriBuilder: Codeunit "Graph Uri Builder"; diff --git a/src/System Application/App/MicrosoftGraph/src/helper/GraphRequestHelper.Codeunit.al b/src/System Application/App/MicrosoftGraph/src/helper/GraphRequestHelper.Codeunit.al index edae59b73e..d4a137f238 100644 --- a/src/System Application/App/MicrosoftGraph/src/helper/GraphRequestHelper.Codeunit.al +++ b/src/System Application/App/MicrosoftGraph/src/helper/GraphRequestHelper.Codeunit.al @@ -36,6 +36,11 @@ codeunit 9354 "Graph Request Helper" HttpResponseMessage := SendRequest(Enum::"Http Method"::PATCH, GraphUriBuilder, GraphOptionalParameters, HttpContent); end; + procedure Put(GraphUriBuilder: Codeunit "Graph Uri Builder"; GraphOptionalParameters: Codeunit "Graph Optional Parameters"; HttpContent: Codeunit "Http Content") HttpResponseMessage: Codeunit "Http Response Message" + begin + HttpResponseMessage := SendRequest(Enum::"Http Method"::PUT, GraphUriBuilder, GraphOptionalParameters, HttpContent); + end; + procedure Delete(GraphUriBuilder: Codeunit "Graph Uri Builder"; GraphOptionalParameters: Codeunit "Graph Optional Parameters") HttpResponseMessage: Codeunit "Http Response Message" begin PrepareRestClient(GraphOptionalParameters);