Click or drag to resize

IFile Interface

IT Hit WebDAV Classes Reference
Represents a file on a WebDAV server.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax
public interface IFile : IItemContent, IHierarchyItem, 
	IConnectionSettings

The IFile type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleActiveLocks
Array of item's lock descriptions.
(Inherited from IHierarchyItem.)
Public propertyAllowWriteStreamBuffering
Gets or sets a value that indicates whether to buffer the data sent to server.
(Inherited from IConnectionSettings.)
Public propertyCode exampleCheckedOut
Provides information whether item is in checked-in or checked-out state.
Public propertyCode exampleContentLength
Length of the file content.
(Inherited from IItemContent.)
Public propertyContentType
Content type of the file.
(Inherited from IItemContent.)
Public propertyCreationDate
The date item was created.
(Inherited from IHierarchyItem.)
Public propertyDisplayName
User friendly item name.
(Inherited from IHierarchyItem.)
Public propertyEtag
Gets entity tag - string that identifies current state of file's content.
(Inherited from IItemContent.)
Public propertyHref
This item path on the server.
(Inherited from IHierarchyItem.)
Public propertyItemType
Type of the item (File, Folder, Version or VersionHistory)
(Inherited from IHierarchyItem.)
Public propertyLastModified
Most recent modification date.
(Inherited from IHierarchyItem.)
Public propertyCode exampleProperties (Inherited from IHierarchyItem.)
Public propertyResumableUpload
Returns instance of IResumableUpload to manage partially failed uploads.
(Inherited from IItemContent.)
Public propertySendChunked
Gets or sets a value that indicates whether to send data in segments.
(Inherited from IConnectionSettings.)
Public propertySupportedLock
Lock types supported by the item.
(Inherited from IHierarchyItem.)
Public propertyTimeOut
Sets and gets time-out in milliseconds.
(Inherited from IConnectionSettings.)
Public propertyCode exampleVersionControlled
Provides information whether item is under version control.
Top
Methods
  NameDescription
Public methodCode exampleCheckIn
Creates new version.
Public methodCode exampleCheckIn(String)
Creates new version.
Public methodCode exampleCheckOut
Allow modifications to the content and custom properties of this version-controlled resource.
Public methodCode exampleCheckOut(String)
Allow modifications to the content and custom properties of this version-controlled file.
Public methodCode exampleCopyTo(IFolder, String, Boolean, Boolean)
Copies this item to destination folder.
(Inherited from IHierarchyItem.)
Public methodCode exampleCopyTo(IFolder, String, Boolean, Boolean, LockUriTokenPair)
Copies this item to destination folder.
(Inherited from IHierarchyItem.)
Public methodCode exampleDelete
Deletes this item.
(Inherited from IHierarchyItem.)
Public methodDelete(String)
Deletes this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleDelete(LockUriTokenPair)
Deletes this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleDownload
Downloads content of the file to a file specified by filename
(Inherited from IItemContent.)
Public methodCode exampleGetActiveLocks Obsolete.
Retrieves lock information about this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleGetAllProperties
Retrieves all custom properties exposed by the item.
(Inherited from IHierarchyItem.)
Public methodGetAutoVersion
Determines how checked-in item responds to WebDAV client attempts to modify its content or properties.
Public methodGetComment
Brief comment about an item that is suitable for presentation to a user.
(Inherited from IHierarchyItem.)
Public methodGetCreatorDisplayName
Contains a description of the creator of the item that is suitable for presentation to a user.
(Inherited from IHierarchyItem.)
Public methodGetCurrentVersion
Current item version. Null, if item is not under version control.
Public methodCode exampleGetParent
Retrieves parent hierarchy item of this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleGetPropertyNames
Returns names of all custom properties exposed by this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleGetPropertyValues
Retrieves values of specific properties.
(Inherited from IHierarchyItem.)
Public methodCode exampleGetReadStream
Loads content of the file from WebDAV server.
(Inherited from IItemContent.)
Public methodGetReadStream(Int64, Int64)
Loads part of the content of the file from WebDAV server.
(Inherited from IItemContent.)
Public methodCode exampleGetReadStream(Int64, Int64, DateTime)
Loads part of the content of the file from WebDAV server using lastModifiedUtc to ensure the content is up-to-date.
(Inherited from IItemContent.)
Public methodCode exampleGetReadStream(Int64, Int64, String)
Loads part of the content of the file from WebDAV server using eTag to ensure the content is up-to-date.
(Inherited from IItemContent.)
Public methodGetSource
Retrieves media type independent links.
(Inherited from IHierarchyItem.)
Public methodGetSupportedLock Obsolete.
Retrieves information about supported locks.
(Inherited from IHierarchyItem.)
Public methodCode exampleGetVersions
Retrieves list of all versions for this file.
Public methodCode exampleGetWriteStream(Int64)
Saves file's content to WebDAV server.
(Inherited from IItemContent.)
Public methodCode exampleGetWriteStream(String, Int64)
Saves file's content to WebDAV server.
(Inherited from IItemContent.)
Public methodCode exampleGetWriteStream(String, Int64, String)
Saves files's content to WebDAV server.
(Inherited from IItemContent.)
Public methodCode exampleIsCheckedOut Obsolete.
Determines whether item is in checked-in or checked-out state.
Public methodCode exampleIsVersionControlled Obsolete.
Determines whether item is under version control.
Public methodCode exampleLock
Locks the item.
(Inherited from IHierarchyItem.)
Public methodCode exampleMoveTo(IFolder, String, Boolean)
Moves this item to another location.
(Inherited from IHierarchyItem.)
Public methodCode exampleMoveTo(IFolder, String, Boolean, LockUriTokenPair)
Moves this item to another location.
(Inherited from IHierarchyItem.)
Public methodCode examplePutUnderVersionControl(Boolean)
Enables / disables version control for this file.
Public methodPutUnderVersionControl(Boolean, String)
Enables / disables version control for this file.
Public methodCode exampleRefresh
Rereads item properties from server.
(Inherited from IHierarchyItem.)
Public methodCode exampleRefreshLock
Prolongs the lock.
(Inherited from IHierarchyItem.)
Public methodSetAutoVersion(AutoVersion)
Sets how checked-in item responds to WebDAV client attempts to modify its content or properties.
Public methodSetAutoVersion(AutoVersion, String)
Sets how checked-in item responds to WebDAV client attempts to modify its content or properties.
Public methodCode exampleSetCommentAndAuthor(String, String)
Updates comment and author information.
(Inherited from IHierarchyItem.)
Public methodSetCommentAndAuthor(String, String, String)
Updates comment and author information.
(Inherited from IHierarchyItem.)
Public methodCode exampleSupportedFeatures
Gets the information about functionality supported by server (Class 1, Class 2 and so on).
(Inherited from IHierarchyItem.)
Public methodCode exampleUnCheckOut
Cancels the CHECKOUT and restore the pre-CHECKOUT state of the version-controlled file.
Public methodCode exampleUnCheckOut(String)
Cancels the CHECKOUT and restore the pre-CHECKOUT state of the version-controlled resource.
Public methodCode exampleUnlock
Removes the lock.
(Inherited from IHierarchyItem.)
Public methodCode exampleUpdateProperties(Property, PropertyName)
Updates values of properties exposed by this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleUpdateProperties(Property, PropertyName, String)
Updates values of properties exposed by this item.
(Inherited from IHierarchyItem.)
Public methodCode exampleUpdateToVersion(IVersion)
Updates content and dead properties of item to those identified by version.
Public methodCode exampleUpdateToVersion(IVersion, String)
Updates content and dead properties of item to those identified by version.
Public methodCode exampleUpload(String)
Uploads content of a file specified by filename to the server
(Inherited from IItemContent.)
Public methodCode exampleUpload(String, String)
Uploads content of a file specified by filename to the server
(Inherited from IItemContent.)
Top
Examples
In the following example a file is downloaded from a WebDAV server.
string license = "<?xml version='1.0' encoding='utf...
WebDavSession session = new WebDavSession(license);
session.Credentials = new NetworkCredential("User1", "pwd");

IResource resource = session.OpenResource("http://server:8080/Products/image.gif");
resource.TimeOut = 36000000; // 10 hours
using (Stream webStream = resource.GetReadStream())
{
    int bufSize = 1048576; // 1Mb
    byte[] buffer = new byte[bufSize];
    int bytesRead = 0;
    using (FileStream fileStream = File.OpenWrite(resource.DisplayName))
    {
        while ((bytesRead = webStream.Read(buffer, 0, bufSize)) > 0)
            fileStream.Write(buffer, 0, bytesRead);
    }
}
See Also