Web API Reference MapGuide Open Source

virtual void MgResourceService::ChangeResourceOwner MgResourceIdentifier resource,
CREFSTRING  owner,
bool  includeDescendants
[pure virtual, inherited]
 

Changes the owner of a resource.

.Net Syntax
virtual void ChangeResourceOwner(MgResourceIdentifier resource, string owner, bool includeDescendants);
Java Syntax
virtual void ChangeResourceOwner(MgResourceIdentifier resource, String owner, boolean includeDescendants);
PHP Syntax
virtual void ChangeResourceOwner(MgResourceIdentifier resource, string owner, bool includeDescendants);

Parameters:
resource (MgResourceIdentifier) Resource whose owner is to be changed. This resource can be a document or folder.
If it is a folder, you must include the trailing slash in the identifier.
owner (String/string) The User ID of the new owner. (The User ID must already exist. You can create User IDs through the Site Administrator tool.)
includeDescendants (boolean/bool) Flag to determine whether or not the owners of descendant resources should be also be changed. This flag is applicable only if the resource is a folder.
Returns:
Returns nothing.
Example (PHP)
    /// // Assuming $resourceService is already initialized.
    /// $resourceID= new MgResourceIdentifier("Library://Geography/World.MapDefinition");
    /// $resourceService->ChangeResourceOwner($resourceID, "John Smith", false);
    /// 

Exceptions:
MgPermissionDeniedException 
MgResourceNotFoundException 
MgInvalidRepositoryTypeException 
MgInvalidRepositoryNameException 
MgInvalidResourcePathException 
MgInvalidResourceNameException 
MgInvalidResourceTypeException 
Note:
  • You must be logged in as the Administrator or the current owner to use this method.
  • You can use EnumerateResources to determine the current owner of a resource.