Document Module¶
The Document Manager offers a way to store any kind of files. This could be for example pdf, Microsoft Word, videos, executable, etc.
Any type of files can be imported but only a few are natively recognized and can be opened directly from MIKE Workbench.
Install NuGet package DHI.MikeOperations.DocumentManager to get access to the document module.
var module = application.Modules.Get("Document Manager") as DHI.Solutions.DocumentManager.Interfaces.IDocumentModule;
// Fetch a document from the path in the explorer.
var document = module.DocumentList.Fetch("/Group1/Doc1");
module = app.Modules.Get("Document Manager")
# Fetch a document from the path in the explorer.
document = module.DocumentList.Fetch("/Group1/Doc1")
module = DHI.Solutions.DocumentManager.Interfaces.IDocumentModul(app.Modules.Get("Document Manager"))
# Fetch a document from the path in the explorer.
document = module.DocumentList.Fetch("/Group1/Doc1")
Module Providers¶
The following providers are included in the Document module.
| Provider | Description |
|---|---|
| DocumentList | Manage Documents |
| DocumentFolderList | Manage Document folders/groups |
| DocumentFeatureAssocList | Manage associations between documents and features in a feature class. |
| DocumentFolderAssociationList | Manage associations between documents and document folders. |
| DocumentRelationshipList | Manage releations between documents |
Read more about using module providers here
Remote Data Providers¶
MIKE Cloud Provider¶
Provider for accessing the MIKE Cloud blob storage (aka. DHI Platform Storage).
Install the NuGet package DHI.MikeOperations.DocumentManager.Provider.MikeCloud in order to load required dependencies for the MIKE Cloud provider.
The DHI Platform storage contains data in projects. Each project contains a hierarchy of sub-projects containing datasets.
// Get the document module.
var module = application.Modules.Get("Document Manager") as DHI.Solutions.DocumentManager.Interfaces.IDocumentModule;
// Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
var provider = new DHI.Solutions.DocumentManager.MIKECloudDocumentProvider.MIKECloudDocumentProvider();
// Startup the provider with the connection string as argument and add it to the list of time series data providers.
provider.StartUp(application, module, "[API Key]");
module.DocumentDataProviders.Add(provider);
// Get all documents from the MIKE Cloud storage.
var documentList = provider.DocumentList.FetchAll();
// Get a single document from the full path of the document in the cloud storage.
var document = provider.DocumentList.Fetch("/projectname/subproj1Name/datasetwithblob");
# Get the document module.
module = app.Modules.Get("Document Manager")
# Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
provider = DHI.Solutions.DocumentManager.MIKECloudDocumentProvider.MIKECloudDocumentProvider()
# Startup the provider with the connection string as argument and add it to the list of time series data providers.
provider.StartUp(app, module, "[API Key]")
module.DocumentDataProviders.Add(provider)
# Get all documents from the MIKE Cloud storage.
var documentList = provider.DocumentList.FetchAll()
# Get a single document from the full path of the document in the cloud storage.
document = provider.DocumentList.Fetch("/projectname/subproj1Name/datasetwithblob")
# Get the document module.
module = DHI.Solutions.DocumentManager.Interfaces.IDocumentModule(app.Modules.Get("Document Manager"))
# Use a provider configured in MIKE Workbench or add a new provider runtime (latter shown below)
provider = DHI.Solutions.DocumentManager.MIKECloudDocumentProvider.MIKECloudDocumentProvider()
# Startup the provider with the connection string as argument and add it to the list of time series data providers.
provider.StartUp(app, module, "[API Key]")
module.DocumentDataProviders.Add(provider)
# Get all documents from the MIKE Cloud storage.
var documentList = provider.DocumentList.FetchAll()
# Get a single document from the full path of the document in the cloud storage.
document = provider.DocumentList.Fetch("/projectname/subproj1Name/datasetwithblob")
Tools¶
When using the API for running tools, every tool are following the concept show below.
// Get the tool from the tool name.
var tool = application.Tools.CreateNew("Export Document") as DHI.Solutions.DocumentManager.UI.Tools.ExportDocument.IExportDocument;
// Add input items to the tool if required.
tool.InputItems.Add(document);
// Set the properties of the tool.
tool.FilePath = "c:/temp/file.bmp";
// Execute the tool.
tool.Execute();
// Get the output of the tool (if any).
var output = tool.OutputItems[0];
# Get the tool from the tool name.
var tool = app.Tools.CreateNew("Export Document")
# Add input items to the tool if required.
tool.InputItems.Add(document)
# Set the properties of the tool.
tool.FilePath = "c:/temp/file.bmp"
# Execute the tool.
tool.Execute()
# Get the output of the tool (if any).
output = tool.OutputItems[0]
# Get the tool from the tool name.
var tool = DHI.Solutions.DocumentManager.UI.Tools.ExportDocument.IExportDocument(app.Tools.CreateNew("Export Document"))
# Add input items to the tool if required.
tool.InputItems.Add(document)
# Set the properties of the tool.
tool.FilePath = "c:/temp/file.bmp"
# Execute the tool.
tool.Execute()
# Get the output of the tool (if any).
output = tool.OutputItems[0]
Document query¶
QueryToolTool class
| Tool Info | Document query |
|---|---|
| NuGet Package | DHI.MikeOperations.DocumentManager.Tools.Query |
| API Reference | DHI.Solutions.DocumentManager.Tools.QueryTool.QueryTool |
| Input Items | No input items required |
| Output Items | No output items |
Tool Properties
The tool has no properties.
Code Sample
// Get the tool.
var tool = application.Tools.CreateNew("Document query") as DHI.Solutions.DocumentManager.Tools.QueryTool.QueryTool;
# Get the tool.
tool = app.Tools.CreateNew("Document query")
Export Document¶
Tool for exporting documents to files on disk.
| Tool Info | Export Document |
|---|---|
| NuGet Package | DHI.MikeOperations.DocumentManager.Tools.Export |
| API Reference | DHI.Solutions.DocumentManager.UI.Tools.ExportDocument.IExportDocument |
| Input Items | One or more documents |
| Output Items | No output items |
Tool Properties
- FilePath: Gets or sets the file path fo the document to export
Code Sample
// Get the tool.
var tool = application.Tools.CreateNew("Export Document") as DHI.Solutions.DocumentManager.UI.Tools.ExportDocument.IExportDocument;
# Get the tool.
tool = app.Tools.CreateNew("Export Document")
# Get the tool.
tool = DHI.Solutions.DocumentManager.UI.Tools.ExportDocument.IExportDocument(app.Tools.CreateNew("Export Document"))
Import Document¶
Tool for importing documents into the MIKE Workbench database.
| Tool Info | Import Document |
|---|---|
| NuGet Package | DHI.MikeOperations.DocumentManager.Tools.Import |
| API Reference | DHI.Solutions.DocumentManager.UI.Tools.ImportDocument.IImportDocument |
| Input Items | A single document folder |
| Output Items | A document |
Tool Properties
- DocumentName: Gets or sets the name for the document to import
- FilePath: Gets or sets the file path for the document to import
- Group: Gets or sets the group for the document to import
- Thumbnail: Gets or sets the Thumbnail for the document to import
Code Sample
// Get the tool.
var tool = application.Tools.CreateNew("Import Document") as DHI.Solutions.DocumentManager.UI.Tools.ImportDocument.IImportDocument;
# Get the tool.
tool = app.Tools.CreateNew("Import Document")
# Get the tool.
tool = DHI.Solutions.DocumentManager.UI.Tools.ImportDocument.IImportDocument(app.Tools.CreateNew("Import Document"))