Beispiel #1
0
        static void Main(string[] args)
        {
            NetworkCredential credential = new NetworkCredential("username", "password");
            WebdavSession     session    = new WebdavSession(credential);
            Resource          resource   = new Resource(session);

            PropertyName[] propertyName = new PropertyName[5];

            propertyName[0] = DavProperty.DisplayName;
            propertyName[1] = DavProperty.CreationDate;
            propertyName[2] = DavProperty.GetLastModified;
            propertyName[3] = DavProperty.GetContentLength;
            propertyName[4] = DavProperty.IsCollection;

            ResourceInfo[] info = resource.List("http://myserver/dav", propertyName);

            for (int i = 0; i < info.Length; i++)
            {
                Property displayName      = info[i].Properties[DavProperty.DisplayName];
                Property creationDate     = info[i].Properties[DavProperty.CreationDate];
                Property getLastModified  = info[i].Properties[DavProperty.GetLastModified];
                Property getContentLength = info[i].Properties[DavProperty.GetContentLength];
                Property isCollection     = info[i].Properties[DavProperty.IsCollection];

                Console.WriteLine(info[i].Address);

                if (displayName != null)
                {
                    Console.WriteLine(displayName.Value);
                }

                if (creationDate != null)
                {
                    Console.WriteLine(creationDate.Value);
                }

                if (getLastModified != null)
                {
                    Console.WriteLine(getLastModified.Value);
                }

                if (getContentLength != null)
                {
                    Console.WriteLine(getContentLength.Value);
                }

                if (isCollection != null)
                {
                    Console.WriteLine(isCollection.Value);
                }

                Console.WriteLine("-------------------------------------------------------------------");
            }

            //Press ENTER to exit.
            Console.Read();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            NetworkCredential credential = new NetworkCredential("username", "password");
            WebdavSession     session    = new WebdavSession(credential);
            Resource          resource   = new Resource(session);

            string[] list = resource.List("http://myserver/dav/", true);

            for (int i = 0; i < list.Length; i++)
            {
                Console.WriteLine(list[i]);
            }

            //Press ENTER to exit.
            Console.Read();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            NetworkCredential credential = new NetworkCredential("admin", "admin");
            WebdavSession     session    = new WebdavSession(credential);
            Resource          resource   = new Resource(session);

            string[] list = resource.List("http://192.168.10.242/owncloud/remote.php/webdav/");

            for (int i = 0; i < list.Length; i++)
            {
                Console.WriteLine(list[i]);
            }

            //Press ENTER to exit.
            Console.Read();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            //Basic or Digest authentication
            NetworkCredential credential = new NetworkCredential("username", "password");

            //Windows Integrated Authentication
            //ICredentials credential = CredentialCache.DefaultCredentials;

            WebdavSession session  = new WebdavSession(credential);
            Resource      resource = new Resource(session);

            string[] list = resource.List("http://myserver/dav/");

            for (int i = 0; i < list.Length; i++)
            {
                Console.WriteLine(list[i]);
            }

            //Press ENTER to exit.
            Console.Read();
        }