Language

AgentSessionFiles.DeleteAsync Method

Definition

Delete a file or directory from the session sandbox. If recursive is false (default) and the target is a non-empty directory, the API returns 409 Conflict.

public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult> DeleteAsync(string sessionStoragePath, bool? recursive = default, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult> DeleteAsync(string localPath, bool? recursive = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteAsync : string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.ClientModel.ClientResult>
override this.DeleteAsync : string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.ClientModel.ClientResult>
abstract member DeleteAsync : string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.ClientModel.ClientResult>
override this.DeleteAsync : string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.ClientModel.ClientResult>
Public Overridable Function DeleteAsync (sessionStoragePath As String, Optional recursive As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ClientResult)
Public Overridable Function DeleteAsync (localPath As String, Optional recursive As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ClientResult)

Parameters

sessionStoragePathlocalPath
String

The file or directory path to delete, relative to the session home directory.

recursive
Nullable<Boolean>

Whether to recursively delete directory contents. Defaults to false.

cancellationToken
CancellationToken

The cancellation token that can be used to cancel the operation.

Returns

Exceptions

sessionStoragePath is null.

sessionStoragePath is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Applies to