Table of Contents

Codeunit "Uri Builder"

ID 3061
Namespace: System.Utilities

Provides a custom constructor for uniform resource identifiers (URIs) and modifies URIs for the Uri codeunit.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder for more information.

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

Init

Initializes a new instance of the UriBuilder class with the specified URI.

procedure Init(Uri: Text)

Parameters

Name Type Description
Uri Text

A URI string.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.-ctor#System_UriBuilder__ctor_System_String_ for more information.

SetScheme

Sets the scheme name of the URI.

procedure SetScheme(Scheme: Text)

Parameters

Name Type Description
Scheme Text

A string that represents the scheme name to set.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.scheme for more information.

GetScheme

Gets the scheme name of the URI.

procedure GetScheme(): Text

Returns

Type Description
Text

The scheme name of the URI.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.scheme for more information.

SetHost

Sets the host name of the URI.

procedure SetHost(Host: Text)

Parameters

Name Type Description
Host Text

A string that represents the host name to set.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.host for more information.

GetHost

Gets the host name of the URI.

procedure GetHost(): Text

Returns

Type Description
Text

The host name of the URI.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.host for more information.

SetPort

Sets the port number of the URI.

procedure SetPort(Port: Integer)

Parameters

Name Type Description
Port Integer

An integer that represents the port number to set.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.port for more information.

GetPort

Gets the port number of the URI.

procedure GetPort(): Integer

Returns

Type Description
Integer

The port number of the URI.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.port for more information.

SetPath

Sets the path to the resource referenced by the URI.

procedure SetPath(Path: Text)

Parameters

Name Type Description
Path Text

A string that represents the path to set.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.path for more information.

GetPath

Gets the path to the resource referenced by the URI.

procedure GetPath(): Text

Returns

Type Description
Text

The path to the resource referenced by the URI.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.path for more information.

SetQuery

Sets any query information included in the URI.

procedure SetQuery(Query: Text)

Parameters

Name Type Description
Query Text

A string that represents the query information to set.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.query for more information.

GetQuery

Gets the query information included in the URI.

procedure GetQuery(): Text

Returns

Type Description
Text

The query information included in the URI.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.query for more information.

SetFragment

Sets the fragment portion of the URI.

procedure SetFragment(Fragment: Text)

Parameters

Name Type Description
Fragment Text

A string that represents the fragment portion to set.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.fragment for more information.

GetFragment

Gets the fragment portion of the URI.

procedure GetFragment(): Text

Returns

Type Description
Text

The fragment portion of the URI.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.fragment for more information.

GetUri

Gets the Uri instance constructed by the specified "Uri Builder" instance.

procedure GetUri(var Uri: Codeunit Uri)

Parameters

Name Type Description
Uri System.Utilities.Uri

A Uri that contains the URI constructed by the Uri Builder.

Remarks

Visit https://learn.microsoft.com/dotnet/api/system.uribuilder.uri for more information.

AddQueryFlag

Adds a flag to the query string of this UriBuilder. In case the same query flag exists already, the action in DuplicateAction is taken.

procedure AddQueryFlag(Flag: Text, DuplicateAction: Enum "Uri Query Duplicate Behaviour")

Parameters

Name Type Description
Flag Text

A flag to add to the query string of this UriBuilder. This value will be encoded before being added to the URI query string. Cannot be empty.

DuplicateAction System.Utilities."Uri Query Duplicate Behaviour"

Specifies which action to take if the flag already exist.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso", the result could be "https://microsoft.com?john=doe&foo=bar&contoso".

AddQueryFlag

Adds a flag to the query string of this UriBuilder. In case the same query flag exists already, only one occurrence is kept.

procedure AddQueryFlag(Flag: Text)

Parameters

Name Type Description
Flag Text

A flag to add to the query string of this UriBuilder. This value will be encoded before being added to the URI query string. Cannot be empty.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso", the result could be "https://microsoft.com?john=doe&foo=bar&contoso".

AddQueryParameter

Adds a parameter key-value pair to the query string of this UriBuilder (in the form ParameterKey=ParameterValue). In case the same query key exists already, the action in DuplicateAction is taken.

procedure AddQueryParameter(ParameterKey: Text, ParameterValue: Text, DuplicateAction: Enum "Uri Query Duplicate Behaviour")

Parameters

Name Type Description
ParameterKey Text

The key for the new query parameter. This value will be encoded before being added to the URI query string. Cannot be empty.

ParameterValue Text

The value for the new query parameter. This value will be encoded before being added to the URI query string. Can be empty.

DuplicateAction System.Utilities."Uri Query Duplicate Behaviour"

Specifies which action to take if the ParameterKey specified already exist.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso=42", the result could be "https://microsoft.com?john=doe&foo=bar&contoso=42".

AddQueryParameter

Adds a parameter key-value pair to the query string of this UriBuilder (in the form ParameterKey=ParameterValue). In case the same query key exists already, its value is overwritten.

procedure AddQueryParameter(ParameterKey: Text, ParameterValue: Text)

Parameters

Name Type Description
ParameterKey Text

The key for the new query parameter. This value will be encoded before being added to the URI query string. Cannot be empty.

ParameterValue Text

The value for the new query parameter. This value will be encoded before being added to the URI query string. Can be empty.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso=42", the result could be "https://microsoft.com?john=doe&foo=bar&contoso=42".

AddODataQueryParameter

Adds an OData parameter key-value pair to the query string of this UriBuilder (in the form ParameterKey=ParameterValue), preserving the "$" sign in unencoded form. In case the same query key exists already, its value is overwritten.

procedure AddODataQueryParameter(ParameterKey: Text, ParameterValue: Text)

Parameters

Name Type Description
ParameterKey Text

The key for the new query parameter. This value will be encoded before being added to the URI query string, except for any "$" sign. Cannot be empty.

ParameterValue Text

The value for the new query parameter. This value will be encoded before being added to the URI query string. Can be empty.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso=42", the result could be "https://microsoft.com?john=doe&foo=bar&contoso=42".

RemoveQueryFlag

Removes a flag from the query string of this UriBuilder. In case the same query flag exists already, the action in DuplicateAction is taken.

procedure RemoveQueryFlag(Flag: Text, DuplicateAction: Enum "Uri Query Duplicate Behaviour")

Parameters

Name Type Description
Flag Text

A flag to Remove from the query string of this UriBuilder. This value will be encoded before being Removed to the URI query string. Cannot be empty.

DuplicateAction System.Utilities."Uri Query Duplicate Behaviour"

Specifies which action to take if the flag specified already exist.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso", the result could be "https://microsoft.com?john=doe&foo=bar&contoso".

RemoveQueryFlag

Removes a flag from the query string of this UriBuilder. In case the same query flag exists already, only one occurrence is kept.

procedure RemoveQueryFlag(Flag: Text)

Parameters

Name Type Description
Flag Text

A flag to Remove from the query string of this UriBuilder. This value will be encoded before being Removed to the URI query string. Cannot be empty.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso", the result could be "https://microsoft.com?john=doe&foo=bar&contoso".

RemoveQueryParameter

Removes a parameter key-value pair from the query string of this UriBuilder (in the form ParameterKey=ParameterValue). In case the same query key exists already, the action in DuplicateAction is taken.

procedure RemoveQueryParameter(ParameterKey: Text, ParameterValue: Text, DuplicateAction: Enum "Uri Query Duplicate Behaviour")

Parameters

Name Type Description
ParameterKey Text

The key for the new query parameter. This value will be encoded before being Removed to the URI query string. Cannot be empty.

ParameterValue Text

The value for the new query parameter. This value will be encoded before being Removed to the URI query string. Can be empty.

DuplicateAction System.Utilities."Uri Query Duplicate Behaviour"

Specifies which action to take if the ParameterKey specified already exist.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso=42", the result could be "https://microsoft.com?john=doe&foo=bar&contoso=42".

RemoveQueryParameter

Removes a parameter key-value pair from the query string of this UriBuilder (in the form ParameterKey=ParameterValue). In case the same query key exists already, its value is overwritten.

procedure RemoveQueryParameter(ParameterKey: Text, ParameterValue: Text)

Parameters

Name Type Description
ParameterKey Text

The key for the new query parameter. This value will be encoded before being Removed to the URI query string. Cannot be empty.

ParameterValue Text

The value for the new query parameter. This value will be encoded before being Removed to the URI query string. Can be empty.

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso=42", the result could be "https://microsoft.com?john=doe&foo=bar&contoso=42".

RemoveQueryParameters

Removes a parameter key-value pair from the query string of this UriBuilder (in the form ParameterKey=ParameterValue). In case the same query key exists already, the action in DuplicateAction is taken.

procedure RemoveQueryParameters()

Remarks

This function could alter the order of the existing query string parts. For example, if the previous URL was "https://microsoft.com?foo=bar&john=doe" and the new flag is "contoso=42", the result could be "https://microsoft.com?john=doe&foo=bar&contoso=42".

GetQueryFlags

Gets the flags in the query string of this UriBuilder.

procedure GetQueryFlags(): List of [Text]

Returns

Type Description
List of [Text]

A list of flags in the query string of this UriBuilder.

GetQueryParameters

Gets the parameters in the query string of this UriBuilder.

procedure GetQueryParameters(): Dictionary of [Text, List of [Text]]

Returns

Type Description
Dictionary of [Text, List of [Text]]

A dictionary of parameters in the query string of this UriBuilder.

GetQueryParameter

Gets the value of the specified query parameter.

procedure GetQueryParameter(ParameterKey: Text): List of [Text]

Parameters

Name Type Description
ParameterKey Text

The key of the query parameter to get the value of.

Returns

Type Description
List of [Text]

The value of the specified query parameter.

See also