Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET
>
Tutorial
> Check file or folder existence
This example shows you how to check file or folder existence.
C# example
using System; using System.Net; using Independentsoft.Webdav; namespace Sample { class Program { static void Main(string[] args) { NetworkCredential credential = new NetworkCredential("username", "password"); WebdavSession session = new WebdavSession(credential); Resource resource = new Resource(session); bool exist = resource.Exists("http://myserver/dav/MyFolder"); if (exist) { Console.WriteLine("Folder exists"); } else { Console.WriteLine("Folder does not exist"); } Console.Read(); } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Webdav Namespace Sample Class Module1 Shared Sub Main(ByVal args() As String) Dim credential As NetworkCredential = New NetworkCredential("username", "password") Dim session As WebdavSession = New WebdavSession(credential) Dim resource As Resource = New Resource(session) Dim exist As Boolean = resource.Exists("http://myserver/dav/MyFolder") If (exist) Then Console.WriteLine("Folder exists") Else Console.WriteLine("Folder does not exist") End If Console.Read() End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*