I can't get Evidence lock from child sites ?

  var loginSettings = LoginSettingsCache.GetLoginSettings(fQID);
                        var token = loginSettings.Token;
 
                        using (var client = CreateWcfClient(loginSettings))
                        {
                            var devicesToCreateLockOn = new[] { fQID.ObjectId };
 
                            bool nextPage = true;
                            int i = 0;
                            while (nextPage)
                            {
                                if (Cancelled)
                                {
                                    break;
                                }
                                MarkedData[] searchResult = client.MarkedDataSearch(
                                  token,
                                  devicesToCreateLockOn, // use empty array to search on all devices
                                  null, // Use null to not search for text
                                  null, // Use null to search for all users
                                  DateTime.MinValue.ToUniversalTime(),
                                  DateTime.MinValue.ToUniversalTime(),
                                  jobConfig.FromDateTime.ToUniversalTime(),
                                  jobConfig.ToDateTime.ToUniversalTime(),
                                  DateTime.MinValue.ToUniversalTime(),
                                  DateTime.MinValue.ToUniversalTime(),
                                  DateTime.MinValue.ToUniversalTime(),
                                  DateTime.MinValue.ToUniversalTime(),
                                  i,
                                  10000,
                                  SortOrderOption.CreateTime,
                                  true
                                  );
}
}

I am trying to get evidence lock from child sites in a federated hierarchy. but i cant get it using this code.

it shows empty array

when i connected directly to child site i am getting evidence locks .

Can you help ?

Your code is derived from the Evidence Lock sample.

https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/evidencelock/readme.html&tree=tree_2.html

This sample has been developed without thinking about Milestone Federated Architecture (MFA) and will only work for a single site scenario.

I have experimented and succeeded in using the sample on a camera in a MFA client in my test setup. Describing what I did to make it work will probably give you the information to solve it in your code too.

First the sample only logs into the server without logging in on child sites. This is quickly solved.

var loginForm = new Vide-oOS.Platform.SDK.UI.LoginDialog.DialogLoginForm(SetLoginResult, IntegrationId, IntegrationName, Version, ManufacturerName);
loginForm.MasterOnly = false; //My addition
Application.Run(loginForm);

By introducing the MasterOnly false you will notice that the ItemPicker now includes the cameras from the child site

When looking at the code you will notice that EnvironmentManager.Instance.MasterSite is used frequently, it means that the code automatically uses the MasterSite, we will have to change that. Instead, we need to make sure the site that the selectedItem belongs to.

I have changed the one line with GetLoginSettings like this:

//var loginSettings = LoginSettingsCache.GetLoginSettings(EnvironmentManager.Instance.MasterSite);
// -changed to -
var rs = Configuration.Instance.GetItem(selectedItem.FQID.ParentId, Kind.Server);
var ms = Configuration.Instance.GetItem(rs.FQID.ParentId, Kind.Server);
var serverID = ms.FQID.ServerId;
var loginSettings = LoginSettingsCache.GetLoginSettings(serverID);

Also when doing the WCF Client it is constantly using MasterSite, so this is also changed..

//using (var client = CreateWcfClient(loginSettings))
// - changed to-
using (var client = MyCreateWcfClient(serverID))
 
..
// new method
private static ServerCommandServiceClient MyCreateWcfClient(ServerId serverId)
{
  var loginSettings = LoginSettingsCache.GetLoginSettings(serverId);
  Uri uri = loginSettings.Uri;
  var serviceUri = new UriBuilder
  {
	  Scheme = Uri.UriSchemeHttp,
	  Host = uri.Host,                
	  Path = "ManagementServer/ServerCommandService.svc"
  };
  var binding = GetBinding(loginSettings.IsBasicUser);
  var spn = SpnFactory.GetSpn(serviceUri.Uri);
  var endpoint = new EndpointAddress(serviceUri.Uri, EndpointIdentity.CreateSpnIdentity(spn));
  var client = new ServerCommandServiceClient(binding, endpoint);
  var nc = LoginSettingsCache.GetNetworkCredential(serverId);
  if (loginSettings.IsBasicUser)
  {
	  client.ClientCredentials.UserName.UserName = "[BASIC]\\" + nc.UserName;
	  client.ClientCredentials.UserName.Password = nc.Password;
 
	  // If it's basic user, you need to specify the certificate validation mode yourself
	  client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication()
	  {
		  CertificateValidationMode = X509CertificateValidationMode.None
	  };
  }
  else
  {
	  client.ClientCredentials.Windows.ClientCredential = nc;
  }
 
  return client;
}

PS. I will be making a suggestion here at Milestone that the sample will be changed in future versions, if it will be changed, it will probably be changed in another way than my quick-fix

Thanks i will check this.