DAVServer Component

Properties   Methods   Events   Config Settings   Errors  

A component used for implementing DAV servers, granting full control over data storage, access and permissions, and server behavior.

Syntax

callback.DAVSDK.DAVServer

Remarks

The DAVServer component provides a streamlined way to extend WebDAV server support to data stored in different locations, including the local filesystem, remote storage, or in custom storage like a database. DAVServer is easy to use with minimal setup while also being flexible and highly configurable.

Getting Started

The DAVServer component provides an event-driven API for implementing WebDAV servers that can serve data from any data source, enforce granular access control rules, and implement custom logic according to your specific file access needs.

The Getting Started page provides a comprehensive introduction to the component, including hosting options and handling of events. The component may be hosted using an embedded server, within an existing server framework like ASP.NET Core, or in offline mode. A brief overview of hosting options is included below. Please refer to the Hosting Options page for additional details.

Hosting the Server

The component can be hosted one of three ways:

  • Via the embedded HTTP server
  • Integrated with an external server framework
  • In a fully-offline mode

Comprehensive information on hosting options and configuration can be found in the Hosting Options page.

Property List


The following is the full list of the properties of the component with short descriptions. Click on the links for further details.

ProcessingModeThe mode in which the component will be hosted.
RequestThe body of the HTTP request to be processed by the component.
RequestHeadersThe full set of headers of the HTTP request to be processed by the component.
ResponseThe body of the HTTP response generated after processing a request with the component.
ResponseHeadersThe full set of headers of the HTTP response generated after processing a request with the component.
ServerCertThe certificate used during SSL negotiation.
ServerSettingsThe embedded HTTP server settings used by the component.

Method List


The following is the full list of the methods of the component with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
GetSessionParamProvides the value of the specified session parameter.
ListFilePasses information about a specific file to the component.
ListFolderPasses information about a specific directory to the component.
ProcessRequestProcesses the request and sends the result.
SetSessionParamSets a user-defined value as a session parameter.
StartListeningInstructs the component to start listening for incoming connections.
StopListeningInstructs the component to stop listening for new connections.

Event List


The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.

CheckAccessFires when the component needs to create or open a file or directory.
CopyFileFires when the component needs to copy a file or directory.
CreateDirectoryFires when the component needs to create a new directory.
CreateFileFires when the component needs to create an empty file.
DeleteFileFires when the component needs to delete a file or directory.
DeletePropertyFires when the component needs to delete specific custom metadata of a file or directory.
ErrorFires information about unhandled exceptions caught by the component.
GetFileFires when the component needs to serve file data.
GetFileInfoFires when the component needs to obtain information about a specific file or directory.
GetFileLocksFires when the component needs to obtain information about the existing locks of a file or directory.
GetPropertyFires when the component needs to retrieve specific custom metadata about a file or directory.
GetQuotaInfoFires when the component needs to obtain information about the storage.
ListDirectoryFires when the component needs to enumerate the contents of a directory.
ListPropertiesFires when the component needs to enumerate the custom metadata of a file or directory.
LockFileFires when the component needs to lock a file or directory.
LogFires once for each log message.
PutFileFires when the component needs to store file data.
ReadFileFires when the component needs to serve file data.
RenameFileFires when the component needs to rename or move a file or directory.
SessionEndFires when the component ends a session.
SessionStartFires when the component starts a session.
SetFileInfoFires when the component needs to update times and attributes of a specific file or directory.
SetFileSizeFires when the component needs to adjust the size of an open file.
SetPropertyFires when the component needs to add or update custom metadata to a file or directory.
UnknownRequestFires when the component does not recognize the request.
UnlockFileFires when the component needs to unlock a file or directory.
UserAuthRequestFires when the component attempts to authenticate a client.
WriteFileFires when the component needs to store file data.

Config Settings


The following is a list of config settings for the component with short descriptions. Click on the links for further details.

EnableRecursiveDirectoryListingsWhether directories may be enumerated recursively.
FireCheckAccessEventWhether the CheckAccess event is fired.
LogLevelThe level of detail that is logged.
LogRequestBodyWhether bodies of requests are logged on Debug log level.
LogResponseBodyWhether bodies of responses are logged on Debug log level.
ReadOnlyWhether the server works in read-only mode.
ServerDAVURIPrefixThe endpoint prefix used by the server to serve requests.
UseSimpleFileEnumerationWhether an enumeration is performed with additional parameters.

ProcessingMode Property (DAVServer Component)

The mode in which the component will be hosted.

Syntax

public DAVServerProcessingModes ProcessingMode { get; set; }

enum DAVServerProcessingModes { modeEmbeddedServer, modeExternalServer, modeOffline }
Public Property ProcessingMode As DavserverProcessingModes

Enum DAVServerProcessingModes modeEmbeddedServer modeExternalServer modeOffline End Enum

Default Value

0

Remarks

This property governs whether the component operates via the embedded HTTP server, an external server, or in a fully-offline mode. Possible values are as follows:

  • modeEmbeddedServer (0, default): Use embedded server.
  • modeExternalServer (1): Use external server.
  • modeOffline (2): Use offline processing.

Please refer to the Hosting Options pages to the learn more about the different processing modes and how they relate to configuring a host server.

Request Property (DAVServer Component)

The body of the HTTP request to be processed by the component.

Syntax

public string Request { get; set; }
public byte[] RequestB { get; set; }
Public Property Request As String
Public Property RequestB As Byte()

Default Value

""

Remarks

When the ProcessingMode property is set to modeOffline, the component processes inbound HTTP requests via this property and the RequestHeaders property.

After setting this property to the full body content of the HTTP request, as well as setting any headers in the RequestHeaders property, the component will begin processing the request when the ProcessRequest method is called.

RequestHeaders Property (DAVServer Component)

The full set of headers of the HTTP request to be processed by the component.

Syntax

public string RequestHeaders { get; set; }
Public Property RequestHeaders As String

Default Value

""

Remarks

When the ProcessingMode property is set to modeOffline, the component processes inbound HTTP requests via this property and the Request property.

After setting this property to the header content of the HTTP request, as well as setting the body content in the Request property, the component will begin processing the request when the ProcessRequest method is called.

Response Property (DAVServer Component)

The body of the HTTP response generated after processing a request with the component.

Syntax

public string Response { get; set; }
public byte[] ResponseB { get; set; }
Public Property Response As String
Public Property ResponseB As Byte()

Default Value

""

Remarks

When the ProcessingMode property is set to modeOffline, this property holds the body of the HTTP response that was generated as a result of calling the ProcessRequest method.

Note that this response is not sent to a client, and instead the component simply populates this property along with the ResponseHeaders property.

ResponseHeaders Property (DAVServer Component)

The full set of headers of the HTTP response generated after processing a request with the component.

Syntax

public string ResponseHeaders { get; set; }
Public Property ResponseHeaders As String

Default Value

""

Remarks

When the ProcessingMode property is set to modeOffline, this property holds the headers of the HTTP response that was generated as a result of calling the ProcessRequest method.

Note that this response is not sent to a client, and instead the component simply populates this property along with the Response property.

ServerCert Property (DAVServer Component)

The certificate used during SSL negotiation.

Syntax

public Certificate ServerCert { get; set; }
Public Property ServerCert As Certificate

Remarks

When the ProcessingMode property is set to modeEmbeddedServer, this property holds the digital certificate that the component will use during SSL negotiation.

This is the server's certificate, and it must be set before the StartListening method is called.

Please refer to the Certificate type for a complete list of fields.

ServerSettings Property (DAVServer Component)

The embedded HTTP server settings used by the component.

Syntax

public ServerSettings ServerSettings { get; set; }
Public Property ServerSettings As ServerSettings

Remarks

When the ProcessingMode property is set to modeEmbeddedServer, this property is used to define the necessary fields to configure the embedded HTTP server.

Please refer to the ServerSettings type for a complete list of fields.

Config Method (DAVServer Component)

Sets or retrieves a configuration setting.

Syntax

public string Config(string configurationString);
Public Function Config(ByVal ConfigurationString As String) As String

Remarks

Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

GetSessionParam Method (DAVServer Component)

Provides the value of the specified session parameter.

Syntax

public string GetSessionParam(long sessionId, string name);
Public Function GetSessionParam(ByVal SessionId As Long, ByVal Name As String) As String

Remarks

This method provides access to session parameters, which are key-value pairs that store session-specific information. This method is used in event handlers to retrieve a session parameter value that was previously set using the SetSessionParam method.

SessionId is the unique identifier of the session with which the parameter name and value will be associated. This value is assigned by the component and is available in the SessionStart event as well as other events.

Name corresponds to the user-defined parameter name.

ListFile Method (DAVServer Component)

Passes information about a specific file to the component.

Syntax

public bool ListFile(long requestId, string parentId, string fileName, int attributes, long size, DateTime creationTime, DateTime lastAccessTime, DateTime lastModifiedTime, string ownerId);
Public Function ListFile(ByVal RequestId As Long, ByVal ParentId As String, ByVal FileName As String, ByVal Attributes As Integer, ByVal Size As Long, ByVal CreationTime As DateTime, ByVal LastAccessTime As DateTime, ByVal LastModifiedTime As DateTime, ByVal OwnerId As String) As Boolean

Remarks

This method is used to pass information about a specific file when the ListDirectory event is handled.

The RequestId parameter must be set to the value received in the corresponding event handler. The parameters detailed below must be set if they were requested as indicated by the RequestedInfo parameter of the event.

This method returns true if the information was accepted; otherwise, false is returned.

ParentId must be set to the path of the parent of the file or directory relative to the server root. If the item is located in the root directory, the value should be empty.

FileName must be set to the item's file name (usually, human-readable) without any path.

Attributes should be set to indicate the type of the item by setting the corresponding attributes flags. The following flags are available:

ITEM_ATTR_FILE0x00000001The item is a file.

ITEM_ATTR_DIRECTORY0x00000002The item is a directory.

ITEM_ATTR_READONLY0x00000040The file is read-only.

DAVServer does not block operations based on this attribute, but it does communicate the status of items and directories to clients based on this attribute.

ITEM_ATTR_ANY_FILE0x7FFFFFFFA mask which includes any and all attributes.

CreationTime should be set to the time the item was initially created.

LastAccessTime should be set to the most recent time the item was opened.

LastModifiedTime should be set to the most recent time the item was written.

Owner should be set to the identifier of the owner of the item.

Size should be set to the size of a file in bytes.

ListFolder Method (DAVServer Component)

Passes information about a specific directory to the component.

Syntax

public bool ListFolder(long requestId, string parentId, string fileName, int attributes, DateTime creationTime, DateTime lastAccessTime, DateTime lastModifiedTime, string owner);
Public Function ListFolder(ByVal RequestId As Long, ByVal ParentId As String, ByVal FileName As String, ByVal Attributes As Integer, ByVal CreationTime As DateTime, ByVal LastAccessTime As DateTime, ByVal LastModifiedTime As DateTime, ByVal Owner As String) As Boolean

Remarks

This method is used to pass information about a specific directory when the ListDirectory event is handled.

The RequestId parameter must be set to the value received in the corresponding event handler. The parameters detailed below must be set if they were requested as indicated by the RequestedInfo parameter of the event.

This method returns true if the information was accepted; otherwise, false is returned.

ParentId must be set to the path of the parent of the file or directory relative to the server root. If the item is located in the root directory, the value should be empty.

FileName must be set to the item's file name (usually, human-readable) without any path.

Attributes should be set to indicate the type of the item by setting the corresponding attributes flags. The following flags are available:

ITEM_ATTR_FILE0x00000001The item is a file.

ITEM_ATTR_DIRECTORY0x00000002The item is a directory.

ITEM_ATTR_READONLY0x00000040The file is read-only.

DAVServer does not block operations based on this attribute, but it does communicate the status of items and directories to clients based on this attribute.

ITEM_ATTR_ANY_FILE0x7FFFFFFFA mask which includes any and all attributes.

CreationTime should be set to the time the item was initially created.

LastAccessTime should be set to the most recent time the item was opened.

LastModifiedTime should be set to the most recent time the item was written.

Owner should be set to the identifier of the owner of the item.

ProcessRequest Method (DAVServer Component)

Processes the request and sends the result.

Syntax

public void ProcessRequest(object Context);
Public Sub ProcessRequest(ByVal Context As Object)

Remarks

When the ProcessingMode property is set to modeExternalServer or modeOffline, this method acts as the main entry point for the component and is used to process a specific request. This method should not be called when the component is running in the modeEmbeddedServer mode.

Note that when using the modeOffline mode, the component processes the request and its associated headers supplied via the Request and RequestHeaders properties, respectively, and therefore ignores the parameters of this method.

When using the modeExternalServer mode, Context must be set to an instance of the HttpContext class that corresponds to the request to be handled.

Note that authentication occurs fully outside the scope of the component, and the logic that verifies these credentials is separate from any interaction with the component. Only once the request has been authenticated through this external verification should the HttpContext be passed to this method.

SetSessionParam Method (DAVServer Component)

Sets a user-defined value as a session parameter.

Syntax

public void SetSessionParam(long sessionId, string name, string value);
Public Sub SetSessionParam(ByVal SessionId As Long, ByVal Name As String, ByVal Value As String)

Remarks

This method assigns session parameters, which are key-value pairs that store information specific to the session. This method is used in event handlers to store session-specific data which can be retrieved later by calling the GetSessionParam method.

SessionId is the unique identifier of the session with which the parameter name and value will be associated. This value is assigned by the component and is available in the SessionStart event as well as other events.

Name and Value correspond to the user-defined parameter name and value, respectively.

StartListening Method (DAVServer Component)

Instructs the component to start listening for incoming connections.

Syntax

public void StartListening();
Public Sub StartListening()

Remarks

When the ProcessingMode property is set to modeEmbeddedServer, this method instructs the component to start listening for incoming connections on the port specified by LocalPort.

To stop listening for new connections, please refer to the StopListening method.

StopListening Method (DAVServer Component)

Instructs the component to stop listening for new connections.

Syntax

public void StopListening();
Public Sub StopListening()

Remarks

When the ProcessingMode property is set to modeEmbeddedServer, this method instructs the component to stop listening for new connections. After being called, any new connection attempts will be rejected. Calling this method does not disconnect existing connections.

CheckAccess Event (DAVServer Component)

Fires when the component needs to create or open a file or directory.

Syntax

public event OnCheckAccessHandler OnCheckAccess;

public delegate void OnCheckAccessHandler(object sender, DAVServerCheckAccessEventArgs e);

public class DAVServerCheckAccessEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public int DesiredOperation { get; }
  public int ResultCode { get; set; }
}
Public Event OnCheckAccess As OnCheckAccessHandler

Public Delegate Sub OnCheckAccessHandler(sender As Object, e As DAVServerCheckAccessEventArgs)

Public Class DAVServerCheckAccessEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property DesiredOperation As Integer
  Public Property ResultCode As Integer
End Class

Remarks

This optional event fires when the component needs to create or open an existing file or directory. It can be used to control and optionally restrict access to files and directories. The event can be disabled by setting the FireCheckAccessEvent configuration setting to false, which can improve performance.

When an existing file is accessed, this event is fired only for this file and not for its parent directories. When a new file or directory is created, the event is first fired for the parent directory. When a file or directory is copied or moved into another directory, the event is first fired for the destination directory (i.e., the new parent).

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item to be accessed is in the root directory, the value will be empty.

FileName identifies the name of the file or directory to be accessed.

DesiredOperation specifies which kind of operation is performed and can be one or more of the following:

ACCESS_TYPE_DELETE0x00000001The file or directory is being deleted.

ACCESS_TYPE_RENAME0x00000002The file or directory is being renamed.

Renaming doesn't involve opening of a file for reading and is performed within the same directory.

ACCESS_TYPE_MOVE0x00000004The file or directory is being moved.

The event is fired for a source file or directory. A separate event is also fired for a destination directory with the ACCESS_TYPE_WRITE flag.

ACCESS_TYPE_READ0x00000008The file is being opened for reading or for reading and writing.

ACCESS_TYPE_WRITE0x00000010The file is being opened for writing or for reading and writing.

For directories, this value means that a new file is about to be created in the directory or be moved into the directory.

ACCESS_TYPE_ENUMERATE0x00000020The directory is being enumerated.

ACCESS_TYPE_GET_ATTR0x00000040Information about the file or directory is requested.

ACCESS_TYPE_SET_ATTR0x00000080An explicit operation of changing file times and attributes is performed.

ACCESS_TYPE_BUILD_PATH0x00002000A human-readable path or a file's parent are being requested.

Use this check to provide access to a specific file or directory and prevent its parent directories from becoming known to a user.

ACCESS_TYPE_GET_FILENAME0x00008000A request is made to get a filename.

Usually, only one flag is set; however, when a file is opened, both ACCESS_TYPE_READ and ACCESS_TYPE_WRITE flags may be set.

ResultCode must be set to report the result of the check to the component. When this event is fired, the parameter will be set either to 0 (to permit access by default) for most types of desired operations, or to DAVSDK_ERR_ACCESS_DENIED for operations that must be forbidden by default for security reasons.

If access is permitted, this should be set to 0. If access is denied, this should be set to DAVSDK_ERR_ACCESS_DENIED. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, etc.), this should be set to a non-zero value different from DAVSDK_ERR_ACCESS_DENIED.

CopyFile Event (DAVServer Component)

Fires when the component needs to copy a file or directory.

Syntax

public event OnCopyFileHandler OnCopyFile;

public delegate void OnCopyFileHandler(object sender, DAVServerCopyFileEventArgs e);

public class DAVServerCopyFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string DestParentPath { get; }
  public string DestFileName { get; }
  public bool OverwriteExisting { get; }
  public int ResultCode { get; set; }
}
Public Event OnCopyFile As OnCopyFileHandler

Public Delegate Sub OnCopyFileHandler(sender As Object, e As DAVServerCopyFileEventArgs)

Public Class DAVServerCopyFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property DestParentPath As String
  Public ReadOnly Property DestFileName As String
  Public ReadOnly Property OverwriteExisting As Boolean
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to copy a file or directory is received. When a directory with its contents is copied, this event is fired only once for the directory itself.

During recursive copying, if a file or directory cannot be copied, copying should continue, but the event handler should set the ResultCode parameter to a non-zero value to communicate an error.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item to be copied is in the root directory, the value will be empty.

FileName identifies the name of the file or directory to be copied.

DestParentPath contains the path of the new parent directory relative to the server root. If the item is to be copied to the root directory, the value will be empty.

DestFileName contains the name of the newly-copied file or directory.

OverwriteExisting specifies whether the handler should overwrite an existing file if one already exists. If this is false and a destination item exists, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error. If this is true, the following rules apply:

  • If the destination item exists and is a file, it must be replaced by the copy of the source item, regardless of whether it is a file or directory.
  • If the destination item exists and is a directory, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error, as a directory cannot be overwritten.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

CreateDirectory Event (DAVServer Component)

Fires when the component needs to create a new directory.

Syntax

public event OnCreateDirectoryHandler OnCreateDirectory;

public delegate void OnCreateDirectoryHandler(object sender, DAVServerCreateDirectoryEventArgs e);

public class DAVServerCreateDirectoryEventArgs : EventArgs {
  public long SessionId { get; }
  public string ParentPath { get; }
  public string FileName { get; }
  public int ResultCode { get; set; }
}
Public Event OnCreateDirectory As OnCreateDirectoryHandler

Public Delegate Sub OnCreateDirectoryHandler(sender As Object, e As DAVServerCreateDirectoryEventArgs)

Public Class DAVServerCreateDirectoryEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property ParentPath As String
  Public ReadOnly Property FileName As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to create a new directory is received.

If a file or directory with the same name already exists, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

ParentPath identifies the path of the parent directory relative to the server root where the new directory should be created. If the item is to be created in the root directory, the value will be empty.

FileName identifies the name of the directory to be created.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

CreateFile Event (DAVServer Component)

Fires when the component needs to create an empty file.

Syntax

public event OnCreateFileHandler OnCreateFile;

public delegate void OnCreateFileHandler(object sender, DAVServerCreateFileEventArgs e);

public class DAVServerCreateFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string ParentPath { get; }
  public string FileName { get; }
  public bool OverwriteExisting { get; }
  public int ResultCode { get; set; }
}
Public Event OnCreateFile As OnCreateFileHandler

Public Delegate Sub OnCreateFileHandler(sender As Object, e As DAVServerCreateFileEventArgs)

Public Class DAVServerCreateFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property ParentPath As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property OverwriteExisting As Boolean
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when the component needs to create a file that does not already exist.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

ParentPath identifies the path of the parent directory relative to the server root where the new file should be created. If the item is to be created in the root directory, the value will be empty.

FileName identifies the name of the file to be created.

OverwriteExisting specifies whether the handler should overwrite an existing file if one already exists. If this is false and a destination item exists, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error. If this is true, the following rules apply:

  • If the item exists and is a file, it must be replaced by the newly-created item, regardless of whether it is a file or directory.
  • If the item exists and is a directory, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error, as a directory cannot be overwritten.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

DeleteFile Event (DAVServer Component)

Fires when the component needs to delete a file or directory.

Syntax

public event OnDeleteFileHandler OnDeleteFile;

public delegate void OnDeleteFileHandler(object sender, DAVServerDeleteFileEventArgs e);

public class DAVServerDeleteFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public bool Recursive { get; }
  public int ResultCode { get; set; }
}
Public Event OnDeleteFile As OnDeleteFileHandler

Public Delegate Sub OnDeleteFileHandler(sender As Object, e As DAVServerDeleteFileEventArgs)

Public Class DAVServerDeleteFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Recursive As Boolean
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to delete a file or directory is received.

When deleting multiple items, such as a directory and its contents, failure to delete one of the items should not abort the operation; rather, it should continue with remaining items.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item to be deleted is in the root directory, the value will be empty.

FileName identifies the name of the file or directory to be deleted.

Recursive specifies whether directory contents may be removed if the item is a directory and it contains any children. If this is false and the directory contains subdirectories or files, the deletion should be stopped and the DAVSDK_ERR_DIR_NOT_EMPTY error should be reported. If this is true, all contents including subdirectories and their contents should be deleted recursively.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

DeleteProperty Event (DAVServer Component)

Fires when the component needs to delete specific custom metadata of a file or directory.

Syntax

public event OnDeletePropertyHandler OnDeleteProperty;

public delegate void OnDeletePropertyHandler(object sender, DAVServerDeletePropertyEventArgs e);

public class DAVServerDeletePropertyEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string Namespace { get; }
  public string PropertyName { get; }
  public int ResultCode { get; set; }
}
Public Event OnDeleteProperty As OnDeletePropertyHandler

Public Delegate Sub OnDeletePropertyHandler(sender As Object, e As DAVServerDeletePropertyEventArgs)

Public Class DAVServerDeletePropertyEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Namespace As String
  Public ReadOnly Property PropertyName As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to delete specific custom metadata of a file or directory is received.

Note that the component does not maintain these custom metadata properties internally. Developers making use of custom properties should maintain a dictionary or other data structure to store these property names and values, and within this event handler check to see if a corresponding property exists on the item that can be deleted.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose custom metadata is to be deleted is in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose custom metadata is to be deleted.

Namespace and PropertyName identify the specific custom metadata property to be deleted.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

Error Event (DAVServer Component)

Fires information about unhandled exceptions caught by the component.

Syntax

public event OnErrorHandler OnError;

public delegate void OnErrorHandler(object sender, DAVServerErrorEventArgs e);

public class DAVServerErrorEventArgs : EventArgs {
  public int ErrorCode { get; }
  public string Description { get; }
}
Public Event OnError As OnErrorHandler

Public Delegate Sub OnErrorHandler(sender As Object, e As DAVServerErrorEventArgs)

Public Class DAVServerErrorEventArgs Inherits EventArgs
  Public ReadOnly Property ErrorCode As Integer
  Public ReadOnly Property Description As String
End Class

Remarks

This event fires when an unhandled exception is caught by the component, providing information about the error.

ErrorCode contains an error code and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.

GetFile Event (DAVServer Component)

Fires when the component needs to serve file data.

Syntax

public event OnGetFileHandler OnGetFile;

public delegate void OnGetFileHandler(object sender, DAVServerGetFileEventArgs e);

public class DAVServerGetFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string LocalPath { get; set; }
}
Public Event OnGetFile As OnGetFileHandler

Public Delegate Sub OnGetFileHandler(sender As Object, e As DAVServerGetFileEventArgs)

Public Class DAVServerGetFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public Property LocalPath As String
End Class

Remarks

This event fires when a request to download file data is received and is the first of two events that can be used to determine what data is returned.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file relative to the server root. If the file to be downloaded is in the root directory, the value will be empty.

FileName contains the name of the file to be downloaded.

LocalPath may optionally be set to a full path of a local file, in which case the file's contents will be returned as the download response. If this is not set, which is useful in cases where the response to the download request will not be the entire contents of a single file, the component will not immediately respond to the download request and will instead fire the ReadFile event, where developers have more control over exactly what data is returned in response to the download request.

Event Order During Download Operations

When a download request is received, the component fires a series of events in the following order. Note that certain details like the number of levels of directories within which the target file resides may impact how events fire.

  1. SessionStart - Fires when a client initiates a session with the component and helps associate a unique session identifier with the request.
  2. CheckAccess - Fires when a client attempts to read or list a file or directory, and provides an opportunity to check access and permissions (optional).
  3. GetFileInfo - Fires to access metadata regarding the file or directory being read or listed.
  4. GetFile - Fires to provide a simple way for the component to serve a file by providing a filepath (optional).
  5. GetProperty - Fires to access custom metadata regarding the file or directory being read or listed (optional).
  6. ReadFile - Fires if GetFile was not used to serve the file and provides full control over response data.
  7. SessionEnd - Fires when a client successfully ends a session and allows closing out the session identifier.

GetFileInfo Event (DAVServer Component)

Fires when the component needs to obtain information about a specific file or directory.

Syntax

public event OnGetFileInfoHandler OnGetFileInfo;

public delegate void OnGetFileInfoHandler(object sender, DAVServerGetFileInfoEventArgs e);

public class DAVServerGetFileInfoEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public int RequestedInfo { get; }
  public int Attributes { get; set; }
  public long Size { get; set; }
  public DateTime CreationTime { get; set; }
  public DateTime LastAccessTime { get; set; }
  public DateTime LastModifiedTime { get; set; }
  public string Owner { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnGetFileInfo As OnGetFileInfoHandler

Public Delegate Sub OnGetFileInfoHandler(sender As Object, e As DAVServerGetFileInfoEventArgs)

Public Class DAVServerGetFileInfoEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property RequestedInfo As Integer
  Public Property Attributes As Integer
  Public Property Size As Long
  Public Property CreationTime As DateTime
  Public Property LastAccessTime As DateTime
  Public Property LastModifiedTime As DateTime
  Public Property Owner As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to obtain information about a file or directory is received, to check existence of the specified file or directory, or to determine whether the specified item is a directory. To handle this event, values should be supplied to each of the event parameters according to the type of needed information as specified in the RequestedInfo parameter.

This event may fire several times for the same file or directory when handling one request. If retrieval of item information is slow (e.g., from databases, remote cloud storages, etc.), all item information may need to be requested at once and cached for some time (several seconds or the duration of the session, whichever is shorter).

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose information is being queried is in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose information is being queried.

RequestedInfo specifies what information is requested and may contain one or more flags. The following flags are available:

ITEM_INFO_EXISTENCE0x00000000Item existence is checked.

This pseudo-flag with the numeric value 0 is used when the GetFileInfo event is used to check whether the given item exists. When the RequestedInfo parameter is 0, no file or directory information needs to be returned, and just an error should be reported if the item does not exist.

ITEM_INFO_NAME0x00000001Item name is requested.

ITEM_INFO_PARENTID0x00000002The parent of the item is requested.

ITEM_INFO_SIZE0x00000008File size is requested.

If an item is a directory, set the corresponding parameter to 0.

ITEM_INFO_ATTR0x00000010Attributes are requested.

If the component needs to find out whether the item is a file or a directory, this flag will be the only one set. During other requests, it may come in a combination with other flags.

ITEM_INFO_TIMES0x00000020Times are requested.

ITEM_INFO_OWNER0x00000040The owner of the file is requested.

The parameters listed below must be set if they were requested as indicated by the RequestedInfo parameter of the event.

Attributes should be set to indicate the type of the item by setting the corresponding attributes flags. The following flags are available:

ITEM_ATTR_FILE0x00000001The item is a file.

ITEM_ATTR_DIRECTORY0x00000002The item is a directory.

ITEM_ATTR_READONLY0x00000040The file is read-only.

DAVServer does not block operations based on this attribute, but it does communicate the status of items and directories to clients based on this attribute.

ITEM_ATTR_ANY_FILE0x7FFFFFFFA mask which includes any and all attributes.

Size should be set to the size of the file in bytes. If the item is a directory, no value should be supplied.

CreationTime should be set to the time the item was initially created.

LastAccessTime should be set to the most recent time the item was opened.

LastModifiedTime should be set to the most recent time the item was written.

Owner should be set to the identifier of the owner of the item.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

GetFileLocks Event (DAVServer Component)

Fires when the component needs to obtain information about the existing locks of a file or directory.

Syntax

public event OnGetFileLocksHandler OnGetFileLocks;

public delegate void OnGetFileLocksHandler(object sender, DAVServerGetFileLocksEventArgs e);

public class DAVServerGetFileLocksEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string LockToken { get; set; }
  public DateTime Expires { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnGetFileLocks As OnGetFileLocksHandler

Public Delegate Sub OnGetFileLocksHandler(sender As Object, e As DAVServerGetFileLocksEventArgs)

Public Class DAVServerGetFileLocksEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public Property LockToken As String
  Public Property Expires As DateTime
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to obtain information about the existing locks of a file or directory is received.

Note that the component does not maintain locks internally. Developers making use of locks should maintain a dictionary or other data structure to keep track of item lock information, and within this event handler check to see if a corresponding lock exists for the item with a value that can be returned.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose lock information is being queried is in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose lock information is being queried.

LockToken must be set to the unique identifier of the lock.

Expires must be set to the time at which the lock will expire.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

GetProperty Event (DAVServer Component)

Fires when the component needs to retrieve specific custom metadata about a file or directory.

Syntax

public event OnGetPropertyHandler OnGetProperty;

public delegate void OnGetPropertyHandler(object sender, DAVServerGetPropertyEventArgs e);

public class DAVServerGetPropertyEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string Namespace { get; }
  public string PropertyName { get; }
  public string Value { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnGetProperty As OnGetPropertyHandler

Public Delegate Sub OnGetPropertyHandler(sender As Object, e As DAVServerGetPropertyEventArgs)

Public Class DAVServerGetPropertyEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Namespace As String
  Public ReadOnly Property PropertyName As String
  Public Property Value As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request for a specific custom metadata value of a file or directory is received.

Note that the component does not maintain these custom metadata properties internally. Developers making use of custom properties should maintain a dictionary or other data structure to store these property names and values, and within this event handler check to see if a corresponding property exists for the item with a value that can be returned.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose custom metadata is being queried is in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose custom metadata is being queried.

Namespace and PropertyName identify the specific custom metadata property being requested.

Value should be set to the value of the requested custom metadata property. This typically requires checking an external data structure in which custom metadata properties are stored for each item.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

GetQuotaInfo Event (DAVServer Component)

Fires when the component needs to obtain information about the storage.

Syntax

public event OnGetQuotaInfoHandler OnGetQuotaInfo;

public delegate void OnGetQuotaInfoHandler(object sender, DAVServerGetQuotaInfoEventArgs e);

public class DAVServerGetQuotaInfoEventArgs : EventArgs {
  public long SessionId { get; }
  public long AvailableSpace { get; set; }
  public long TotalSpace { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnGetQuotaInfo As OnGetQuotaInfoHandler

Public Delegate Sub OnGetQuotaInfoHandler(sender As Object, e As DAVServerGetQuotaInfoEventArgs)

Public Class DAVServerGetQuotaInfoEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public Property AvailableSpace As Long
  Public Property TotalSpace As Long
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to retrieve information about the storage is received.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

AvailableSpace indicates the amount of storage in bytes that is available for a user and corresponds to the quota-available-bytes property of the WebDAV quota extension.

TotalSpace indicates the maximum storage capacity in bytes that is available for a user and corresponds to the sum of the quota-available-bytes and quota-used-bytes properties of the WebDAV quota extension.

ResultCode must be set to report the result to the component. This will always be DAVSDK_ERR_NOT_IMPLEMENTED when the event is fired and should be set to 0 to indicate success. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

ListDirectory Event (DAVServer Component)

Fires when the component needs to enumerate the contents of a directory.

Syntax

public event OnListDirectoryHandler OnListDirectory;

public delegate void OnListDirectoryHandler(object sender, DAVServerListDirectoryEventArgs e);

public class DAVServerListDirectoryEventArgs : EventArgs {
  public long SessionId { get; }
  public string ParentPath { get; }
  public string Mask { get; }
  public int RequestedInfo { get; }
  public int StartAt { get; }
  public string StartAfter { get; }
  public int MaxFiles { get; }
  public int OrderBy { get; }
  public bool ReverseOrder { get; }
  public bool Recursive { get; }
  public long RequestId { get; }
  public bool ListingComplete { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnListDirectory As OnListDirectoryHandler

Public Delegate Sub OnListDirectoryHandler(sender As Object, e As DAVServerListDirectoryEventArgs)

Public Class DAVServerListDirectoryEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property ParentPath As String
  Public ReadOnly Property Mask As String
  Public ReadOnly Property RequestedInfo As Integer
  Public ReadOnly Property StartAt As Integer
  Public ReadOnly Property StartAfter As String
  Public ReadOnly Property MaxFiles As Integer
  Public ReadOnly Property OrderBy As Integer
  Public ReadOnly Property ReverseOrder As Boolean
  Public ReadOnly Property Recursive As Boolean
  Public ReadOnly Property RequestId As Long
  Public Property ListingComplete As Boolean
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to enumerate the contents of a directory is received. To provide the directory's contents to the component, the ListFile or ListFolder methods should be called for each discovered file or subdirectory, respectively.

By default, the advanced filtering and ordering parameters, including Mask, StartAt, StartAfter, MaxFiles, OrderBy, and ReverseOrder, contain values that need to be handled. To meet this requirement, a listing of files and directories should be returned within this event in accordance with these values.

If the UseSimpleFileEnumeration configuration setting is enabled, the advanced filtering and ordering parameters can be safely ignored and the component will handle ordering and filtration automatically.

The StartAt, StartAfter, and MaxFiles parameters in particular are used when the client collects enumeration information in batches. When this happens, consequent requests to the component may occur in different sessions.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

ParentPath identifies the path of the parent directory to enumerate relative to the server root. The value may be empty if the root directory is to be listed.

Mask may be empty, in which case all files and directories should be returned, or it may contain a file mask with wildcards that must be used to filter items by matching their human-readable names to the mask.

RequestedInfo specifies what information is requested and may contain one or more flags. The following flags are available:

ITEM_INFO_EXISTENCE0x00000000Item existence is checked.

This pseudo-flag with the numeric value 0 is used when the GetFileInfo event is used to check whether the given item exists. When the RequestedInfo parameter is 0, no file or directory information needs to be returned, and just an error should be reported if the item does not exist.

ITEM_INFO_NAME0x00000001Item name is requested.

ITEM_INFO_PARENTID0x00000002The parent of the item is requested.

ITEM_INFO_SIZE0x00000008File size is requested.

If an item is a directory, set the corresponding parameter to 0.

ITEM_INFO_ATTR0x00000010Attributes are requested.

If the component needs to find out whether the item is a file or a directory, this flag will be the only one set. During other requests, it may come in a combination with other flags.

ITEM_INFO_TIMES0x00000020Times are requested.

ITEM_INFO_OWNER0x00000040The owner of the file is requested.

StartAt specifies the index of the first file or directory in the list of found items to return. It is set to 0 initially but may contain a non-zero value if the contents are requested by the client in batches. This has priority over the StartAfter parameter and may be set to -1 if StartAfter must be taken into account; in all other cases, this should be used and StartAfter must be ignored.

StartAfter specifies the last file or directory received by the component that was passed to the client in the previous call to the event handler (or during the previous enumeration). If no file or directory was found (e.g., the item was since deleted), an event handler should return items that would follow such an item after sorting is applied.

For example, given the files A.txt, B.txt, D.txt, and E.txt, and C.txt is passed in this parameter, enumeration should return D.txt and E.txt.

MaxFiles specifies the maximum number of items to return in a batch.

OrderBy specifies the order in which the items must be returned and may be one of the following values:

SORT_ORDER_NONE0x00000000No required sort order.

A handler is free to use any ordering, given that the sorting algorithm remains unchanged between calls.

SORT_ORDER_NAME_FS0x00000002Sort by human-readable name and item attributes.

Directories should come in the list before files, and both files and directories should be sorted according their human-readable names, lexicographically. In recursive enumerations, an entity that resides in the subdirectory must come later than the subdirectory but before files that reside in the parent of that subdirectory.

The following example helps demonstrate this idea. \Dir \Dir\Z.txt \A_File.bin

SORT_ORDER_NAME_LEX0x00000003Sort by human-readable name, lexicographically.

Use common string comparison to match item names.

SORT_ORDER_SIZE0x00000004Sort by item size, then by human-readable name.

SORT_ORDER_MODIFICATION_TIME0x00000005Sort by item modification time, then by human-readable name.

SORT_ORDER_CREATION_TIME0x00000006Sort by item creation time, then by human-readable name.

Note that ordering must occur through the whole set of items and not just the subset defined by the StartAt, StartAfter, and MaxFiles parameters.

ReverseOrder specifies whether the items should be returned in the opposite order than what is specified by the other advanced ordering and filtering parameters.

Recursive specifies whether items in subdirectories should be reported as well. This parameter may be true when the EnableRecursiveDirectoryListings configuration setting is enabled.

RequestId contains an unique identifier generated by the component that must be passed to the ListFile and ListFolder methods.

ListingComplete must be set to true if the last file or subdirectory has been reported to the component and there are no more items to report during this enumeration; otherwise, it must be set to false.

For example, if the component has requested 20 items by setting MaxFiles accordingly, and the directory to be enumerated contains exactly 20 files and subdirectories, this must be set to true. If the number of subitems is 21 or more, or if the total number is not known, this must be set to false.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

ListProperties Event (DAVServer Component)

Fires when the component needs to enumerate the custom metadata of a file or directory.

Syntax

public event OnListPropertiesHandler OnListProperties;

public delegate void OnListPropertiesHandler(object sender, DAVServerListPropertiesEventArgs e);

public class DAVServerListPropertiesEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string Namespaces { get; set; }
  public string Names { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnListProperties As OnListPropertiesHandler

Public Delegate Sub OnListPropertiesHandler(sender As Object, e As DAVServerListPropertiesEventArgs)

Public Class DAVServerListPropertiesEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public Property Namespaces As String
  Public Property Names As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to enumerate the custom metadata of a file or directory is received.

Note that the component does not maintain these custom metadata properties internally. Developers making use of custom properties should maintain a dictionary or other data structure to store these property names and values, and within this event handler check to see if a corresponding property exists for the item with a value that can be listed.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose custom metadata is to be listed is in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose custom metadata is to be listed.

Namespaces should be set to a newline character (\n)-separated list of namespaces corresponding to each custom metadata property to be listed.

Names should be set to a newline character (\n)-separated list of names corresponding to each custom metadata property to be listed.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

LockFile Event (DAVServer Component)

Fires when the component needs to lock a file or directory.

Syntax

public event OnLockFileHandler OnLockFile;

public delegate void OnLockFileHandler(object sender, DAVServerLockFileEventArgs e);

public class DAVServerLockFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string LockToken { get; }
  public DateTime Expires { get; }
  public int ResultCode { get; set; }
}
Public Event OnLockFile As OnLockFileHandler

Public Delegate Sub OnLockFileHandler(sender As Object, e As DAVServerLockFileEventArgs)

Public Class DAVServerLockFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property LockToken As String
  Public ReadOnly Property Expires As DateTime
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to lock a file or directory is received.

Note that the component does not maintain locks internally. Developers making use of locks should maintain a dictionary or other data structure to keep track of item lock information, and within this event handler add or update the lock information to the existing list.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item to be locked is in the root directory, the value will be empty.

FileName identifies the name of the file or directory to be locked.

LockToken specifies the unique identifier for the lock to be added or updated.

Expires identifies the time at which the lock will expire.

ResultCode provides an opportunity to report the result of the operation. This will always be DAVSDK_ERR_NOT_IMPLEMENTED when the event is fired and should be set to 0 to indicate success or DAVSDK_ERR_LOCK_FAILED to indicate that a lock could not be created or removed specifically due to a conflict with another lock. Any other non-zero value indicates the lock could not be created or removed for other reasons.

Log Event (DAVServer Component)

Fires once for each log message.

Syntax

public event OnLogHandler OnLog;

public delegate void OnLogHandler(object sender, DAVServerLogEventArgs e);

public class DAVServerLogEventArgs : EventArgs {
  public int LogLevel { get; }
  public string Message { get; }
}
Public Event OnLog As OnLogHandler

Public Delegate Sub OnLogHandler(sender As Object, e As DAVServerLogEventArgs)

Public Class DAVServerLogEventArgs Inherits EventArgs
  Public ReadOnly Property LogLevel As Integer
  Public ReadOnly Property Message As String
End Class

Remarks

This event fires once for each log message generated by the component. The verbosity is controlled by the LogLevel setting.

0 (None) No information is logged.
1 (Errors) Only errors are logged.
2 (Warnings) Errors and warnings are logged.
3 (Information) Errors, warnings, and informational messages are logged.
4 (Debug) Debug information is logged.

Message is the log entry.

PutFile Event (DAVServer Component)

Fires when the component needs to store file data.

Syntax

public event OnPutFileHandler OnPutFile;

public delegate void OnPutFileHandler(object sender, DAVServerPutFileEventArgs e);

public class DAVServerPutFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string LocalPath { get; set; }
}
Public Event OnPutFile As OnPutFileHandler

Public Delegate Sub OnPutFileHandler(sender As Object, e As DAVServerPutFileEventArgs)

Public Class DAVServerPutFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public Property LocalPath As String
End Class

Remarks

This event fires when a request to upload file data is received and is the first of two events that can be used to determine how data should be stored.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file relative to the server root. If the file is to be uploaded in the root directory, the value will be empty.

FileName contains the name of the file to be uploaded.

LocalPath may optionally be set to a full path of a local file, in which case the contents of the client's request will be written to that file. If this is not set, which is useful in cases where the data should be stored in a different manner than writing the entire contents to a single file, the component will not immediately respond to the upload request and will instead fire the WriteFile event, where developers have full access to the upload contents and full control over how that data is stored.

Event Order During Upload Operations

When an upload request is received, the component fires a series of events in the following order. Note that certain details like the number of levels of directories within which the target file resides may impact how events fire.

  1. SessionStart - Fires when a client initiates a session with the component and helps associate a unique session identifier with the request.
  2. CheckAccess - Fires when a client attempts to list or write a file or directory and provides an opportunity to check access and permissions (optional).
  3. GetFileInfo - Fires to access metadata regarding the file or directory being written or listed.
  4. PutFile - Fires to provide a simple way for the component to store file data by setting a filepath (optional).
  5. GetFileLocks - Fires when the component needs to check or acquire locks to the file being written.
  6. CreateFile - Fires when the component is asked to create a file that does not already exist.
  7. WriteFile - Fires if PutFile was not used to store the file and provides full control over inbound upload data.
  8. SessionEnd - Fires when a client successfully ends a session and allows closing out the session identifier.

ReadFile Event (DAVServer Component)

Fires when the component needs to serve file data.

Syntax

public event OnReadFileHandler OnReadFile;

public delegate void OnReadFileHandler(object sender, DAVServerReadFileEventArgs e);

public class DAVServerReadFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public byte[] Buffer { get; }
  public long Offset { get; }
  public int Length { get; }
  public int BytesRead { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnReadFile As OnReadFileHandler

Public Delegate Sub OnReadFileHandler(sender As Object, e As DAVServerReadFileEventArgs)

Public Class DAVServerReadFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Buffer As Byte()
  Public ReadOnly Property Offset As Long
  Public ReadOnly Property Length As Integer
  Public Property BytesRead As Integer
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to download file data is received and that request was not already satisfied within the GetFile event.

Any failure to write to the data buffer in this event should be reported as an error.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file relative to the server root. If the file to be downloaded is in the root directory, the value will be empty.

FileName contains the name of the file to be downloaded.

Buffer holds the block of data that will be returned in the response and should be filled through whatever custom logic is appropriate for the server's behavior.

Offset indicates how many bytes have already been transferred in prior firings of this event (which can occur when handling large sets of data) and provides the starting index for the current block of data.

Length indicates the size of the current block of data to be copied to the Buffer.

BytesRead must be set to the actual number of bytes copied into the Buffer at the end of the event.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

Event Order During Download Operations

When a download request is received, the component fires a series of events in the following order. Note that certain details like the number of levels of directories within which the target file resides may impact how events fire.

  1. SessionStart - Fires when a client initiates a session with the component and helps associate a unique session identifier with the request.
  2. CheckAccess - Fires when a client attempts to read or list a file or directory, and provides an opportunity to check access and permissions (optional).
  3. GetFileInfo - Fires to access metadata regarding the file or directory being read or listed.
  4. GetFile - Fires to provide a simple way for the component to serve a file by providing a filepath (optional).
  5. GetProperty - Fires to access custom metadata regarding the file or directory being read or listed (optional).
  6. ReadFile - Fires if GetFile was not used to serve the file and provides full control over response data.
  7. SessionEnd - Fires when a client successfully ends a session and allows closing out the session identifier.

RenameFile Event (DAVServer Component)

Fires when the component needs to rename or move a file or directory.

Syntax

public event OnRenameFileHandler OnRenameFile;

public delegate void OnRenameFileHandler(object sender, DAVServerRenameFileEventArgs e);

public class DAVServerRenameFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public bool MoveItem { get; }
  public string DestParentPath { get; }
  public string NewFileName { get; }
  public bool OverwriteExisting { get; }
  public int ResultCode { get; set; }
}
Public Event OnRenameFile As OnRenameFileHandler

Public Delegate Sub OnRenameFileHandler(sender As Object, e As DAVServerRenameFileEventArgs)

Public Class DAVServerRenameFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property MoveItem As Boolean
  Public ReadOnly Property DestParentPath As String
  Public ReadOnly Property NewFileName As String
  Public ReadOnly Property OverwriteExisting As Boolean
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to rename or move a file or directory is received. When a directory with its contents is moved, this event is fired only once for the directory itself.

During recursive moving, if a file or directory cannot be moved, moving should continue, but the event handler should set the ResultCode parameter to a non-zero value to communicate an error.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item to be renamed or moved is in the root directory, the value will be empty.

FileName identifies the name of the file or directory to be renamed or moved.

MoveItem specifies whether the file or directory is to be moved to a new parent directory. If this is true, the new parent directory is identified by DestParentPath; otherwise, only the name of the item is to be changed, and DestParentPath must be ignored.

DestParentPath contains the path of the new parent directory relative to the server root, but only if MoveFile is true. If the item is to be moved to the root directory, the value will be empty.

NewFileName contains the name of the newly-moved file or directory. If the name should remain the same, the value will be empty.

OverwriteExisting specifies whether the handler should overwrite an existing file if one already exists. If this is false and a destination item exists, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error. If this is true, the following rules apply:

  • If the destination item exists and is a file, it must be replaced by the source item, regardless of whether it is a file or directory.
  • If the destination item exists and is a directory, the event handler must return the DAVSDK_ERR_ALREADY_EXISTS error, as a directory cannot be overwritten.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

SessionEnd Event (DAVServer Component)

Fires when the component ends a session.

Syntax

public event OnSessionEndHandler OnSessionEnd;

public delegate void OnSessionEndHandler(object sender, DAVServerSessionEndEventArgs e);

public class DAVServerSessionEndEventArgs : EventArgs {
  public long SessionId { get; }
}
Public Event OnSessionEnd As OnSessionEndHandler

Public Delegate Sub OnSessionEndHandler(sender As Object, e As DAVServerSessionEndEventArgs)

Public Class DAVServerSessionEndEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
End Class

Remarks

This event fires when the component ends a previously started session. The component doesn't expect any errors to occur or be reported by handlers of this event.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

SessionStart Event (DAVServer Component)

Fires when the component starts a session.

Syntax

public event OnSessionStartHandler OnSessionStart;

public delegate void OnSessionStartHandler(object sender, DAVServerSessionStartEventArgs e);

public class DAVServerSessionStartEventArgs : EventArgs {
  public long SessionId { get; }
  public int ResultCode { get; set; }
}
Public Event OnSessionStart As OnSessionStartHandler

Public Delegate Sub OnSessionStartHandler(sender As Object, e As DAVServerSessionStartEventArgs)

Public Class DAVServerSessionStartEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a new session with a connected client begins. The lifetime of a session is a single HTTP request and response, meaning once the response has been sent, the session ends.

The SetSessionParam and GetSessionParam methods may be used to set and retrieve custom data associated with the session from within this event and any other event.

SessionId is the unique identifier of the session, assigned by the component. It is provided as a parameter in all other events so that the operations for a particular client session may be tracked.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

Reporting an error will abort the operation.

SetFileInfo Event (DAVServer Component)

Fires when the component needs to update times and attributes of a specific file or directory.

Syntax

public event OnSetFileInfoHandler OnSetFileInfo;

public delegate void OnSetFileInfoHandler(object sender, DAVServerSetFileInfoEventArgs e);

public class DAVServerSetFileInfoEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public int Attributes { get; }
  public DateTime CreationTime { get; }
  public DateTime LastModifiedTime { get; }
  public DateTime LastAccessTime { get; }
  public int ResultCode { get; set; }
}
Public Event OnSetFileInfo As OnSetFileInfoHandler

Public Delegate Sub OnSetFileInfoHandler(sender As Object, e As DAVServerSetFileInfoEventArgs)

Public Class DAVServerSetFileInfoEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Attributes As Integer
  Public ReadOnly Property CreationTime As DateTime
  Public ReadOnly Property LastModifiedTime As DateTime
  Public ReadOnly Property LastAccessTime As DateTime
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when the component receives a request to update times and attributes of a file or directory. To handle this event, file information should be updated on the target file or directory in accordance with the parameters provided in this event.

Note that the component does not update last access time or last modification time times when a file or directory is accessed or updated; this event only fires in response to received requests.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose information is to be updated is in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose information is to be updated.

Attributes may contain 0 if no attributes need to be updated or may be a combination of the following flags:

ITEM_ATTR_FILE0x00000001The item is a file.

ITEM_ATTR_DIRECTORY0x00000002The item is a directory.

ITEM_ATTR_READONLY0x00000040The file is read-only.

DAVServer does not block operations based on this attribute, but it does communicate the status of items and directories to clients based on this attribute.

ITEM_ATTR_ANY_FILE0x7FFFFFFFA mask which includes any and all attributes.

CreationTime contains a new value for the creation time attribute of the item.

LastModifiedTime contains a new value for the modification time attribute of the item.

LastAccessTime contains a new value for the last access time attribute of the item.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

SetFileSize Event (DAVServer Component)

Fires when the component needs to adjust the size of an open file.

Syntax

public event OnSetFileSizeHandler OnSetFileSize;

public delegate void OnSetFileSizeHandler(object sender, DAVServerSetFileSizeEventArgs e);

public class DAVServerSetFileSizeEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public long NewSize { get; }
  public int ResultCode { get; set; }
}
Public Event OnSetFileSize As OnSetFileSizeHandler

Public Delegate Sub OnSetFileSizeHandler(sender As Object, e As DAVServerSetFileSizeEventArgs)

Public Class DAVServerSetFileSizeEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property NewSize As Long
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when the component needs to adjust the size of an open file. To handle this event, the size of the target file should be updated based on the NewSize parameter.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file relative to the server root. If the file whose size is to be updated is in the root directory, the value will be empty.

FileName identifies the name of the file whose size is to be updated.

NewSize contains the new size of the file in bytes. The file size may be increased or decreased.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

SetProperty Event (DAVServer Component)

Fires when the component needs to add or update custom metadata to a file or directory.

Syntax

public event OnSetPropertyHandler OnSetProperty;

public delegate void OnSetPropertyHandler(object sender, DAVServerSetPropertyEventArgs e);

public class DAVServerSetPropertyEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string Namespace { get; }
  public string PropertyName { get; }
  public string Value { get; }
  public int ResultCode { get; set; }
}
Public Event OnSetProperty As OnSetPropertyHandler

Public Delegate Sub OnSetPropertyHandler(sender As Object, e As DAVServerSetPropertyEventArgs)

Public Class DAVServerSetPropertyEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Namespace As String
  Public ReadOnly Property PropertyName As String
  Public ReadOnly Property Value As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to add or update custom metadata to a file or directory is received.

Note that the component does not maintain these custom metadata properties internally. Developers making use of custom properties should maintain a dictionary or other data structure to store these property names and values, and within this event handler add or update the metadata value to the existing list.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item whose custom metadata is to be set is located in the root directory, the value will be empty.

FileName identifies the name of the file or directory whose custom metadata is to be set.

Namespace and PropertyName identify the name of the custom metadata property to be set.

Value contains the value of the specified custom metadata property for the file or directory.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

UnknownRequest Event (DAVServer Component)

Fires when the component does not recognize the request.

Syntax

public event OnUnknownRequestHandler OnUnknownRequest;

public delegate void OnUnknownRequestHandler(object sender, DAVServerUnknownRequestEventArgs e);

public class DAVServerUnknownRequestEventArgs : EventArgs {
  public long SessionId { get; }
  public string HttpMethod { get; }
  public string URI { get; }
  public string RequestHeaders { get; }
  public byte[] RequestBody { get; }
  public string ResponseHeaders { get; set; }
  public byte[] ResponseBody { get; set; }
  public int StatusCode { get; set; }
}
Public Event OnUnknownRequest As OnUnknownRequestHandler

Public Delegate Sub OnUnknownRequestHandler(sender As Object, e As DAVServerUnknownRequestEventArgs)

Public Class DAVServerUnknownRequestEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property HttpMethod As String
  Public ReadOnly Property URI As String
  Public ReadOnly Property RequestHeaders As String
  Public ReadOnly Property RequestBody As Byte()
  Public Property ResponseHeaders As String
  Public Property ResponseBody As Byte()
  Public Property StatusCode As Integer
End Class

Remarks

This event fires when a request that falls outside the operations understood by the component is received, providing access to the raw content of the request. Within this event, developers can implement any arbitrary logic to handle these unknown requests and then provide the full response headers and body to return to the client.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

HttpMethod indicates the HTTP method used in the HTTP request that triggered this event.

URI indicates the URI that identifies the target resource in the HTTP request.

RequestHeaders contains the headers used in the HTTP request provided as name-value pairs.

RequestBody contains the raw content of the body of the HTTP request.

ResponseHeaders should be set to the names and values of headers returned to the client in the HTTP response. As per HTTP standard, header names and values should be separated by a colon, and separate headers are separate strings in the array.

ResponseBody should be set to the raw content that will be sent in the body of the HTTP response.

StatusCode should be set to an appropriate error code from the Error Codes page.

UnlockFile Event (DAVServer Component)

Fires when the component needs to unlock a file or directory.

Syntax

public event OnUnlockFileHandler OnUnlockFile;

public delegate void OnUnlockFileHandler(object sender, DAVServerUnlockFileEventArgs e);

public class DAVServerUnlockFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public string LockToken { get; }
  public int ResultCode { get; set; }
}
Public Event OnUnlockFile As OnUnlockFileHandler

Public Delegate Sub OnUnlockFileHandler(sender As Object, e As DAVServerUnlockFileEventArgs)

Public Class DAVServerUnlockFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property LockToken As String
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to unlock a file or directory is received.

If the lock did not exist when this event was fired, the event handler must return the DAVSDK_ERR_LOCK_VIOLATION.

Note that the component does not maintain locks internally. Developers making use of locks should maintain a dictionary or other data structure to keep track of item lock information, and within this event handler check to see if a corresponding lock exists on the item that can be deleted.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file or directory relative to the server root. If the item to be unlocked is in the root directory, the value will be empty.

FileName identifies the name of the file or directory to be unlocked.

LockToken specifies the unique identifier for the lock to be removed.

ResultCode provides an opportunity to report the result of the operation. This will always be DAVSDK_ERR_NOT_IMPLEMENTED when the event is fired and should be set to 0 to indicate success or DAVSDK_ERR_LOCK_FAILED to indicate that a lock could not be created or removed specifically due to a conflict with another lock. Any other non-zero value indicates the lock could not be created or removed for other reasons.

UserAuthRequest Event (DAVServer Component)

Fires when the component attempts to authenticate a client.

Syntax

public event OnUserAuthRequestHandler OnUserAuthRequest;

public delegate void OnUserAuthRequestHandler(object sender, DAVServerUserAuthRequestEventArgs e);

public class DAVServerUserAuthRequestEventArgs : EventArgs {
  public string ConnectionId { get; }
  public string AuthMethod { get; }
  public string User { get; }
  public string Password { get; set; }
  public string Realm { get; }
  public string KerberosSPN { get; }
  public bool Accept { get; set; }
}
Public Event OnUserAuthRequest As OnUserAuthRequestHandler

Public Delegate Sub OnUserAuthRequestHandler(sender As Object, e As DAVServerUserAuthRequestEventArgs)

Public Class DAVServerUserAuthRequestEventArgs Inherits EventArgs
  Public ReadOnly Property ConnectionId As String
  Public ReadOnly Property AuthMethod As String
  Public ReadOnly Property User As String
  Public Property Password As String
  Public ReadOnly Property Realm As String
  Public ReadOnly Property KerberosSPN As String
  Public Property Accept As Boolean
End Class

Remarks

When the ProcessingMode property is set to modeEmbeddedServer, this event provides access to the authentication credentials that a client supplies when attempting to connect. Within this event, developers have the ability to validate credentials using whatever logic is appropriate. Note that the component does not directly validate or invalidate the credentials.

ConnectionId specifies the unique identifier that distinguishes this connection from other connections, even from the same client.

AuthMethod identifies the type of authentication the client is attempting to perform. This value is taken from the HTTP headers of the connection request.

User contains the user the client claims to be. If applicable, this value is taken from the HTTP headers of the connection request.

Password contains the password supplied by the client. If applicable, this value is taken from the HTTP headers of the connection request.

Realm indicates the authentication group for the client, e.g. for Kerberos authentication.

KerberosSPN indicates the Service Principal Name, or service that the client is attempting to authenticate for (when using Kerberos authentication).

Accept should be set to true in order to successfully authenticate the client or false in order to deny the client's connection request.

WriteFile Event (DAVServer Component)

Fires when the component needs to store file data.

Syntax

public event OnWriteFileHandler OnWriteFile;

public delegate void OnWriteFileHandler(object sender, DAVServerWriteFileEventArgs e);

public class DAVServerWriteFileEventArgs : EventArgs {
  public long SessionId { get; }
  public string Path { get; }
  public string FileName { get; }
  public byte[] Data { get; }
  public long Offset { get; }
  public int Length { get; }
  public int ResultCode { get; set; }
}
Public Event OnWriteFile As OnWriteFileHandler

Public Delegate Sub OnWriteFileHandler(sender As Object, e As DAVServerWriteFileEventArgs)

Public Class DAVServerWriteFileEventArgs Inherits EventArgs
  Public ReadOnly Property SessionId As Long
  Public ReadOnly Property Path As String
  Public ReadOnly Property FileName As String
  Public ReadOnly Property Data As Byte()
  Public ReadOnly Property Offset As Long
  Public ReadOnly Property Length As Integer
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when a request to upload file data is received and and that request was not already satisfied within the PutFile event.

Any failure to write any part of the data should be reported as an error.

SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.

Path identifies the path of the file relative to the server root. If the file is to be uploaded in the root directory, the value will be empty.

FileName contains the name of the file to be uploaded.

Data contains the block of data that the server should store. This data comes from the inbound request and the component imposes no restrictions on how this data should be treated.

Offset indicates how many bytes have already been transferred in prior firings of this event (which can occur when handling large sets of data) and provides the starting index for the current block of data.

Length indicates the size of the current block of data to be written.

ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), this must be set to a non-zero value.

Event Order During Upload Operations

When an upload request is received, the component fires a series of events in the following order. Note that certain details like the number of levels of directories within which the target file resides may impact how events fire.

  1. SessionStart - Fires when a client initiates a session with the component and helps associate a unique session identifier with the request.
  2. CheckAccess - Fires when a client attempts to list or write a file or directory and provides an opportunity to check access and permissions (optional).
  3. GetFileInfo - Fires to access metadata regarding the file or directory being written or listed.
  4. PutFile - Fires to provide a simple way for the component to store file data by setting a filepath (optional).
  5. GetFileLocks - Fires when the component needs to check or acquire locks to the file being written.
  6. CreateFile - Fires when the component is asked to create a file that does not already exist.
  7. WriteFile - Fires if PutFile was not used to store the file and provides full control over inbound upload data.
  8. SessionEnd - Fires when a client successfully ends a session and allows closing out the session identifier.

Certificate Type

This is the digital certificate being used.

Remarks

This type describes the current digital certificate. The certificate may be a public or private key. The fields are used to identify or select certificates.

The following fields are available:

Fields

EffectiveDate
string (read-only)

Default: ""

The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2000 15:00:00.

ExpirationDate
string (read-only)

Default: ""

The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:

23-Jan-2001 15:00:00.

ExtendedKeyUsage
string (read-only)

Default: ""

A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).

Fingerprint
string (read-only)

Default: ""

The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02

FingerprintSHA1
string (read-only)

Default: ""

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: 30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84

FingerprintSHA256
string (read-only)

Default: ""

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.

The following example illustrates the format: 6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53

Issuer
string (read-only)

Default: ""

The issuer of the certificate. This field contains a string representation of the name of the issuing authority for the certificate.

PrivateKey
string (read-only)

Default: ""

The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.

Note: The PrivateKey may be available but not exportable. In this case, PrivateKey returns an empty string.

PrivateKeyAvailable
bool (read-only)

Default: False

Whether a PrivateKey is available for the selected certificate. If PrivateKeyAvailable is True, the certificate may be used for authentication purposes (e.g., server authentication).

PrivateKeyContainer
string (read-only)

Default: ""

The name of the PrivateKey container for the certificate (if available). This functionality is available only on Windows platforms.

PublicKey
string (read-only)

Default: ""

The public key of the certificate. The key is provided as PEM/Base64-encoded data.

PublicKeyAlgorithm
string (read-only)

Default: ""

The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.

PublicKeyLength
int (read-only)

Default: 0

The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.

SerialNumber
string (read-only)

Default: ""

The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.

SignatureAlgorithm
string (read-only)

Default: ""

The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.

Store
string

Default: "MY"

The name of the certificate store for the client certificate.

The StoreType field denotes the type of the certificate store specified by Store. If the store is password-protected, specify the password in StorePassword.

Store is used in conjunction with the Subject field to specify client certificates. If Store has a value, and Subject or Encoded is set, a search for a certificate is initiated. Please see the Subject field for details.

Designations of certificate stores are platform dependent.

The following designations are the most common User and Machine certificate stores in Windows:

MYA certificate store holding personal certificates with their associated private keys.
CACertifying authority certificates.
ROOTRoot certificates.

When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).

StoreB
byte []

Default: "MY"

The name of the certificate store for the client certificate.

The StoreType field denotes the type of the certificate store specified by Store. If the store is password-protected, specify the password in StorePassword.

Store is used in conjunction with the Subject field to specify client certificates. If Store has a value, and Subject or Encoded is set, a search for a certificate is initiated. Please see the Subject field for details.

Designations of certificate stores are platform dependent.

The following designations are the most common User and Machine certificate stores in Windows:

MYA certificate store holding personal certificates with their associated private keys.
CACertifying authority certificates.
ROOTRoot certificates.

When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).

StorePassword
string

Default: ""

If the type of certificate store requires a password, this field is used to specify the password needed to open the certificate store.

StoreType
CertStoreTypes

Default: 0

The type of certificate store for this certificate.

The component supports both public and private keys in a variety of formats. When the cstAuto value is used, the component will automatically determine the type. This field can take one of the following values:

0 (cstUser - default)For Windows, this specifies that the certificate store is a certificate store owned by the current user.

Note: This store type is not available in Java.

1 (cstMachine)For Windows, this specifies that the certificate store is a machine store.

Note: This store type is not available in Java.

2 (cstPFXFile)The certificate store is the name of a PFX (PKCS#12) file containing certificates.
3 (cstPFXBlob)The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format.
4 (cstJKSFile)The certificate store is the name of a Java Key Store (JKS) file containing certificates.

Note: This store type is only available in Java.

5 (cstJKSBlob)The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format.

Note: This store type is only available in Java.

6 (cstPEMKeyFile)The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate.
7 (cstPEMKeyBlob)The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate.
8 (cstPublicKeyFile)The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate.
9 (cstPublicKeyBlob)The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate.
10 (cstSSHPublicKeyBlob)The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key.
11 (cstP7BFile)The certificate store is the name of a PKCS#7 file containing certificates.
12 (cstP7BBlob)The certificate store is a string (binary) representing a certificate store in PKCS#7 format.
13 (cstSSHPublicKeyFile)The certificate store is the name of a file that contains an SSH-style public key.
14 (cstPPKFile)The certificate store is the name of a file that contains a PPK (PuTTY Private Key).
15 (cstPPKBlob)The certificate store is a string (binary) that contains a PPK (PuTTY Private Key).
16 (cstXMLFile)The certificate store is the name of a file that contains a certificate in XML format.
17 (cstXMLBlob)The certificate store is a string that contains a certificate in XML format.
18 (cstJWKFile)The certificate store is the name of a file that contains a JWK (JSON Web Key).
19 (cstJWKBlob)The certificate store is a string that contains a JWK (JSON Web Key).
21 (cstBCFKSFile)The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store).

Note: This store type is only available in Java and .NET.

22 (cstBCFKSBlob)The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format.

Note: This store type is only available in Java and .NET.

23 (cstPKCS11)The certificate is present on a physical security key accessible via a PKCS#11 interface.

To use a security key, the necessary data must first be collected using the CertMgr component. The ListStoreCertificates method may be called after setting CertStoreType to cstPKCS11, CertStorePassword to the PIN, and CertStore to the full path of the PKCS#11 DLL. The certificate information returned in the CertList event's CertEncoded parameter may be saved for later use.

When using a certificate, pass the previously saved security key information as the Store and set StorePassword to the PIN.

Code Example. SSH Authentication with Security Key: certmgr.CertStoreType = CertStoreTypes.cstPKCS11; certmgr.OnCertList += (s, e) => { secKeyBlob = e.CertEncoded; }; certmgr.CertStore = @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll"; certmgr.CertStorePassword = "123456"; //PIN certmgr.ListStoreCertificates(); sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11, secKeyBlob, "123456", "*"); sftp.SSHUser = "test"; sftp.SSHLogon("myhost", 22);

99 (cstAuto)The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically.

SubjectAltNames
string (read-only)

Default: ""

Comma-separated lists of alternative subject names for the certificate.

ThumbprintMD5
string (read-only)

Default: ""

The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

ThumbprintSHA1
string (read-only)

Default: ""

The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

ThumbprintSHA256
string (read-only)

Default: ""

The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.

Usage
string (read-only)

Default: ""

The text description of UsageFlags.

This value will be one or more of the following strings and will be separated by commas:

  • Digital Signature
  • Non-Repudiation
  • Key Encipherment
  • Data Encipherment
  • Key Agreement
  • Certificate Signing
  • CRL Signing
  • Encipher Only

If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.

UsageFlags
int (read-only)

Default: 0

The flags that show intended use for the certificate. The value of UsageFlags is a combination of the following flags:

0x80Digital Signature
0x40Non-Repudiation
0x20Key Encipherment
0x10Data Encipherment
0x08Key Agreement
0x04Certificate Signing
0x02CRL Signing
0x01Encipher Only

Please see the Usage field for a text representation of UsageFlags.

This functionality currently is not available when the provider is OpenSSL.

Version
string (read-only)

Default: ""

The certificate's version number. The possible values are the strings "V1", "V2", and "V3".

Subject
string

Default: ""

The subject of the certificate used for client authentication.

This field will be populated with the full subject of the loaded certificate. When loading a certificate, the subject is used to locate the certificate in the store.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:

FieldMeaning
CNCommon Name. This is commonly a hostname like www.server.com.
OOrganization
OUOrganizational Unit
LLocality
SState
CCountry
EEmail Address

If a field value contains a comma, it must be quoted.

Encoded
string

Default: ""

The certificate (PEM/Base64 encoded). This field is used to assign a specific certificate. The Store and Subject fields also may be used to specify a certificate.

When Encoded is set, a search is initiated in the current Store for the private key of the certificate. If the key is found, Subject is updated to reflect the full subject of the selected certificate; otherwise, Subject is set to an empty string.

EncodedB
byte []

Default: ""

The certificate (PEM/Base64 encoded). This field is used to assign a specific certificate. The Store and Subject fields also may be used to specify a certificate.

When Encoded is set, a search is initiated in the current Store for the private key of the certificate. If the key is found, Subject is updated to reflect the full subject of the selected certificate; otherwise, Subject is set to an empty string.

Constructors

public Certificate();
Public Certificate()

Creates a instance whose properties can be set.

public Certificate(string certificateFile);
Public Certificate(ByVal CertificateFile As String)

Opens CertificateFile and reads out the contents as an X.509 public key.

public Certificate(byte[] encoded);
Public Certificate(ByVal Encoded As Byte())

Parses Encoded as an X.509 public key.

public Certificate(CertStoreTypes storeType, string store, string storePassword, string subject);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As String, ByVal StorePassword As String, ByVal Subject As String)

StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a file containing the certificate store. StorePassword is the password used to protect the store.

After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.

public Certificate(CertStoreTypes storeType, string store, string storePassword, string subject, string configurationString);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As String, ByVal StorePassword As String, ByVal Subject As String, ByVal ConfigurationString As String)

StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a file containing the certificate store. StorePassword is the password used to protect the store.

ConfigurationString is a newline-separated list of name-value pairs that may be used to modify the default behavior. Possible values include "PersistPFXKey", which shows whether or not the PFX key is persisted after performing operations with the private key. This correlates to the PKCS12_NO_PERSIST_KEY CryptoAPI option. The default value is True (the key is persisted). "Thumbprint" - an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load. When specified, this value is used to select the certificate in the store. This is applicable to the cstUser , cstMachine , cstPublicKeyFile , and cstPFXFile store types. "UseInternalSecurityAPI" shows whether the platform (default) or the internal security API is used when performing certificate-related operations.

After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.

public Certificate(CertStoreTypes storeType, string store, string storePassword, byte[] encoded);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As String, ByVal StorePassword As String, ByVal Encoded As Byte())

StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a file containing the certificate store. StorePassword is the password used to protect the store.

After the store has been successfully opened, the component will load Encoded as an X.509 certificate and search the opened store for a corresponding private key.

public Certificate(CertStoreTypes storeType, byte[] store, string storePassword, string subject);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As Byte(), ByVal StorePassword As String, ByVal Subject As String)

StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a byte array containing the certificate data. StorePassword is the password used to protect the store.

After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.

public Certificate(CertStoreTypes storeType, byte[] store, string storePassword, string subject, string configurationString);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As Byte(), ByVal StorePassword As String, ByVal Subject As String, ByVal ConfigurationString As String)

StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a byte array containing the certificate data. StorePassword is the password used to protect the store.

After the store has been successfully opened, the component will attempt to find the certificate identified by Subject . This can be either a complete or a substring match of the X.509 certificate's subject Distinguished Name (DN). The Subject parameter can also take an MD5, SHA-1, or SHA-256 thumbprint of the certificate to load in a "Thumbprint=value" format.

public Certificate(CertStoreTypes storeType, byte[] store, string storePassword, byte[] encoded);
Public Certificate(ByVal StoreType As CertStoreTypes, ByVal Store As Byte(), ByVal StorePassword As String, ByVal Encoded As Byte())

StoreType identifies the type of certificate store to use. See for descriptions of the different certificate stores. Store is a byte array containing the certificate data. StorePassword is the password used to protect the store.

After the store has been successfully opened, the component will load Encoded as an X.509 certificate and search the opened store for a corresponding private key.

ServerSettings Type

The embedded HTTP server settings used by the component.

Remarks

This type describes the current embedded HTTP server settings used by the component. The fields are used to configure the server.

The following fields are available:

Fields

AllowedAuthMethods
string

Default: "None,Basic,Digest,NTLM,Kerberos"

Specifies the authentication schemes that the component will allow.

This field must be set to a valid comma-separated string of authentication scheme values that the embedded server will allow. Possible values are as follows:

  • None: Unauthenticated connection requests will be allowed.
  • Basic: HTTP Basic authentication is allowed.
  • Digest: Digest authentication is allowed.
  • NTLM: NTLM authentication is allowed.
  • Kerberos: Windows Negotiate (Kerberos) authentication is allowed.

LocalHost
string

Default: ""

Specifies the name of the local host or user-assigned IP interface through which connections are initiated or accepted.

This field contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the IP address of an interface will make the component initiate connections (or accept in the case of server components) only through that interface. It is recommended to provide an IP address rather than a hostname when setting this field to ensure the desired interface is used.

If the component is connected, the LocalHost field shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

Note: LocalHost is not persistent. You must always set it in code, and never in the property window.

LocalPort
int

Default: 0

Includes the Transmission Control Protocol (TCP) port in the local host where the component listens.

This field must be set before the component can start listening. If this is set to 0, then the TCP/IP subsystem will pick a port number at random.

The service port is not shared among servers, so two components cannot be listening on the same port at the same time.

Timeout
int

Default: 60

Specifies the timeout in seconds for the component.

If this is set to 0, all operations will run uninterrupted until successful completion or an error condition is encountered.

If this is set to a positive value, the component will wait for the operation to complete before returning control.

If the timeout expires, and the operation is not yet complete, the component throws an exception.

Note that all timeouts are inactivity timeouts, meaning the timeout period is extended by the value specified in this field when any amount of data is successfully sent or received.

Constructors

public ServerSettings();
Public ServerSettings()

Creates an empty settings instance whose properties can be set.

Config Settings (DAVServer Component)

The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

DAVServer Config Settings

EnableRecursiveDirectoryListings:   Whether directories may be enumerated recursively.

This setting tells the component whether an ListDirectory event may be fired with its Recursive parameter being set to true.

When the setting is enabled (by default) and a client requests a recursive enumeration, the component fires the ListDirectory event just for the directory being enumerated.

When the setting is disabled, the component fires the ListDirectory event for each directory and all of its subdirectories separately, merging all results before serving the client's request. The event handler should then return all matching files and directories in whatever order, and the component will sort the list and select a range of files and directories to provide to the transport and a client. This mode can be slower when a directory contains many items, and the client makes "paged" requests for a small batch of items per request.

FireCheckAccessEvent:   Whether the CheckAccess event is fired.

This setting specifies whether the CheckAccess event is fired, which may be used to control and optionally restrict access to file and directories.

By default, this setting is enabled, meaning the CheckAccess event is fired, but this setting may be disabled to improve performance.

LogLevel:   The level of detail that is logged.

This configuration setting controls the level of detail that is logged through the Log event. Possible values are as follows:

0 (None) No information is logged.
1 (Errors) Only errors are logged.
2 (Warnings) Errors and warnings are logged.
3 (Information) Errors, warnings, and informational messages are logged.
4 (Debug) Debug information is logged.

LogRequestBody:   Whether bodies of requests are logged on Debug log level.

This configuration setting specifies whether text, binary, or all request bodies must be logged when LogLevel is set to Debug. Possible values are as follows:

0 (None) No information is logged.
1 (Errors) Only errors are logged.
2 (Warnings) Errors and warnings are logged.
3 (Information) Errors, warnings, and informational messages are logged.
4 (Debug) Debug information is logged.

LogResponseBody:   Whether bodies of responses are logged on Debug log level.

This configuration setting specifies whether text, binary, or all response bodies must be logged when LogLevel is set to Debug. Possible values are as follows:

0 (None - Default) No bodies are logged.
1 (Text) Only bodies of the data, for which the Content-Type header denotes a human-readable text format, are logged. Examples include text/*, all application/*json and all application/*xml values.
2 (Binary) Only bodies of the data, for which the Content-Type header does not denote a text format, are logged.
3 (All) All bodies are logged.

ReadOnly:   Whether the server works in read-only mode.

This setting specifies whether the server operates in read-only mode. In this mode, all operations that modify the state of the server are forbidden. This includes moving or deleting files, uploading new files, creation of directories, creation of shares. The setting works by forbidding any HTTP verbs except GET and HEAD (which are used for downloading files and listing directories).

By default, read-only mode is disabled.

ServerDAVURIPrefix:   The endpoint prefix used by the server to serve requests.

This setting defines the endpoint prefix that the component will use to serve requests.

By default, this setting is set to dav, meaning the component serves requests at the /server/dav endpoint.

UseSimpleFileEnumeration:   Whether an enumeration is performed with additional parameters.

This setting tells the component whether a ListDirectory event handler should deal with advanced parameters (Mask, StartAt, StartAfter, MaxFiles, OrderBy, and ReverseOrder) or not. This setting is disabled by default, and the event handler must handle all parameters as set by the transport during enumeration. When the setting is enabled, the event handler may return all matching files and directories in any order, and the component will sort the list and select a range of files and directories to provide to the transport and a client.

Trappable Errors (DAVServer Component)

The component uses the error codes listed below. They are also available as constants for applications' convenience.

Please refer to the Error Handling topic for more information.

DAVServer Errors

0    DAVSDK_ERR_OK: Success.
2   DAVSDK_ERR_FILE_NOT_FOUND: File or directory not found.
3   DAVSDK_ERR_PATH_NOT_FOUND: Path or parent not found.
4   DAVSDK_ERR_PROPERTY_NOT_FOUND: Property not found.
5   DAVSDK_ERR_ACCESS_DENIED: Access Denied. Used to signal insufficient permissions for item access.
6   DAVSDK_ERR_INVALID_HANDLE: Invalid item handle. Used to signal an invalid value in various *Context and *Handle parameters. Can be returned by both the component's methods and application event handlers.
29   DAVSDK_ERR_WRITE_FAULT: The operation of writing the data to the backend storage has failed or has been denied by the storage.
30   DAVSDK_ERR_READ_FAULT: The operation of reading the data from the backend storage has failed or has been denied by the storage.
31   DAVSDK_ERR_GENERAL_FAILURE: General failure. The reason for the failure could not be determined.
33   DAVSDK_ERR_LOCK_VIOLATION: Lock violation. When reported by an event handler, should be used when the file is locked and the operation is not possible due to this lock.
86   DAVSDK_ERR_INVALID_PASSWORD: A password is missing or incorrect. Returned by the component in the REST API when an access is attempted to a share that is password-protected, but a password is either missing or incorrect.
87   DAVSDK_ERR_INVALID_PARAMETER: Invalid parameter. When returned by the component's method, indicates an unacceptable value of one of the parameters (please refer to the exception message for additional details). When reported by an event handler, should be used only to signal logical errors in the code (e.g. a negative position passed by the component during file reading/writing) and not to communicate something that an event handler cannot handle temporarily or permanently, e.g. due to the backend's limits or some external state.
120   DAVSDK_ERR_NOT_IMPLEMENTED: The requested operation is either not implemented by an application or has been disabled using the properties and settings.
167   DAVSDK_ERR_LOCK_FAILED: A Lock or Unlock operation failed.
183   DAVSDK_ERR_ALREADY_EXISTS: An item already exists. When reported by an event handler, should be used to indicate that the operation such as creation, moving, or copying of the item cannot be accomplished because at the destination, there already exists an item with the given name or Id.
348   DAVSDK_ERR_ITEM_READONLY: An item cannot be moved, deleted, or written to because it is read-only.
995   DAVSDK_ERR_OPERATION_ABORTED: An operation has been aborted on the transport level (e.g. due to the premature closing of a socket by the client).
1127   DAVSDK_ERR_DISK_OPERATION_FAILED: A catch-all error code that can be used to tell the component that a backend filesystem operation has failed.
1296   DAVSDK_ERR_CONTENT_BLOCKED: An upload or download operation was blocked by the application, likely due to invalid content.
3060   DAVSDK_ERR_CONDITION_NOT_SATISFIED: The HTTP request contained conditions (such as modification period, range of data in a file, or etag) that could not be satisfied.