Getting Started
Creating a sample package
Utilities like the Autodesk Data Export Utility or Autodesk Data Transfer Utility are able to create BCP packages out of the box.
If you need a way to create your own BCP package, you could use the bcpDevKit .NET Library in your own Visual Studio project.
Follow these steps to use the .NET library in your C# project, and get ready to implement following example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | using System; using bcpDevKit; using bcpDevKit.Entities; namespace HelloWorldPackage { class Program { static void Main(string[] args) { var bcpSvcBuilder = new BcpServiceBuilder(); bcpSvcBuilder.Version = BcpVersion._2024; bcpSvcBuilder.SetPackageLocation("C:\\Temp\\HelloWorldPackage"); var bcpService = bcpSvcBuilder.Build(); var file = bcpService.FileService.AddFileWithIteration("$/HelloWorldFiles/Hello.iam", @"C:\HelloWorldFiles\Hello.iam"); var item = bcpService.ItemService.AddItem("999", "World", "Title 999", "Desc 999"); bcpService.Flush(); } } } |
Make sure following directory exists on disk ‘C:\Temp\HelloWorldPackage’.
When running your new project several xml files should be created inside there.
This newly created BCP package would now be ready for an import into Vault.
Preview the package
In order to display your BCP package in a Vault-like UI, you can use bcpViewer.
Launch the bcpViewer 24.0 shortcut on your Desktop and open the package ‘C:\Temp\HelloWorldPackage’ as described here.
You can navigate to the folder ‘$/HelloWorldFiles’ and see the contained file ‘Hello.iam’, as well as the item within the ItemMaster.
Exporting a test package
Since the import of large packages takes some time, we can create a package that does not contain the real files.
The bcpToolkit commandlets can be used to create a new test-package out of our previous BCP package with only the metadata information.
Start a new PowerShell environment and import the bcpToolkit
module by clicking the bcpToolkit Console shortcut in the start menu as described here.
Use Open-BcpPackage to open the original BCP package in your PowerShell environment.
Open-BcpPackage -Path 'C:\Temp\HelloWorldPackage'
The opening of the BCP package should be very fast, because the package got already opened in bcpViewer before.
Next we can directly export the package without links to the real files to a new package directory.
Execute Export-BcpPackage with the arguments To and NoSourceFiles.
Export-BcpPackage -To 'C:\Temp\HelloWorldPackage_Test' -NoSourceFiles
The new test package in the directory ‘C:\Temp\HelloWorldPackage_Test’ can now be copied and imported on any Vault test environment without the need for the source files.