You are viewing limited content. For full access, please sign in.

Question

Question

Locking all server repositories using SDK

asked on March 7, 2019

Hi,

can anyone provide me with the appropriate .Net C# code to simply loop through all a Laserfiche server's hosted repositories and lock/unlock them. I need this to create executables that run before and after our volume backup processes.

 

0 0

Replies

replied on March 7, 2019 Show version history

I don't see anything in the SDK to lock the entire repository. However, you can lock the individual volumes.

var repo = new RepositoryRegistration("lfserver.name", "reponame");
var session = new Session();
session.LogIn(repo);

var volumes = Volume.EnumAll(VolumeReaderOptions.LogicalOnly, session);

foreach (var vol in volumes)
{
	vol.IsReadOnly = true;
	vol.Save();
}

volumes.Dump();

session.LogOut();

Doing it at the volume might make more sense because then you can tie your lockdown to specific paths as you back them up. For example, in our repo, we have volumes spread across multiple tiers of storage, and we could set only the tier-3 volumes to read only when tier-3 disk is going to be backed up.

Edit: You can also call the SDK assemblies from PowerShell

Add-Type -Path 'C:\Program Files\Laserfiche\SDK 10.2\bin\10.2\net-4.0\Laserfiche.RepositoryAccess.dll'

$repo = [RepositoryRegistration]::new("lfserver.name", "reponame")
$session = [Session]::new()
$session.LogIn($repo)

$volumes = [Volume]::EnumAll([VolumeReaderOptions]::LogicalOnly, $session)

Foreach($vol in $volumes)
{
    $vol.IsReadOnly = $true
    $vol.Save()
}

$session.LogOut()

 

2 0
replied on March 7, 2019

RepositoryOptions.AdminLockout locks the repository so only connections with Manage Connections privilege are allowed.

2 0
replied on March 7, 2019

Oh sweet! Now I see it. I hate the search on the CHM viewer.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.