Share via


Application.IsDestinationReachable Method

Gets a value indicating whether a connection can be made to the destination computer using the specified Uniform Resource Locator (URL), universal naming convention (UNC) path, or IP address.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
'Usage

Parameters

  • destination
    Specifies the location to check for network connectivity as an IP address, UNC path, or URLs.

Return Value

true if a connection can be made to the specified URL, UNC, or IP address; otherwise, false.

Exceptions

Exception type Condition

FileNotFoundException

The location of the destination cannot be found.

ArgumentNullException

The parameter passed to this method is null.

ArgumentException

The parameter passed to this method isnot valid. For example, it is of the wrong type or format.

Remarks

The value specified for destination must be either a UNC path that includes a server name and a share name, such as @"\\MyServer\MyShare", or a URL that begins with one of the following protocol identifiers: http, https, or file.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

This type or member can be accessed only from code running in forms opened in Microsoft Office InfoPath 2007.

Example

In the following example, clicking the Button control displays whether a connection can be made to the specified URL.

public void CTRL1_Clicked(object sender, ClickedEventArgs e)
{
   string result = this.Application.IsDestinationReachable(
      "https://www.microsoft.com").ToString();
   MessageBox.Show(result);
}
Public Sub CTRL1_Clicked(ByVal sender As Object, _
   ByVal e As ClickedEventArgs)
   result As String = Me.Application.IsDestinationReachable( _
      "https://www.microsoft.com").ToString()
   MessageBox.Show(result)
End Sub

See Also

Reference

Application Class
Application Members
Microsoft.Office.InfoPath Namespace