Compartilhar via


IVsEditorFactoryNotify.NotifyItemAdded Method

Method called when a new file (cloned from a template or existing file) is added to the project.

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

Syntax

'Declaration
Function NotifyItemAdded ( _
    grfEFN As UInteger, _
    pHier As IVsHierarchy, _
    itemid As UInteger, _
    pszMkDocument As String _
) As Integer
int NotifyItemAdded(
    uint grfEFN,
    IVsHierarchy pHier,
    uint itemid,
    string pszMkDocument
)
int NotifyItemAdded(
    [InAttribute] unsigned int grfEFN, 
    [InAttribute] IVsHierarchy^ pHier, 
    [InAttribute] unsigned int itemid, 
    [InAttribute] String^ pszMkDocument
)
abstract NotifyItemAdded : 
        grfEFN:uint32 * 
        pHier:IVsHierarchy * 
        itemid:uint32 * 
        pszMkDocument:string -> int
function NotifyItemAdded(
    grfEFN : uint, 
    pHier : IVsHierarchy, 
    itemid : uint, 
    pszMkDocument : String
) : int

Parameters

  • grfEFN
    Type: UInt32

    [in] An EFNFLAGS value indicating the file's origin and how to add it. Bit flags constructed with values from the __EFNFLAGS enumeration.

  • itemid
    Type: UInt32

    [in] The item ID (VSITEMID) of the file being added.

  • pszMkDocument
    Type: String

    [in] Pointer to a string containing the path and file name.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsEditorFactoryNotify::NotifyItemAdded(
   [in] EFNFLAGS grfEFN, 
   [in] IVsHierarchy *pHier, 
   [in] VSITEMID itemid, 
   [in] LPCOLESTR pszMkDocument
);

Notes to Implementers

Implementations must appropriately set VSHPROPID_ItemSubType on the project item. Implementations may also perform other processing on the file or set other project state as appropriate.

Call this method just after cloning the template file but before opening the editor or calling the OnAfterAddFiles method of the IVsTrackProjectDocuments2 interface.

.NET Framework Security

See Also

Reference

IVsEditorFactoryNotify Interface

Microsoft.VisualStudio.Shell.Interop Namespace