ValidateModel Method  
 

The ValidateModel method validates that a model name is recognized or supported by the current provider.

Syntax

object.ValidateModel( ModelName )

Parameters

ModelName
A string which specifies the name of the model to validate. This parameter must be provided and cannot be an empty string.

Return Value

A value of True is returned if the method succeeds. If the method fails, it will return False and the LastError property will contain the error code.

Remarks

The ValidateModel method verifies that a model name appears to be valid for the current provider. Validation may be performed using locally available information or by querying the provider for a list of supported models. If the provider supports returning model information, this method may perform a lookup to confirm that the specified model name is recognized. This may require a network request and can cause the method to block while the model list is retrieved.

If the provider does not support returning model information, the method only performs basic validation of the model name. For example, it will check the name to ensure it does not contain any illegal characters and uses a format that is common for most service providers. This method is most commonly used to validate user input.

A return value of True from this method only indicates that the model name is syntactically valid. It does not guarantee that the selected service provider will accept or allow the model to be used. A provider may reject a valid model name for several reasons, including the model being unavailable for the current account, restricted to specific subscription tiers, region-limited, deprecated, disabled by administrative policy, or not supported by the endpoint being used. Providers may also change model availability over time without notice. Applications should be prepared to handle errors returned when establishing a connection or sending a request, even if the model name was validated successfully.

See Also

ModelName Property, GetFirstModel Method, GetNextModel Method