Namespace: ITHit.WebDAV.Server.Class1
Exception | Condition |
---|---|
LockedException | This folder was locked. Client did not provide the lock token. |
NeedPrivilegesException | The user doesn't have enough privileges. |
InsufficientStorageException | Quota limit is reached. |
DavException | In other cases. |
The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.
virtual public async Task<IFolder> CreateFolderAsync(string name) { await CreateFolderInternalAsync(name); DavFolder folder = (DavFolder)await context.GetHierarchyItemAsync(Path + EncodeUtil.EncodeUrlPart(name)); await context.socketService.NotifyCreatedAsync(System.IO.Path.Combine(Path, EncodeUtil.EncodeUrlPart(name)), GetWebSocketID()); return folder; } private async Task CreateFolderInternalAsync(string name) { await RequireHasTokenAsync(); bool isRoot = dirInfo.Parent == null; DirectoryInfo di = isRoot ? new DirectoryInfo(@"\\?\" + context.RepositoryPath.TrimEnd(System.IO.Path.DirectorySeparatorChar)) : dirInfo; di.CreateSubdirectory(name); }
The code below is part of 'WebDAVServer.FileSystemSynchronization.AspNetCore' C# & VB samples provided with the SDK.
virtual public async Task<IFolder> CreateFolderAsync(string name) { await CreateFolderInternalAsync(name); DavFolder folder = (DavFolder)await context.GetHierarchyItemAsync(Path + EncodeUtil.EncodeUrlPart(name)); await context.socketService.NotifyCreatedAsync(System.IO.Path.Combine(Path, EncodeUtil.EncodeUrlPart(name)), GetWebSocketID()); return folder; } private async Task CreateFolderInternalAsync(string name) { await RequireHasTokenAsync(); bool isRoot = dirInfo.Parent == null; DirectoryInfo di = isRoot ? new DirectoryInfo(@"\\?\" + context.RepositoryPath.TrimEnd(System.IO.Path.DirectorySeparatorChar)) : dirInfo; // delete hidden folder string folderPath = System.IO.Path.Combine(di.FullName, name); if (Directory.Exists(folderPath) && new DirectoryInfo(folderPath).Attributes.HasFlag(FileAttributes.Hidden)) { Directory.Delete(folderPath, true); } di.CreateSubdirectory(name); }