DocumentIdentifierIdentify(Byte, String) Method |
Identifies a document's file format type using internal binary signatures.
Namespace: OpenDiscoverSDKAssembly: OpenDiscoverSDK (in OpenDiscoverSDK.dll) Version: 2025.4.4.0 (2025.4.4)
Syntaxpublic 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:
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);
Assert.IsTrue(idResult.MatchType == IdMatchType.SignatureAndExtension);
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);
See Also