Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Retrieves the list of folders and files available for recovery at specified Path. If Path is not specified returns a list of systems

 Input fields: 

Parameter

Description

Type / Validation Rules

Identityidentity object with valid tokenIdentityContract
Filter

filter object with includes:

  • DateFrom - date, optional
  • DateTo - date, optional
  • FileSizeInKbFrom - int, optional
  • FileSizeInKbTo - int, optional
  • FileName - string, optional
  • PathFilter - string, optional

RecoveryFilterContract

PathPath of directory to load children fromstring

 Output  fields: 

Output Value

Description

 
Items

 array of recovery items which include Path and can be one of two types:

  • RecoveryDirectoryContract: additionally contains:
    • array of Children
    • Files - CountAndSizeContract of files inside (recursively) 
  • RecoveryFileContract: additionaly contains FileVersion which contains:
    • FileId
    • DeltaId
    • CreatedAt
    • SizeBytes

array of RecoveryItemContract

Faults:
  MethodCallFailed  


Code Block
borderStylesolid
titleExample
        [Test]
        public void ExtarctAllRecoveryTree_Ok()
        {
            //Init SDK
            _client = new InfrascaleClient();
            _client.Connect();
            
            var signInResponse = _client.SignIn(new SignInRequest { Credentials = new CredentialsContract { Login = _testAccount, Password = _testAccountPassword } });

            RefreshRecoveryInfo(signInResponse.Identity);

            //Extract metadata items
            var request = new GetRecoveryItemsRequest
            {
                Identity = signInResponse.Identity,
                Path = Environment.MachineName
            };
            var output = _client.GetRecoveryItems(request);
            
            //Handle files tree
            Tools.PrintTree(output);

            //Detach client 
            _client.SignOut(new SignOutRequest { Identity = signInResponse.Identity });
            _client.Disconnect();
        }

        public static void PrintTree(GetRecoveryItemsResponse response)
        {
            Action<RecoveryItemContract, int> handleLevel = null;
            handleLevel = (treeItem, level) =>
            {
                var padding = Enumerable.Range(0, level).Aggregate(new StringBuilder(), (sb, i) => sb.Append(" "));
                var dir = treeItem as RecoveryDirectoryContract;
                if (dir != null)
                {
                    foreach (var dirItem in dir.Children)
                    {
                        if (dirItem is RecoveryDirectoryContract)
                            Console.WriteLine(padding + dirItem.Path);
                        else
                            Console.WriteLine(padding + Path.GetFileName(dirItem.Path));
                        handleLevel(dirItem, level + 1);
                    }
                }
            };

            foreach (var item in response.Items)
            {
                Console.WriteLine(item.Path);
                handleLevel(item, 0);
            }
        }

         public static void RefreshRecoveryInfo(IdentityContract identity)
        {
            _client.SubscribeCallback(new SubscribeCallbackRequest
            {
                Identity = identity
            });

            bool isCompleted = false;

            Action<JobSessionContract> isCompletedFunc = contract =>
                isCompleted = contract.JobType == JobTypeContract.RefreshRecoveryInfo;

            _client.JobCompleted += isCompletedFunc;

            _client.RunRefreshRecoveryInfoJob(new RunRefreshRecoveryInfoJobRequest { Identity = identity });

            while (!isCompleted)
            {
                Thread.Sleep(100);
            }

            _client.JobCompleted -= isCompletedFunc;
        }


Code Block
borderStylesolid
titleOutput
collapsetrue
ALEXK\C:
ALEXK\D:


Code Block
languagec#
Sample filter to get items  for the last 7 days where filename contains "123", size between 1 byte and 1 megabyte and located on disc C:


var filter = new RecoveryFilterContract
                {
                    DateFrom = DateTime.Today.AddDays(-7),
                    DateTo = DateTime.Today,
                    FileName = "123",
                    FileSizeInKbFrom = 1,
                    FileSizeInKbTo = 1024,
                    PathFilter = "C:\\"
                }

Operation: RunRecoveryJob

Starts recovery job

 Input fields: 

Parameter

Description

Type / Validation Rules

Identityidentity object with valid tokenIdentityContract
Job

job object with includes:

  • Items - array of RecoveryItemContract to be recovered 
  • RestoreDestination - folder where to put recovered files
  • ConflictResolution - sets how the file conflicts should be handled
  • IncludePath - where to include original file path
  • PassPhrase - for Ultrasafe Max accounts - for data decryption

RecoveryJobContract

 Output  fields: 

Output Value

Description

 
JobSession

 job details including RecoveryProgress 

RecoveryJobSessionContract

Faults:
  MethodCallFailed 

...