Condividi tramite


GetProperty Method

Creates and returns a CatalogProperty object containing information for the specified catalog property.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public Function GetProperty ( _
    propertyName As String _
) As CatalogProperty
'Usage
Dim instance As CatalogContext
Dim propertyName As String
Dim returnValue As CatalogProperty

returnValue = instance.GetProperty(propertyName)
public CatalogProperty GetProperty(
    string propertyName
)
public:
CatalogProperty^ GetProperty(
    String^ propertyName
)
public function GetProperty(
    propertyName : String
) : CatalogProperty

Parameters

  • propertyName
    Type: System..::.String
    The property name to retrieve the information for. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).

Return Value

Type: Microsoft.CommerceServer.Catalog..::.CatalogProperty
A CatalogProperty object containing information for the specified catalog property.

Exceptions

Exception Condition
EntityDoesNotExistException

The property specified by propertyName does not exist in the catalog system.

Remarks

The propertyName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 100 characters.

  • Not contain the .,"[] characters.

  • Not begin with a digit.

You can use the CatalogProperty object returned by this method to access the information about this property. For properties of the CatalogDataType you can also access the enumeration values defined for the property. If you make any changes to the CatalogProperty object returned by this method then you should call the Save method to save the changes to the catalog system.

Examples

private void GetProperty(CatalogContext catalogContext)
{
  CatalogProperty catalogProperty = catalogContext.GetProperty("propertyname");
  catalogProperty.Information.CatalogProperties[0].DisplayName = "DisplayName";
  catalogProperty.Information.CatalogProperties[0].IncludeInSpecSearch = true;
  catalogProperty.Save();
}

Permissions

See Also

Reference

CatalogContext Class

CatalogContext Members

Microsoft.CommerceServer.Catalog Namespace