Document IdentifierIdentify(Byte, String) Method
Identifies a document's file format type using internal binary signatures.
Definition
Namespace: OpenDiscoverSDK
Assembly: OpenDiscoverSDK (in OpenDiscoverSDK.dll) Version: 2026.2.6.0 (2026.02.06)
IdResult object containing information on the identified file format.
Assembly: OpenDiscoverSDK (in OpenDiscoverSDK.dll) Version: 2026.2.6.0 (2026.02.06)
C#
public static IdResult Identify(
byte[] documentBytes,
string filePath
)Parameters
- documentBytes Byte
- Byte array containing all document's file bytes.
- filePath String
- The full document file path or file name with extension SHOULD always be passed in as an argument. The file extension is used to help judge quality (confidence) of identification. However, null or empty strings are valid but not recommended.
Return Value
IdResultIdResult object containing information on the identified file format.
Remarks
The full document file path SHOULD always be passed in as an argument; However,
null or empty strings are valid.
Example
Example file identification unit test that illustrates some of the properties on the returned IdResult object:
C#
var docBytes = System.IO.File.ReadAllBytes(@"C:\WordProcessing\Word2003.doc")
var idResult = DocumentIdentifier.Identify(docBytes, @"C:\WordProcessing\Word2003.doc");
Assert.IsTrue(idResult.ID == Id.Word2003);
Assert.IsTrue(idResult.Classification == IdClassification.WordProcessing); // Classification of format
Assert.IsTrue(idResult.MatchType == IdMatchType.SignatureAndExtension); // Quality of identication
Assert.IsTrue(idResult.IsEncrypted == false);
Assert.IsTrue(idResult.MediaType == "application/msword");
Assert.IsTrue(idResult.Description != null);
Assert.IsTrue(idResult.PrimaryExtension != null);
Assert.IsTrue(idResult.Extensions != null);