Compartilhar 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

'Declaration
Function TransferItem ( _
    pszMkDocumentOld As String, _
    pszMkDocumentNew As String, _
    punkWindowFrame As IVsWindowFrame _
) As Integer
int TransferItem(
    string pszMkDocumentOld,
    string pszMkDocumentNew,
    IVsWindowFrame punkWindowFrame
)
int TransferItem(
    [InAttribute] String^ pszMkDocumentOld, 
    [InAttribute] String^ pszMkDocumentNew, 
    [InAttribute] IVsWindowFrame^ punkWindowFrame
)
abstract TransferItem : 
        pszMkDocumentOld:string * 
        pszMkDocumentNew:string * 
        punkWindowFrame:IVsWindowFrame -> int
function TransferItem(
    pszMkDocumentOld : String, 
    pszMkDocumentNew : String, 
    punkWindowFrame : IVsWindowFrame
) : int

Parameters

  • pszMkDocumentOld
    Type: String

    [in] Path to the old document. Passed as pszDocumentOld to RenameDocument.

  • pszMkDocumentNew
    Type: String

    [in] Path to the new document. Passed as pszDocumentNew to RenameDocument.

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 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.

.NET Framework Security

See Also

Reference

IVsProject3 Interface

Microsoft.VisualStudio.Shell.Interop Namespace