Table of Contents

Codeunit Uri

ID 3060
Namespace: System.Utilities

Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.

Remarks

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

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

Init

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

procedure Init(UriString: Text)

Parameters

Name Type Description
UriString Text

A string that identifies the resource to be represented by the Uri instance. Note that an IPv6 address in string form must be enclosed within brackets. For example, "http://[2607:f8b0:400d:c06::69]".

Remarks

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

GetAbsoluteUri

Gets the absolute URI.

procedure GetAbsoluteUri(): Text

Returns

Type Description
Text

A string containing the entire URI.

GetScheme

Gets the scheme name for the URI.

procedure GetScheme(): Text

Returns

Type Description
Text

A text that contains the scheme for this URI, converted to lowercase.

Remarks

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

GetHost

Gets the host name of the URI.

procedure GetHost(): Text

Returns

Type Description
Text

A text that contains the host name for this URI.

Remarks

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

GetAuthority

Gets the authority of the URI.

procedure GetAuthority(): Text

Returns

Type Description
Text

A text that contains the authority for this URI.

Remarks

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

GetPort

Gets the port number of the URI.

procedure GetPort(): Integer

Returns

Type Description
Integer

An integer that contains the port number for this URI.

Remarks

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

GetAbsolutePath

Gets the absolute path of the URI.

procedure GetAbsolutePath(): Text

Returns

Type Description
Text

A text that contains the absolute path for this URI.

Remarks

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

GetQuery

Gets any query information included in the specified URI.

procedure GetQuery(): Text

Returns

Type Description
Text

A text that contains the query information for this URI.

Remarks

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

GetFragment

Gets the escaped URI fragment.

procedure GetFragment(): Text

Returns

Type Description
Text

A text that contains the fragment portion for this URI.

Remarks

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

GetSegments

Gets a list containing the path segments that make up the specified URI.

procedure GetSegments(var Segments: List of [Text])

Parameters

Name Type Description
Segments List of [Text]

An out variable that contains the path segments that make up the specified URI.

Remarks

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

EscapeDataString

Converts a string to its escaped representation.

procedure EscapeDataString(TextToEscape: Text): Text

Parameters

Name Type Description
TextToEscape Text

Returns

Type Description
Text

A string that contains the escaped representation of TextToEscape::.

Remarks

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

UnescapeDataString

Converts a string to its unescaped representation.

procedure UnescapeDataString(TextToUnescape: Text): Text

Parameters

Name Type Description
TextToUnescape Text

Returns

Type Description
Text

A string that contains the unescaped representation of TextToUnescape::.

Remarks

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

IsValidUri

Checks if the provded string is a valid URI.

[TryFunction]
procedure IsValidUri(UriString: Text): Boolean

Parameters

Name Type Description
UriString Text

The string to check.

Returns

Type Description
Boolean

True if the provided string is a valid URI; otherwise - false.

IsWellFormedUriString

Indicates whether the string is well-formed by attempting to construct a URI with the string and ensures that the string does not require further escaping.

procedure IsWellFormedUriString(UriString: Text, UriKind: Enum UriKind): Boolean

Parameters

Name Type Description
UriString Text

The string used to attempt to construct a Uri.

UriKind Enum System.Utilities.UriKind

The type of the Uri in uriString.

Returns

Type Description
Boolean

True if the string was well-formed; otherwise, false.

Remarks

Visit https://learn.microsoft.com/en-us/dotnet/api/system.uri.iswellformeduristring for more information.

IsBaseOf

Determines whether the current Uri instance is a base of the specified Uri instance.

procedure IsBaseOf(var UriToTest: Codeunit Uri): Boolean

Parameters

Name Type Description
UriToTest Codeunit System.Utilities.Uri

The specified URI to test.

Returns

Type Description
Boolean

True if the current Uri instance is a base of uri; otherwise, false.

Remarks

Visit https://learn.microsoft.com/en-us/dotnet/api/system.uri.isbaseof for more information.

ValidateIntegrationURL

Validates integration URI host from setup table field is the same as the hardcoded integration URI host, returns the hardcoded integration URI if validation fails.

procedure ValidateIntegrationURL(FieldValueURL: Text, HardcodedIntegrationURL: Text): Text

Parameters

Name Type Description
FieldValueURL Text

The integration URL from the setup table field.

HardcodedIntegrationURL Text

The hardcoded integration URL to validate.

Returns

Type Description
Text

The integration URL from the setup table if it has the same host; otherwise, the provided integration URL.

AreURIsHaveSameHost

Verifies whether two URIs have the same host (e.g., both subdomain.example.com\test1 and subdomain.example.com\test2 have the same host subdomain.example.com).

procedure AreURIsHaveSameHost(UriString1: Text, UriString2: Text): Boolean

Parameters

Name Type Description
UriString1 Text

The first URI string.

UriString2 Text

The second URI string.

Returns

Type Description
Boolean

True if both URIs have the same host; otherwise, false.

IsValidURIPattern

Verifies whether the URI is in a valid pattern.

procedure IsValidURIPattern(UriString: Text, Pattern: Text): Boolean

Parameters

Name Type Description
UriString Text

The URI string to validate.

Pattern Text

The regular expression pattern to match against.

Returns

Type Description
Boolean

True if the URI string is in a valid pattern; otherwise, false.

See also