IVsToolboxDataProvider2.GetItemID Method

Used by the environment to retrieve and saves the canonical ID for the given Toolbox tab when a user selects the export option from the Import/Export Settings feature available on the IDE’s Tools menu.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'Declaration
Function GetItemID ( _
    pDO As IDataObject, _
    <OutAttribute> ByRef pbstrID As String _
) As Integer
int GetItemID(
    IDataObject pDO,
    out string pbstrID
)
int GetItemID(
    [InAttribute] IDataObject^ pDO, 
    [OutAttribute] String^% pbstrID
)
abstract GetItemID : 
        pDO:IDataObject * 
        pbstrID:string byref -> int 
function GetItemID(
    pDO : IDataObject, 
    pbstrID : String
) : int

Parameters

  • pbstrID
    Type: System.String%
    [out] The locale-invariant canonical ID of the Toolbox tab.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell80.idl:

HRESULT IVsToolboxDataProvider2::GetItemID(
   [in] IDataObject *pDO,
   [out] BSTR *pbstrID
);

The environment calls IVsToolboxDataProvider2.GetItemID when a user chooses the export option of the IDE's Import/Export Settings feature.

On settings import, the environment will retrieve that ID an pass it to the ReconstituteItem method to recreate the Toolbox item.

The canonical ID, returned as pbstrID, is different from the localizable tab name defined when AddTab is called.

While, canonical tab names are required to be unique, localized strings change depending on the locale under which the IDE is running.

Therefore, the canonical ID must be locale-invariant.

There are no particular restrictions on the format of the canonical ID string, a GUID might be used, or an easy to remembered string in the language of the developer could be employed.

Any VSPackage that creates a Toolbox tab should call the SetIDOfTab.

.NET Framework Security

See Also

Reference

IVsToolboxDataProvider2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace