IFolderAsyncCreateFileAsync 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: 11.3.10719
Syntax Task<IFileAsync> CreateFileAsync(
string name
)
Task<IFileAsync> CreateFileAsync(
string name
)
Function CreateFileAsync (
name As String
) As Task(Of IFileAsync)
Function CreateFileAsync (
name As String
) As Task(Of IFileAsync)
Task<IFileAsync^>^ CreateFileAsync(
String^ name
)
Task<IFileAsync^>^ CreateFileAsync(
String^ name
)
abstract CreateFileAsync :
name : string -> Task<IFileAsync>
abstract CreateFileAsync :
name : string -> Task<IFileAsync>
Parameters
- name
- Type: SystemString
Name of the file to create.
Return Value
Type:
TaskIFileAsync
New file instance created in this call.
Exceptions Remarks You must create a file in your repository during this call. After calling this method Engine calls
[!:IContentAsync.WriteAsync].
Examples The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.
public async Task<IFileAsync> CreateFileAsync(string name)
{
await RequireHasTokenAsync();
string fileName = System.IO.Path.Combine(fileSystemInfo.FullName, name);
using (FileStream stream = new FileStream(fileName, FileMode.CreateNew))
{
}
await context.socketService.NotifyCreatedAsync(System.IO.Path.Combine(Path, name));
return (IFileAsync)await context.GetHierarchyItemAsync(Path + EncodeUtil.EncodeUrlPart(name));
}
Public Async Function CreateFileAsync(name As String) As Task(Of IFileAsync) Implements IFolderAsync.CreateFileAsync
Await RequireHasTokenAsync()
Dim fileName As String = System.IO.Path.Combine(fileSystemInfo.FullName, name)
Using stream As FileStream = New FileStream(fileName, FileMode.CreateNew)
End Using
Await context.socketService.NotifyCreatedAsync(System.IO.Path.Combine(Path, name))
Return CType(Await context.GetHierarchyItemAsync(Path & EncodeUtil.EncodeUrlPart(name)), IFileAsync)
End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also