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 eventually results in a Sandbox.Package
object.
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
(Boolean): A boolean value indicating whether to allow partial fetching of the package. If set to true
, the method may return a partially fetched package.
Call this method when you need to retrieve package details from the server, especially when you need to ensure you have the most up-to-date information about a package.
Example
// Example usage of FetchAsync method
string packageIdentifier = "example.package.id";
bool allowPartialFetch = false;
// Fetch the package asynchronously
Sandbox.Package package = await Sandbox.Package.FetchAsync(packageIdentifier, allowPartialFetch);
// Use the fetched package
Console.WriteLine($"Package Title: {package.Title}");