Codeunit "Graph Client"
Exposes functionality to query Microsoft Graph Api
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
Initialize
Initializes Microsoft Graph client.
procedure Initialize(GraphAPIVersion: Enum "Graph API Version", GraphAuthorizationInstance: Interface "Graph Authorization")
Parameters
| Name | Type | Description |
|---|---|---|
| GraphAPIVersion | Enum System.Integration.Graph."Graph API Version" |
API Version to use. |
| GraphAuthorizationInstance | Interface System.Integration.Graph.Authorization."Graph Authorization" |
The authorization to use. |
Remarks
Should be called before any GET,PATCH,POST,DELTE request
Initialize
Initializes Microsoft Graph client.
procedure Initialize(GraphAPIVersion: Enum "Graph API Version", GraphAuthorizationInstance: Interface "Graph Authorization", HttpClientHandlerInstance: Interface "Http Client Handler")
Parameters
| Name | Type | Description |
|---|---|---|
| GraphAPIVersion | Enum System.Integration.Graph."Graph API Version" |
API Version to use. |
| GraphAuthorizationInstance | Interface System.Integration.Graph.Authorization."Graph Authorization" |
The authorization to use. |
| HttpClientHandlerInstance | Interface System.RestClient."Http Client Handler" |
The authorization to use. |
Remarks
Should be called before any GET,PATCH,POST,DELTE request
SetBaseUrl
The base URL to use when constructing the final request URI. If not set, the base URL is https://graph.microsoft.com .
procedure SetBaseUrl(BaseUrl: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| BaseUrl | Text |
A valid URL string |
Remarks
It's optional to set the BaseUrl.
Get
Get any request to the microsoft graph API
procedure Get(RelativeUriToResource: Text, var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relativ uri including the resource segments |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
Get
Get any request to the microsoft graph API
procedure Get(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relativ uri including the resource segment |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
Post
Post any request to the microsoft graph API
procedure Post(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", RequestHttpContent: Codeunit "Http Content", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relativ uri including the resource segment |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| RequestHttpContent | Codeunit System.RestClient."Http Content" |
The HttpContent object for the request. |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
Patch
Patch any request to the microsoft graph API
procedure Patch(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", RequestHttpContent: Codeunit "Http Content", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relativ uri including the resource segment |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| RequestHttpContent | Codeunit System.RestClient."Http Content" |
The HttpContent object for the request. |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
Put
Put any request to the microsoft graph API
procedure Put(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", RequestHttpContent: Codeunit "Http Content", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relativ uri including the resource segment |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| RequestHttpContent | Codeunit System.RestClient."Http Content" |
The HttpContent object for the request. |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
Delete
Send a DELETE request to the microsoft graph API
procedure Delete(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relativ uri to the resource - e.g. /users/{id|userPrincipalName}. |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
GetWithPagination
Get any request to the microsoft graph API with pagination support
procedure GetWithPagination(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", var GraphPaginationData: Codeunit "Graph Pagination Data", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relative uri including the resource segments |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| GraphPaginationData | Codeunit System.Integration.Graph."Graph Pagination Data" |
The pagination data object to track pagination state |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction. This method handles pagination automatically.
GetNextPage
Get the next page of results using pagination data
procedure GetNextPage(var GraphPaginationData: Codeunit "Graph Pagination Data", var HttpResponseMessage: Codeunit "Http Response Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| GraphPaginationData | Codeunit System.Integration.Graph."Graph Pagination Data" |
The pagination data object containing the next link |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The response message object. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction.
GetAllPages
Get all pages of results automatically
procedure GetAllPages(RelativeUriToResource: Text, GraphOptionalParameters: Codeunit "Graph Optional Parameters", var HttpResponseMessage: Codeunit "Http Response Message", var JsonResults: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| RelativeUriToResource | Text |
A relative uri including the resource segments |
| GraphOptionalParameters | Codeunit System.Integration.Graph."Graph Optional Parameters" |
A wrapper for optional header and query parameters |
| HttpResponseMessage | Codeunit System.RestClient."Http Response Message" |
The last response message object. |
| JsonResults | JsonArray |
A JSON array containing all results from all pages |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the operation was successful; otherwise - false. |
Remarks
Does not require UI interaction. This method fetches all pages automatically and returns the combined results.