ZipArchive.ExtractToDirectory Method (String, String)
Extracts all of the files in the specified archive to a directory on the file system. The specified directory must not exist. This method will create all subdirectories and the specified directory. If there is an error when extracting the archive, the archive will remain partially extracted. Each entry will be extracted so that the extracted file has the same relative path of the destinationDirectoryName as the entry has to the archive. The path is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. If a file to be archived has an invalid last modified time, the first datetime representable in the Zip timestamp format (midnight on January 1, 1980) will be used.
Assembly: Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)
public static function ExtractToDirectory( sourceArchiveFileName : String, destinationDirectoryName : String )
sourceArchive or destinationDirectoryName is a zero-length string, or it contains only white space, or it contains one or more invalid characters as defined by InvalidPathChars.
sourceArchive or destinationDirectoryName is null.
sourceArchive or destinationDirectoryName specifies a path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The path specified by sourceArchive or destinationDirectoryName is invalid; for example, if it is on an unmapped drive.
The directory specified by destinationDirectoryName already exists; or an I/O error has occurred, or an archive entry’s name is zero-length, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars; or extracting an archive entry would give you a file destination that is outside the destination directory (for example, because of parent directory accessors); or an archive entry has the same name as an already extracted entry from the same archive.
The caller does not have the required permission.
sourceArchive or destinationDirectoryName is in an invalid format.
sourceArchive was not found.
The archive specified by sourceArchive is not a valid ZipArchive, or an archive entry was not found or was corrupted, or an archive entry has been compressed by using a compression method that is not supported.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.