OPC Studio User's Guide and Reference
Delete Method (IEasyUAFileTransfer)



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.FileTransfer Namespace > IEasyUAFileTransfer Interface : Delete Method
Endpoint descriptor. Identifies the OPC-UA server.
Node descriptor of the OPC UA directory.
A node descriptor of the file or directory to delete.
Deletes an OPC UA file or directory, organized under an existing directory.
Syntax
'Usage
 
Dim instance As IEasyUAFileTransfer
Dim endpointDescriptor As UAEndpointDescriptor
Dim directoryNodeDescriptor As UANodeDescriptor
Dim existingFileOrDirectoryNodeId As UANodeId
 
instance.Delete(endpointDescriptor, directoryNodeDescriptor, existingFileOrDirectoryNodeId)

Parameters

endpointDescriptor
Endpoint descriptor. Identifies the OPC-UA server.
directoryNodeDescriptor
Node descriptor of the OPC UA directory.
existingFileOrDirectoryNodeId
A node descriptor of the file or directory to delete.
Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

The OPC UA operation has failed. This operation exception in uniformly used to allow common handling of various kinds of errors. The System.Exception.InnerException always contains information about the actual error cause.

This is an operation error that depends on factors external to your program, and thus cannot be always avoided. Your code must handle it appropriately.

Remarks

This method corresponds to (but is not fully identical with) the OPC UA File Transfer Method .

The directoryNodeDescriptor must be an existing node in the server, of object type OpcLabs.EasyOpc.UA.AddressSpace.Standard.UAObjectTypeIds.FileDirectoryType.

For existingFileOrDirectoryNodeId, "In the case of a directory, all file and directory Objects below the directory to delete are deleted recursively."

This method will delete either a file or directory, as long as the existingFileOrDirectoryNodeId refers to an OPC UA file or directory object. If you want to delete a file and be sure that you do not delete a directory, use the IEasyUAFileTransferExtension.DeleteFile extension method or one of its other overloads. If you want to delete a directory and be sure that you do not delete a file, use the IEasyUAFileTransferExtension.DeleteDirectory extension method or one of its other overloads.

This method will throw an exception if the object you are trying to delete does not exist. If you want to assure object deletion and do nothing if the object does not exist, you one of the following extension methods:

Recommendation: Whenever possible, do not use this method directly, and use a higher-level abstraction instead. You can obtain a writable file provider (using IEasyUAFileTransferExtension.GetWritableFileProvider). For directories, you can obtain writable directory contents (using OpcLabs.BaseLib.Extensions.FileProviders.IWritableDirectory.GetWritableDirectoryContents), and then call the OpcLabs.BaseLib.Extensions.FileProviders.IWritableDirectoryContents.Delete method to delete the directory. For files, you can obtain writable file info (using OpcLabs.BaseLib.Extensions.FileProviders.IWritableDirectory.GetWritableFileInfo) and then call the OpcLabs.BaseLib.Extensions.FileProviders.IWritableFileInfo.Delete method to delete the file.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also