Click or drag to resize

IFolderCreateFile Method

IT Hit WebDAV Classes Reference
Creates new WebDAV file with the specified name in this folder.

Namespace: ITHit.WebDAV.Server.Class1
Assembly: ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 4.5.3121.0
Syntax
IFile CreateFile(
	string name
)

Parameters

name
Type: SystemString
Name of the file to create.

Return Value

Type: IFile
.
Exceptions
ExceptionCondition
LockedExceptionThis folder was locked. Client did not provide the lock token.
NeedPrivilegesExceptionThe user doesn't have enough privileges.
InsufficientStorageExceptionQuota limit is reached.
DavExceptionIn other cases.
Remarks
You must create a file in your repository during this call. After calling this method Engine calls Write(Stream, String, Int64, Int64).
Examples

The code below is part of 'WebDAVServer.NtfsStorage' sample provided with the SDK.

public IFile CreateFile(string name)
{
    RequireHasToken();
    string fileName = System.IO.Path.Combine(fileSystemInfo.FullName, name);

    context.FileOperation(
        this,
        () => new FileStream(fileName, FileMode.CreateNew).Dispose(),
        Privilege.Bind);

    return (IFile) context.GetHierarchyItem(Path + EncodeUtil.EncodeUrlPart(name));
}
See Also