Back to Devexpress

ZipArchiveOptionsBehavior.AllowFileOverwrite Property

officefileapi-devexpress-dot-compression-dot-ziparchiveoptionsbehavior.md

latest4.0 KB
Original Source

ZipArchiveOptionsBehavior.AllowFileOverwrite Property

Gets or sets the default behavior in case of a file conflict when extracting files from an archive.

Namespace : DevExpress.Compression

Assembly : DevExpress.Docs.v25.2.dll

NuGet Package : DevExpress.Document.Processor

Declaration

csharp
public AllowFileOverwriteMode AllowFileOverwrite { get; set; }
vb
Public Property AllowFileOverwrite As AllowFileOverwriteMode

Property Value

TypeDescription
AllowFileOverwriteMode

An AllowFileOverwriteMode enumeration value that specifies the default behavior.

|

Available values:

NameDescription
Custom

Fires the ZipArchive.AllowFileOverwrite event if a file name conflict occurs.

| | Allow |

Allows you to overwrite files in the destination path without prompting.

| | Forbidden |

If a file name conflict occurs, the unzipping process skips to the next zip item and the file in the destination path remains intact.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AllowFileOverwrite
ZipArchive

.OptionsBehavior .AllowFileOverwrite

|

Remarks

You can decide whether the file with the same name should be overwritten for each file individually by setting the AllowFileOverwrite to AllowFileOverwriteMode.Custom and handling the ZipArchive.AllowFileOverwrite event.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AllowFileOverwrite property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

zip-compression-and-archive-api-examples/CS/CompressionLibraryExamples/ZipExamples.cs#L196

csharp
using (ZipArchive archive = ZipArchive.Read(pathToZipArchive)) {
    archive.OptionsBehavior.AllowFileOverwrite = AllowFileOverwriteMode.Custom;
    archive.AllowFileOverwrite += archive_AllowFileOverwrite;

zip-compression-and-archive-api-examples/VB/CompressionLibraryExamples/ZipExamples.vb#L201

vb
Using archive As ZipArchive = ZipArchive.Read(pathToZipArchive)
    archive.OptionsBehavior.AllowFileOverwrite = AllowFileOverwriteMode.Custom
    AddHandler archive.AllowFileOverwrite, AddressOf archive_AllowFileOverwrite

See Also

ZipArchiveOptionsBehavior Class

ZipArchiveOptionsBehavior Members

DevExpress.Compression Namespace