Share via


CheckSPObjectPermission Method

Description

Checks if a specified resource account has specified object permission on an object using the Microsoft Office Project Server 2003 security object. The function is similar to CheckSPObjectListPermission but CheckSPObjectPermission checks for one object instead of a list of objects.

Syntax

Function CheckSPObjectPermission( _
   ByVal sp_guid As String, _
   ByVal so_id As Long, _
   ByVal so_type As Long, _
   ByVal act_id As Long _
) As Long

Parameters

Parameter Description

sp_guid

Required String. Resource account GUID, as in WRES_GUID MSP_WEB_RESOURCES.WRES_GUID.

so_id

Required Long. Security object ID. If the security object ID is a project, then so_id is the project ID in MSP_WEB_PROJECTS.WPROJ_ID.

so_type

Required Long. The object type.

so_type Object Type
1 Project
2 Resource
3 View (do nothing)
4 Model

act_id

Required Long. The object/category permission ID to check.

Return Value

The CheckSPObjectPermission method returns True (1) or False (0) as a Long (4-byte integer) value.

Example

The following example checks a resource for Permission ID 101 in project 21. The example is for Microsoft Visual Basic 6.0.

Dim lResult as Long
Set oSec = CreateObject("PjSvrSecurity.PjSvrSecurity")
oSec.SetDBConnection "ProjectServer"
lResult = oSec.CheckSPObjectPermission("{82F50D90-F5F0-4B5D-8384-839B98823D2F}", _
               21, 1, 101)
Set oSec = Nothing