ResourcesDelete Method

Description

Deletes one or more resources from the Enterprise Resource Pool in Microsoft Office Project Server 2003. The PDS checks that each resource exists, that the resource is not checked out, that the currently logged-on user has the Resource Global project checked out, and has the following permissions:

  • Save Resource (Permission ID 1015)

  • Cleanup Project Server Database (Permission ID 780)

The PDS also checks that the resource is not a team member on any enterprise projects that are currently checked out to any user (including the current user). If permissions are appropriate, the PDS removes the accounts or resources directly from the Enterprise Resource Pool in the Project Server database.

If a resource is a team member on an enterprise project that is not checked out, the PDS still deletes the resource from the Enterprise Resource Pool, changes the resource to a local resource and appends the ResourceNameSuffix to the end of the ResourceName. This allows the project schedule to remain unaffected and keeps a record of the resource’s data and actuals.

The PDS sets the CAN_LOGIN and COUNT_LICENSE fields to 0 in the table MSP_WEB_RESOURCES for Project Web Access, but does not delete the user account. However, ResourcesDelete does more than just inactivate the account; it adds the name suffix and the account cannot be reactivated.

Syntax

The following two syntax examples help clarify the use of ResourcesDelete.

Call with Resource Name, EUID, or Web Resource ID

<Request>
   <ResourcesDelete>
     <Resource>
        <!--Use only one of the three identifiers -->
        <ResourceName>r1</ResourceName>
        <ResourceUID>260</ResourceUID>
        <WebResourceID>134</WebResourceID>
        <ResourceNameSuffix>Left company 3-12-2003</ResourceNameSuffix>
     </Resource>
     <ServerPath></ServerPath>
   </ResourcesDelete>
</Request>

Call with Multiple Resources

<Request>
   <ResourcesDelete>
     <ServerPath></ServerPath>
     <Resource>
        <WebResourceID>134</WebResourceID>
        <ResourceNameSuffix>Transferred 3-12-2003</ResourceNameSuffix>
     </Resource>
     <Resource>
        <ResourceUID>60</ResourceUID>
        <ResourceNameSuffix>Removed 1-1-2003</ResourceNameSuffix>
     </Resource>
     <Resource>
        <ResourceName>r2</ResourceName>
        <ResourceNameSuffix>Removed 1-1-2003</ResourceNameSuffix>
     </Resource>
     <Resource>
        <ResourceUID>258</ResourceUID>
        <ResourceNameSuffix>Deleted 1-1-2003</ResourceNameSuffix>
     </Resource>
   </ResourcesDelete>
</Request>

Parameters

ResourceName* or ResourceUID or *WebResourceID

One of the parameters ResourceName, ResourceUID, or WebResourceID is required. If ResourceUID is specified, the ResourceName parameter is ignored, even if given. If WebResourceID is specified, the ResourceName and ResourceUID parameters are ignored, even if given.

ResourceNameSuffix

Required. Provides a note for each resource. Project Server appends this note to the end of the resource name in parentheses. This makes the resource name unique and allows for reuse of the deleted resource name in the future. A resource name is any Web resource name in Microsoft Office Project Web Access 2003.

ServerPath

Optional. ServerPath is the Project Server virtual path, for example, http://myserver/projectserver. If ServerPath is included, the PDS also removes the resource or resources from related Windows SharePointâ„¢ Services project sites.

Return Value

If processing of the requested resource(s) succeeds, ResourcesDelete returns a successful HRESULT and STATUS of 0. If a security check fails, the PDS returns a STATUS error code 50 (rsSecurityAccessDenied).

If a specific resource is not deleted, the PDS returns the appropriate error code for that resource in ReplyStatus (for example, security failure, database failure, resource not found, resource checked out, resource UID invalid, resource name invalid). See Error Codes for the complete list of resource-related error codes.

Processing continues for all resources in the request, even if some resources are not deleted after PDS checks for correct name, etc. However if any resource is cleared for deletion after the PDS checks the resource, but the deletion fails for some other reason, the entire ResourcesDelete call fails with a STATUS error code and no changes are made.

The PDS also returns the resource identifying data (ResourceUID and ResourceName) and the name of the user attempting the deletion. The following example shows a ReplyStatus of 2000 (rsResourceNotFound) and the identifying data for a resource that was not deleted.

<Reply>
   <HRESULT>0</HRESULT>
   <STATUS>0</STATUS>
   <UserName>Administrator</UserName>
   <ResourcesDelete>
      <Resource>
         <WebResourceID>60</WebResourceID>
         <ResourceUID>60</ResourceUID>
         <ResourceName>r3</ResourceName>
         <ReplyStatus>2000</ReplyStatus>
      </Resource>
      . . . more resources . . .
   </ResourcesDelete>
</Reply>

Remarks

The PDS checks Project Server global permissions for the currently logged-on user to determine whether that user is a valid Project Server user and is authorized to administer the Project Server database.

The PDS accepts up to 255 characters total for ResourceName plus ResourceNameSuffix; it trims excess characters.

The PDS does not allow the current user to delete him/herself with ResourcesDelete.