Rubrique précédente: AddResource

Rubrique suivante: CommitResources

AddResourceByMap

Description

This method adds a new resource and returns the new resource ID.

This method sets the first effective time (in the resource) to the change set's default date.

Syntax

AddResourceByMap (ResourceDetails)

Parameters

Name

Type

Description

ResourceDetails

map

Map of resource details similar to the map returned from the GetResourceDetails method.

The ResourceTypes entry must contain at least one resource type.

The ResourceGroups, Resources and Services internal maps can be empty.

The CustomAttributes internal map must contain all the custom attributes attached to resource.

The ResourceGroupId entry is not relevant.

Remarks

None.

Example

Sub Main()
  Dim strResource
  strResource = "resource1"

  If Tools.IsResourceExists(strResource) Then
    Tools.log "Resource already exists - change resource name", "I"
  Else
    Dim ResourceMap
    Set ResourceMap= Tools.CreateMap

    ResourceMap("ResourceName") = strResource
    ResourceMap("ResourceDisplayName") = strResource
    ResourceMap("ChangeSetName") = "Default"
    ResourceMap("ResourceDescription") = "Added automaticaly by script"
    ResourceMap("ResourceTypes") = "Default"
    ResourceMap("ResourceGroups") = Null
    ResourceMap("Services") = Null
    ResourceMap("ContractParties") = Null
    ResourceMap("Effective") = "Yes"
    ResourceMap("CustomAttributes") = Null
    ResourceMap("ResourceTimeZone") = "GMT"    
    
    Tools.AddResourceByMap ResourceMap
    Tools.Commit
    
    Dim mapGenDetails
    Set mapGenDetails = Tools.GetResourceGeneralDetails(strResource)
    Tools.Log mapGenDetails.dump
    
  End If
End Sub