Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

ApplyResourcePackage
ChangeResourceOwner
CopyResource
DeleteResource
DeleteResourceData
EnumerateReferences
EnumerateResourceData
EnumerateResources
EnumerateResources
EnumerateUnmanagedData
GetRepositoryContent
GetRepositoryHeader
GetResourceContent
GetResourceData
GetResourceHeader
InheritPermissionsFrom
MoveResource
RenameResourceData
ResourceExists
SetResource
SetResourceData
UpdateRepository
MgByteReader* MgResourceService::EnumerateResources | ( | MgResourceIdentifier * | resource,
|  | INT32 | depth,
|  | CREFSTRING | type,
|  | bool | computeChildren |
| ) |  |  |
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, bool computeChildren);`
Java Syntax
`MgByteReader EnumerateResources(MgResourceIdentifier resource, int depth, String type, boolean computeChildren);`
PHP Syntax
`MgByteReader EnumerateResources(MgResourceIdentifier resource, int depth, string type, bool computeChildren);`
  Parameters:
  | resource | (MgResourceIdentifier) Resource identifier specifying the resource to enumerate. This can be a document or a folder. If it is a folder, you must include the trailing slash in the identifier.
  | 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. Or, this can be set to null, in which case information about all resource types is returned.
  | computeChildren | (boolean/bool) Flag to determine whether or not the number of children of the leaf folder resource at the specified depth should be computed. If it is true, then the number of children of the leaf folder resource at the specified depth will be set to a computed value (>= 0). If it is false, then the number of children of the leaf folder resource at the specified depth will be set to -1.
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, "", true);

     // Enumerates everything in Geography
     $resourceID = new MgResourceIdentifier("Library://Geography/");
     $byteReader = $resourceService->EnumerateResources($resourceID, -1, "", true);

      // Enumerates all maps in the library
     $resourceID = new MgResourceIdentifier("Library://");
     $byteReader = $resourceService->EnumerateResources($resourceID, -1, "MapDefinition", false);

     // Enumerates all folders in the library
     $resourceID = new MgResourceIdentifier("Library://");
     $byteReader = $resourceService->EnumerateResources($resourceID, -1, "Folder", true);

     // Enumerates the folder Geography
     $resourceID = new MgResourceIdentifier("Library://Geography/");
     $byteReader = $resourceService->EnumerateResources($resourceID, 0, "Folder", true);

     // Enumerates maps one level below Geography
     $resourceID = new MgResourceIdentifier("Library://Geography/");
     $byteReader = $resourceService->EnumerateResources($resourceID, 1, "MapDefinition", false);

     // 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", false);
  Exceptions:
  | MgInvalidRepositoryTypeException |
  | MgInvalidRepositoryNameException |
  | MgInvalidResourcePathException |
  | MgInvalidResourceNameException |
  | MgInvalidResourceTypeException |

Comments or suggestions? Send us feedback.