DocumentManager.RenameDocument Method

Renames a document in the running document table.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  MPF.Project.NonShipping (in MPF.Project.NonShipping.dll)

Syntax

'宣言
Public Shared Sub RenameDocument ( _
    site As IServiceProvider, _
    oldName As String, _
    newName As String, _
    newItemId As UInteger _
)
'使用
Dim site As IServiceProvider
Dim oldName As String
Dim newName As String
Dim newItemId As UInteger

DocumentManager.RenameDocument(site, oldName, _
    newName, newItemId)
public static void RenameDocument(
    IServiceProvider site,
    string oldName,
    string newName,
    uint newItemId
)
public:
static void RenameDocument(
    IServiceProvider^ site, 
    String^ oldName, 
    String^ newName, 
    unsigned int newItemId
)
public static function RenameDocument(
    site : IServiceProvider, 
    oldName : String, 
    newName : String, 
    newItemId : uint
)

Parameters

Remarks

Using the service provider, this method gets a IVsRunningDocumentTable pointer to the SVsRunningDocumentTable service. This method then gets a IVsUIShellOpenDocument pointer to the SVsUIShellOpenDocument service from the service provider. If either the running document table or the open document service is null, the method silently returns. This method finds and locks the document of the original name; if it fails to find the document, it silently returns. This method then renames the document and updates the item ID.

This method throws a [System.ArgumentNullException] if the service provider is null or if the new item ID is null. It throws a [System.ArgumentException] if the new name is null or empty. It throws other exceptions if the rename fails.

Permissions

See Also

Reference

DocumentManager Class

DocumentManager Members

Microsoft.VisualStudio.Package Namespace