ModifyResource Method

Description

Modifies the MSP_WEB tables using the Microsoft Office Project Server 2003 security object. ModifyResource does not call the Project Data Service (PDS) again. A benefit of ModifyResource is that you need only provide the changed fields in the XML string.

Syntax

Function ModifyResource( _
   ByVal bstrModifyResourceXML As String _
) As Long

Parameters

Parameter Description

bstrModifyResourceXML

Required Long. The XML as listed in the section XML String Value.

Return Value

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

Remarks

The PDS uses ModifyResource internally to update information about an existing account. For more information, see ModifyAccount Function.

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.ModifyResource(sResourceXML)
Set oSec = Nothing

XML String Value

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

<MSP_WEB_XML_MODIFY_RESOURCE>

  <!--*************************************************************
  // RES_ID: Resource's ID (required).
  **************************************************************-->
  <RES_ID>101</RES_ID>

  <!--*************************************************************
  // RES_EUID: Cannot change the RES_EUID when ModifyResource.
  **************************************************************-->

  <!--*************************************************************
  // RES_ENABLE: Enable or disable the resource.
  **************************************************************-->
  <RES_ENABLE>1</RES_ENABLE>

  <!--*************************************************************
  // RES_ISNT: Specify whether the new resource is an NT account. 
  // If 1, RES_NAME, and RES_NTACCOUNT must also be provided.
  **************************************************************-->
  <RES_ISNT>0</RES_ISNT>

  <!--*************************************************************
  // RES_NAME: Resource's name.
  **************************************************************-->
  <RES_NAME>Resource Name</RES_NAME>

  <!--*************************************************************
  // RES_NTACCOUNT: Resource's NT Account name.
  **************************************************************-->
  <RES_NTACCOUNT>domain\alias</RES_NTACCOUNT>

  <!--*************************************************************
  // RES_PASSWD: Password.
  **************************************************************-->
  <RES_PASSWD>password<RES_PASSWD>

  <!--*************************************************************
  // RES_EMAIL: Resource's e-mail account.
  **************************************************************-->
  <RES_EMAIL>alias@companyname.com</RES_EMAIL>

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

  <!--*************************************************************
  // RES_EUID: Enterprise resource EUID
  **************************************************************-->
  <RES_EUID />

  <!--*************************************************************
  // RES_CAN_LOGIN:
  **************************************************************-->
  <RES_CAN_LOGIN>1</RES_CAN_LOGIN>

  <!--*************************************************************
  // RES_COUNT_LICENSE:
  **************************************************************-->
  <RES_COUNT_LICENSE>1</RES_COUNT_LICENSE>

  <!--*************************************************************
  // RES_GROUPS: Specifies groups the new resource belongs to.
  //             If not provided, no changes are made to the original setting.
  // GROUP: The security group (WRES_GUID) the resource belongs to.
  **************************************************************-->
  <RES_GROUPS FORMAT="0">
    <GROUP>{xxxxxxxx}</GROUP>
  </RES_GROUPS>

  <!--*************************************************************
  // RES_GLOBAL_PERMISSIONS: Specifies global permissions (optional).
  //   If not provided, no changes are made to the original settings.
  // ACTION: ID, ALLOW, DENY
  **************************************************************-->
  <RES_GLOBAL_PERMISSIONS >
    <ACTION ID="101" ALLOW="1" DENY="0" />
  </RES_GLOBAL_PERMISSIONS>

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

</MSP_WEB_XML_MODIFY_RESOURCE>