WindowsShareClient class

Namespace Runic.Platform.Administration.Windows.Shares in Runic.Platform.Administration.Windows 0.23.0

public sealed class WindowsShareClient

Local or remote SMB share administration using generated NetAPI bindings and the current Windows identity.

Remarks

Native NetAPI calls run off the caller's thread. Cancellation before a call starts prevents it; once a call starts, its actual result is returned.

Constructors

WindowsShareClient

public WindowsShareClient(string? machineName = null)

Creates a share client; null targets the local computer.

Methods

CreateAsync

public Task CreateAsync(ShareSpecification specification, CancellationToken cancellationToken = default)

Creates a share. An existing name is a conflict; omitted security uses Windows defaults.

DeleteAsync

public Task<bool> DeleteAsync(string name, CancellationToken cancellationToken = default)

Deletes a share. Returns false only if absent.

EnumerateAsync

public Task<ImmutableArray<ShareSummary>> EnumerateAsync(CancellationToken cancellationToken = default)

Enumerates share summaries. Native enumeration failures remain errors.

FindAsync

public Task<ShareSnapshot?> FindAsync(string name, CancellationToken cancellationToken = default)

Reads share metadata and its nullable stored security descriptor. Null means the share is absent.

UpdateAsync

public Task UpdateAsync(string name, ShareUpdate update, CancellationToken cancellationToken = default)

Updates supplied fields, retaining omitted security. Multiple native changes are not transactional.