Share via


AddResource Method

Description

Used by the Project Data Service (PDS) to create a resource, without calling AddPJAccount or AddNTAccount, for the Microsoft Office Project Server 2003 security object.

Syntax

Function AddResource( _
   ByVal bstrAddResourceXML As String _
) As Long

Parameters

Parameter Description

bstrAddResourceXML

The XML as listed in the section XML String Value.

Return Value

The AddResource method returns HRESULT as a Long (4-byte integer) value.

Remarks

By using AddResource, the PDS can set RES_EUID for the newly created account, so the new account is associated with an existing enterprise resource.

Example

The following example is for Microsoft Visual Basic 6.0.

Dim lResult as Long
Dim sResourceXML as String
    ' Assign an XML string value to sResourceXML; an example follows.

Set oSec = CreateObject("PjSvrSecurity.PjSvrSecurity")
oSec.SetDBConnection "ProjectServer"
lResult = oSec.AddResource(sResourceXML)
Set oSec = Nothing

XML String Value

Following is a sample XML string for the sResourceXML variable in the example.

<MSP_WEB_XML_ADD_RESOURCE>

  <!--*************************************************************
  // RES_NAME: Resource's name. Must be provided.
  **************************************************************-->
  <RES_NAME> SomeResName </RES_NAME>

  <!--*************************************************************
  // RES_ISNT(0): Specify whether the new resource is an NT account.
  **************************************************************-->
  <RES_ISNT> 0 </RES_ISNT>

  <!--*************************************************************
  // RES_PASSWD('password'): password. 
  // Must be provided for PJ Account.
  **************************************************************-->
  <RES_PASSWD> password </RES_PASSWD>

  <!--*************************************************************
  // RES_EMAIL: Resource's e-mail (optional).
  **************************************************************-->
  <RES_EMAIL> alias@mycompany.com </RES_EMAIL>

  <!--*************************************************************
  // RES_PHONETIC: Resource name phonetic (optional).
  **************************************************************-->
  <RES_PHONETIC />

  <!--*************************************************************
  // RES_EUID: Enterprise Resource UID (optional).
  **************************************************************-->
  <RES_EUID> 101 </RES_EUID>

  <!--*************************************************************
  // RES_CAN_LOGIN(1)
  **************************************************************-->
  <RES_CAN_LOGIN> 1 </RES_CAN_LOGIN>

  <!--*************************************************************
  // RES_COUNT_LICENSE(1)
  **************************************************************-->
  <RES_COUNT_LICENSE> 1 </RES_COUNT_LICENSE>

  <!--*************************************************************
  // RES_AUTHENTICATION_INFO: Specifies the authentication info.
  // HASHEDPWD0(0),  HASHEDPWD1(0) : 
  // RANDOMSEED0(0), RANDOMSEED1(0):
  **************************************************************-->
  <RES_AUTHENTICATION_INFO HASHEDPWD0="0" HASHEDPWD1="0" RANDOMSEED0="0" RANDOMSEED1="0" />

  <!--*************************************************************
  // RES_GROUPS: Specifies groups the new resource belongs to (optional).
  //             If not provided, no groups contain the new resource.
  // GROUP: The GUID for the group.
  **************************************************************-->
  <RES_GROUPS>
    <GROUP>{xxxxxxxx}</GROUP>
  </RES_GROUPS>

  <!--*************************************************************
  // RES_GLOBAL_PERMISSIONS: Specifies global permissions (optional).
  //   If not provided, no global permissions assigned to the new resource.
  // ACTION: ID, ALLOW, DENY
  **************************************************************-->
  <RES_GLOBAL_PERMISSIONS>
<ACTION ID="101" ALLOW="1" DENY="0" />
    <ACTION ID="102" ALLOW="1" DENY="0" />
  </RES_GLOBAL_PERMISSIONS>

  <!--*************************************************************
  // RES_CATEGORY_PERMISSIONS: Specify category permissions (optional).
  //   If not provided, no category permissions assigned to the resource.
  // CATEGORY: ID - Category ID
  //   ACTION: ID, ALLOW, DENY
  **************************************************************-->
  <RES_CATEGORY_PERMISSIONS>
    <CATEGORY ID="101">
      <ACTION ID="508" ALLOW="1" DENY="0" />
      <ACTION ID="509" ALLOW="1" DENY="0" />
    </CATEGORY>
  </RES_CATEGORY_PERMISSIONS>

</MSP_WEB_XML_ADD_RESOURCE>