IVSSItem.Move Method 

Moves a subproject from the current parent project to a new parent project.

Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)

Syntax

'Declaration
Sub Move ( _
    <InAttribute> pINewParent As VSSItem _
)
'Usage
Dim instance As IVSSItem
Dim pINewParent As VSSItem

instance.Move(pINewParent)
void Move (
    [InAttribute] VSSItem pINewParent
)
void Move (
    [InAttribute] VSSItem^ pINewParent
)
void Move (
    /** @attribute InAttribute() */ VSSItem pINewParent
)
function Move (
    pINewParent : VSSItem
)

Parameters

  • pINewParent
    A reference of the IVSSItem type to an object representing a new parent project where the subproject is moved.

Remarks

[IDL]

HRESULT Move ([in]IVSSItem *pINewParent);

The Move method applies to projects only. When you move a project, you move all its children as well. If you attempt to move a file or move a project to its current parent, a run-time error is generated.

Example

The following example demonstrates how to use the Move method to move a project from one parent to another. To run this example create $/A and $/B folders.

using System;
using Microsoft.VisualStudio.SourceSafe.Interop;

public class IVSSTest
{
    public static void Main()
    {
        // Create a VSSDatabase object.
        IVSSDatabase vssDatabase = new VSSDatabase();

        // Open a VSS database using network name 
        // for automatic user login.
        vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini", 
                         Environment.UserName, ""); 

        IVSSItem VSS_SourceItem = vssDatabase.get_VSSItem("$/A/", false);
        VSSItem VSS_TargetItem = vssDatabase.get_VSSItem("$/B/", false);
        DisplayParent(VSS_SourceItem);

        // Move folder A from folder $/ to folder B.
        Console.WriteLine("- Moving Folder A from folder $/ to Folder B");
        VSS_SourceItem.Move(VSS_TargetItem);
        DisplayParent(VSS_SourceItem);

        // Move folder A from folder B to folder $/.
        VSS_SourceItem = vssDatabase.get_VSSItem("$/B/A/", false);
        VSS_TargetItem = vssDatabase.get_VSSItem("$/", false);
        VSS_SourceItem.Move(VSS_TargetItem);
        Console.WriteLine("- Moving folder A from folder B to $/");
        DisplayParent(VSS_SourceItem);
    }

    private static void DisplayParent(IVSSItem vssItem)
    {
        Console.WriteLine("{0}'s folder parent is folder {1}", 
                          vssItem.Spec, vssItem.Parent.Spec);
    }
}

Output:

$/A's folder parent is folder $/

- Moving Folder A from folder $/ to Folder B

$/B/A's folder parent is folder $/B

- Moving folder A from folder B to $/

$/A's folder parent is folder $/

See Also

Reference

IVSSItem Interface
IVSSItem Members
Microsoft.VisualStudio.SourceSafe.Interop Namespace