GetResourcesResCanViewByViewID Method

Description

Returns a list of resources for which a specified resource account has a specified resource permission using the Microsoft Office Project Server 2003 security object. The resource list can be with or without a specified view ID.

Syntax

Function GetResourcesResCanViewByViewID( _
   ByVal res_id As Long, _
   ByVal act_id As Long, _
   ByVal view_id As Long, _
   Optional ByVal fGetEntOnly As Long = 0 _
) As String

Parameters

Parameter Description

res_id

Required Long. The resource ID from MSP_WEB_RESOURCES.WRES_ID.

act_id

Required Long. The resource category permission ID. There are only six permissions for resource objects:

Resource Category
Permission ID
Description
212 Approve timesheets for resources.
510 See resource assignments in assignment views.
513 Adjust actuals.
1014 See enterprise resource data.
1015 Edit enterprise resource data.
1020 Assign resource.

view_id

Required Long. The view ID, from MSP_WEB_VIEW_REPORTS.WVIEW_ID. Set view_id = -1 if the permission check is not associated with a view.

fGetEntOnly

Optional Long. Set to 1 (True) to return only enterprise resources, as RES_EUID. The default 0 (False) returns all resources, as WRES_ID.

Return Value

The GetResourcesResCanViewByViewID method returns a comma-separated list of resource IDs as a String value. If fGetEntOnly is 1 (True), the list contains RES_EUID; otherwise, it contains WRES_ID values.

Remarks

If act_id is not one of the six values shown, or one of the other parameters is not correct, GetResourcesResCanViewByViewID returns an empty string (""). For more information, see GetNumberOfResourcesResCanViewByViewID Function and GetResourcesResCanViewByViewIDFromList Function.

Example

The following example returns the list of resources (local or enterprise) that the resource 101 can assign to a task (resource category permission ID 1020). The example is for Microsoft Visual Basic 6.0.

Dim sResult as String
Set oSec = CreateObject("PjSvrSecurity.PjSvrSecurity")
oSec.SetDBConnection "ProjectServer"
sResult = oSec.GetResourcesResCanViewByViewID(101, 1020, 51)
Set oSec = Nothing