|
Enumerates the resources in the specified repository.
- Remarks:
- You can enumerate all types or just a selected type. You can also choose what depth in the repository to examine. This method only works on "Library" repository. If you specify a repository that is not supported, this method will throw an MgInvalidRepositoryType exception.
.NET Syntax
MgByteReader EnumerateResources(MgResourceIdentifier resource, int depth, string type);
|
Java Syntax
MgByteReader EnumerateResources(MgResourceIdentifier resource, int depth, String type);
|
PHP Syntax
MgByteReader EnumerateResources(MgResourceIdentifier resource, int depth, string type);
|
- Parameters:
-
| resource | (MgResourceIdentifier) Resource identifier specifying the resource to enumerate. This can be a document or a folder. |
| depth | (int) Recursion depth, relative to the specified resource.
-
If the resource is a document, depth must be set to 0.
-
If the resource is a folder:
-
If the depth is equal to 0, only information about the specified folder is returned.
-
If the depth is greater than 0, information about the folder and its descendants up to the specified depth are returned.
-
If the depth is -1, information about the folder and all its descendants is returned.
|
| type | (String/string) Type of the resource to be enumerated. (Case sensitive.) See MgResourceType for valid types. If the type is a folder, you must include the trailing slash.
Or, this can be set to null, in which case information about all resource types is returned. |
- Returns:
- Returns an MgByteReader object containing a description of the resources in XML format using the ResourceList schema.
Example (PHP)
These examples assume that $resourceService has already been initialized. // Enumerates everything in the library
$resourceID = new MgResourceIdentifier("Library://");
$byteReader = $resourceService->EnumerateResources($resourceID, -1, "");
// Enumerates everything in Geography
$resourceID = new MgResourceIdentifier("Library://Geography/");
$byteReader = $resourceService->EnumerateResources($resourceID, -1, "");
// Enumerates all maps in the library
$resourceID = new MgResourceIdentifier("Library://");
$byteReader = $resourceService->EnumerateResources($resourceID, -1, "MapDefinition");
// Enumerates all folders in the library
$resourceID = new MgResourceIdentifier("Library://");
$byteReader = $resourceService->EnumerateResources($resourceID, -1, "Folder");
// Enumerates the folder Geography
$resourceID = new MgResourceIdentifier("Library://Geography/");
$byteReader = $resourceService->EnumerateResources($resourceID, 0, "Folder");
// Enumerates maps one level below Geography
$resourceID = new MgResourceIdentifier("Library://Geography/");
$byteReader = $resourceService->EnumerateResources($resourceID, 1, "MapDefinition");
// Enumerates a specific map
// NOTE: In this case, depth must be set to 0
$resourceID = new MgResourceIdentifier("Library://Geography/World.MapDefinition");
$byteReader = $resourceService->EnumerateResources($resourceID, 0, "MapDefinition");
- Exceptions:
-
|