Skip Navigation Links.
MISSING BANNER

Creating METS files programmatically

 

This section describes how to use the SobekCM code base directly, to either edit existing METS or create brand new METS metadata files for loading into SobekCM.

Creating a new Visual Studio solution

Generally, to do automation tasks, you will find a console application project works best, although you could certainly create this same framework within a windows form if you would like to repeat the process many times and have a GUI interface.  If you do long automated tasks within your program, however, you will need to ensure you are using threading correctly to update the GUI progress bar and not leave the form in a frozen state.

The Target Framework of your project should match that of the SobekCM code base, which is .NET Framework 4.5 as of early 2016.

Once you have created a new Visual Studio solution, copy or reference the following projects/libraries from the main SobekCM code core and add them as existing projects:

  • SobekCM_Resource_Object
  • SobekCM_Tools

You will need to reference the SobekCM_Resource_Object library in your project.

Once completed, your solution explorer should look like this:

 

Reading Instance Metadata Configuration

In this particular case, I will also be including the SobekCM_Engine_Library and SobekCM_Core which can be used to read the settings values from a SobekCM instance.  This is really only necessary if you have customized your METS creation methods or want to read settings directly from the database.

Using Default Metadata Configuration

If you do not read the metadata configuration from your SobekCM instance, you need to just set the default configuration, at a minimum. To do this, add the following lines in your code before you start reading or writing any metadata.

// Set the default metadata configuration values
ResourceObjectSettings.MetadataConfig.Set_Default_Values();
ResourceObjectSettings.MetadataConfig.Finalize_Metadata_Configuration();