Working with Archives

You can backup, restore, and create archives using the SDK. To restore an archive, you add an existing archive file to the archives collection using the Add method.

Example

The following code shows an example of how to restore an archive.

Dim myarchives As iHistorian_SDK.Archives 
Dim myarchive As iHistorian_SDK.Archive 
Dim i As Long
Set myarcives = DefaultServer.Archives
Set myarchive = myarchives.Add("MY_SERVER_archive001", "d:\program files\Historian\Archives\MY_SERVER_archive001_Backup.IHA", 100) 
If myarchive Is Nothing Then
MsgBox "An Error Occured Trying To Restore The Archive." + Chr(10) + Chr(10) + _
"The Details Of The Error Follow:" + Chr(10) + DefaultServer.Archives.LastError, vbCritical, "Historian" 
Err.Raise 1,, "Error Restoring Archive: " + DefaultServer.Archives.LastError
Else
MsgBox "success" 
End If