IExpressionStore::RenameExpression Method [C++]

Use this method to rename an existing expression in the expression store. The new expression name must be unique or the operation will fail.

Definition

[C++]

HRESULT IExpressionStore::RenameExpression(longnExprID,
 BSTRstrNewName);

[Visual Basic]

Sub RenameExpression(nExprID As Long,
 strNewName As String)

Parameters

  • nExprID[C++]
    [in] A long that contains the expression ID.
  • nExprID[Visual Basic]
    [in] A Long that contains the expression ID.
  • strNewName[C++]
    [in] A BSTR that contains the new name.
  • strNewName[Visual Basic]
    [in] A String that contains the new name.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] None.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_EXPR_BADCONNECTION

[C++] 0x8110001F

[Visual Basic] &H8110001F

Invalid connection
E_EXPR_BADEXPRID

[C++] 0x8110000A

[Visual Basic] &H8110000A

Invalid expression ID specified, or expression ID not found in store
E_EXPR_BADEXPRNAME

[C++] 0x81100003

[Visual Basic] &H81100003

Invalid expression name
E_EXPR_DUPEXPRNAME

[C++] 0x81100007

[Visual Basic] &H81100007

Duplicate expression name
E_EXPR_INVALIDFIELDSIZE

[C++] 0x81100005

[Visual Basic] &H81100005

The new name exceeds the maximum size of 30 characters
E_EXPR_NOCONNECTIONSTRING

[C++] 0x8110000D

[Visual Basic] &H8110000D

No connection string specified

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

Use the GetExprID method to translate an expression name to its corresponding expression ID.

Call the Connect method before calling the RenameExpression method.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

' oExpressionStore is an ExpressionStore object connected to
' a valid expression store.
' 52997 is a valid expression ID retrieved from the GetExprId method.

oExpressionStore.RenameExpression(52997, "MyNewName")

See Also

[C++]ExpressionStore Object

[C++]IExpressionStore::Connect

[C++]IExpressionStore::GetExprID

[Visual Basic]ExpressionStore Object

[Visual Basic]ExpressionStore.Connect

[Visual Basic]ExpressionStore.GetExprID

Copyright © 2005 Microsoft Corporation.
All rights reserved.