Skip Navigation Links.
MISSING BANNER
Technical Help >> Developer Resources >> Editing existing METS

Editings 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_Tools
  • SobekCM_Resource_Object

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

Instead of loading the actual projects into your solution, you could of course, just add the DLLs (and PDBs) for the SobekCM_Resource_Object and SobekCM_Tools projects. We could consider making a NuGet package for these, since this don't change tremendously anymore.

In addition, you will need some DLLs from the DLL folder under the main SobekCM code.  Create a DLLs folder under your main solution, and copy the following subfolders from the DLLs folder under the main code:

  • Protobuf-net
  • SolrNet
  • Zoom.net

Since you put the DLLs in the same relative path location, the SobekCM libraries should find them immediately.

Once completed, your solution explorer should look like this:

 

In this particular case, I will also be including the SobekCM_Engine_Library 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();

 

Revision History

March 2024 - This information was reviewed and found to still be accurate. Added information about adding the tools and resource object as DLLs rather than pulling in all the code.