Partager via


IVsProject3.TransferItem Method

Transfers an item from one project to another. The project that presently owns the item to be transferred calls this method on the project intending to receive the transferred item.

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

Syntax

'Déclaration
Function TransferItem ( _
    pszMkDocumentOld As String, _
    pszMkDocumentNew As String, _
    punkWindowFrame As IVsWindowFrame _
) As Integer
'Utilisation
Dim instance As IVsProject3
Dim pszMkDocumentOld As String
Dim pszMkDocumentNew As String
Dim punkWindowFrame As IVsWindowFrame
Dim returnValue As Integer

returnValue = instance.TransferItem(pszMkDocumentOld, _
    pszMkDocumentNew, punkWindowFrame)
int TransferItem(
    string pszMkDocumentOld,
    string pszMkDocumentNew,
    IVsWindowFrame punkWindowFrame
)
int TransferItem(
    [InAttribute] String^ pszMkDocumentOld, 
    [InAttribute] String^ pszMkDocumentNew, 
    [InAttribute] IVsWindowFrame^ punkWindowFrame
)
function TransferItem(
    pszMkDocumentOld : String, 
    pszMkDocumentNew : String, 
    punkWindowFrame : IVsWindowFrame
) : int

Parameters

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 vsshell.idl:

HRESULT IVsProject3::TransferItem(
   [in] LPCOLESTR pszMkDocumentOld,
   [in] LPCOLESTR pszMkDocumentNew,
   [in] IVsWindowFrame *punkWindowFrame
);

This method is used to transfer ownership of a running document to the project. The project should call RenameDocument to transfer ownership of the document to its hierarchy and give the document a new itemid within the project.

This method is called when an open file is being transferred to your project. The sequence is for the environment to call AddItemWithSpecific and then use TransferItem to transfer the open document to your project.

Both projects must be open to transfer an item from one to the other. The implementer of the transfer must call RenameDocument to rename the item.

Permissions

See Also

Reference

IVsProject3 Interface

IVsProject3 Members

Microsoft.VisualStudio.Shell.Interop Namespace