static Task<Package> FetchAsync( string identString, bool partial )
static Task<Package> FetchAsync( string identString, bool partial, bool useCache )

robot_2Generated
code_blocksInput

Description

The FetchAsync method is a static method of the Sandbox.Package class. It is used to asynchronously fetch a package from the server using a specified identifier string. This method returns a Task<Sandbox.Package>, which represents the asynchronous operation and contains the fetched package upon completion.

Usage

To use the FetchAsync method, you need to provide two parameters:

  • identString (string): The identifier string of the package you want to fetch. This should be a valid package identifier.
  • partial (bool): A boolean value indicating whether to allow partial fetching of the package. If set to true, the method may return a partially fetched package if the full package cannot be retrieved.

Call this method when you need to retrieve package details from the server, especially when dealing with remote packages.

Example

// Example of using FetchAsync to fetch a package
string packageIdentifier = "example.package.identifier";
bool allowPartial = false;

Sandbox.Package.FetchAsync(packageIdentifier, allowPartial).ContinueWith(task =>
{
    if (task.IsCompletedSuccessfully)
    {
        Sandbox.Package package = task.Result;
        // Use the package object as needed
    }
    else
    {
        // Handle errors
        Exception ex = task.Exception;
    }
});