Partilhar via


RemoveProperty Method

Removes an existing property from the current definition.

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

Syntax

'Declaration
Public Sub RemoveProperty ( _
    propertyName As String _
)
'Usage
Dim instance As CatalogDefinition
Dim propertyName As String

instance.RemoveProperty(propertyName)
public void RemoveProperty(
    string propertyName
)
public:
void RemoveProperty(
    String^ propertyName
)
public function RemoveProperty(
    propertyName : String
)

Parameters

  • propertyName
    Type: System..::.String
    The name of the property to remove. Cannot be nullNothingnullptra null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
ArgumentNullException

The propertyName is null.

ValidationException

The propertyName is invalid.

EntityDoesNotExistException

The propertyName is does not belong to the definition.

Remarks

When you make changes to a definition you should call the Save method to save the changes to the catalog system. If you remove the last VariantProperty from a ProductDefinition and that definition is being used in catalogs then all the product families based on that definition will be changed to products and all the variants based on that definition will be deleted.

Examples

catalogDefinitions.EditDefinition(categoryDefinition, property2.Name, property1.Name);

internal void EditDefinition(CatalogDefinition definition, string propertyToAdd, string propertyToRemove)
{
 try
 {
  definition.AddProperty(propertyToAdd, DefinitionPropertyType.NormalProperty);
  definition.RemoveProperty(propertyToRemove);
  definition.Save();

 }
 catch (OptimisticLockException)
 {
 // The definition was changed by another user
 }
}

Permissions

See Also

Reference

CatalogDefinition Class

CatalogDefinition Members

Microsoft.CommerceServer.Catalog Namespace