Community discussion forum

C# Sourcesafe Automation

  • 3 years ago

    I'm using the class below to try and automate sourcesafe from within a C# application that I am developing.

    I call the .OpenDB method and this work's fine. Then I call the following:

    .GetItem("$/Pluto/", ref sLocalPath, (int)SourceSafeTypeLib.VSSFlags.VSSFLAG_RECURSYES);

    Which in my understanding should get the project called "Pluto" from Sourcesafe recursing through all the directories within that project and copy them to the supplied LocalPath?

    What is happening is that any files that are directly in the project "Pluto" are being copied but the sub directories and items within them are not.

    Any ideas?

    Thanks in advance...

     


    Neil

    P.S. Here's the class:

    using System;

    namespace IVSSFunctionLibrary
    {
     /// <summary>
     /// Summary description for IVSS Library.
     /// </summary>
     ///
     
     public class clIVSSLibrary
     {
      /// **************************************************** //
      /// ********** Global variables and constants ********** //
      /// **************************************************** //










      /// VSS Database Object
      private SourceSafeTypeLib.VSSDatabase VSS_Database;

      /// Password variable
      private string CurrentPassword;

      /// Root Project constant
      private const string proj_Root = "$/";

      /// Used in retrieving Latest Property of a VSS Item
      enum Latest :int
      {
       Comment = 1,
       Label,
       VersionNumber,
       Date,
       LabelComment
      };







      /// Variables to track the number of times each IVSS method is called. This
      /// is used for logging purposes.
      public long AddItemCount = 0;
      public long BranchItemCount = 0;
      public long CheckInItemCount = 0;
      public long CheckOutCommentCount = 0;
      public long CheckOutDateCount = 0;
      public long CheckOutItemCount = 0;
      public long CheckOutLocalSpecCount = 0;
      public long CheckOutMachineCount = 0;
      public long CheckOutUserNameCount = 0;
      public long CheckOutVersionNumberCount = 0;
      public long CreateProjectCount = 0;
      public long DatabaseAddUserCount = 0;
      public long DatabaseDeleteUserCount = 0;
      public long DatabaseEnableRightsCount = 0;
      public long DatabaseGetCurrentProjectCount = 0;
      public long DatabaseGetDBNameCount = 0;
      public long DatabaseGetDefaultRightsCount = 0;
      public long DatabaseGetItemCount = 0;
      public long DatabaseGetItemCountsCount = 0;
      public long DatabaseGetSrcSafeINICount = 0;
      public long DatabaseGetUserCount = 0;
      public long DatabaseGetVersionCount = 0;
      public long DatabaseSetCurrentProjectCount = 0;
      public long DatabaseSetDefaultRightsCount = 0;
      public long DatabaseUserNameCount = 0;
      public long DatabaseUsersCount = 0;
      public long DatabaseGetUserNamesCount = 0;
      public long DestroyItemCount = 0;
      public long DiffItemsCount = 0;
      public long GetItemCount = 0;
      public long GetItemBinaryCount = 0;
      public long GetItemCheckOutsCount = 0;
      public long GetItemChildCount = 0;
      public long GetItemDeletedCount = 0;
      public long GetItemIsCheckedOutCount = 0;
      public long GetItemLinksCount = 0;
      public long GetItemNameCount = 0;
      public long GetItemParentCount = 0;
      public long GetItemTypeCount = 0;
      public long GetItemVersionCount = 0;
      public long GetItemVersionCountsCount = 0;
      public long MoveItemCount = 0;
      public long SetItemCheckOutFolderCount = 0;
      public long SetItemDeletedCount = 0;
      public long SetItemLabelCount = 0;
      public long SetItemNameCount = 0;
      public long SetItemTypeCount = 0;
      public long OpenMethodCount = 0;
      public long ShareItemCount = 0;
      public long UnCheckOutItemCount = 0;  
      public long UserChangePasswordCount = 0;
      public long UserGetReadOnlyCount = 0;
      public long UserGetRightsCount = 0;
      public long UserGetNameCount = 0;
      public long UserRemoveRightsCount = 0;
      public long UserSetNameCount = 0;
      public long UserSetReadOnlyCount = 0;
      public long UserSetRightsCount = 0;
      public long VersionActionCount = 0;
      public long VersionCommentCount = 0;
      public long VersionDateCount = 0;
      public long VersionLabelCount = 0;
      public long VersionLabelCountCommentCount = 0;
      public long VersionSpecCount = 0;
      public long VersionUserNameCount = 0;
      public long VersionVersionCount = 0;


































































      /// Unused class constructer
      public clIVSSLibrary()
      {
      }


      /// *************************************************** //
      /// ********** Methods to drive the database ********** //
      /// *************************************************** //
      
      /// Adds a file to the passed project
      public string AddItem(string ParentProject, string ItemToAddPath, string AddComment, int Flags)   
      {
       SourceSafeTypeLib.VSSItem VSS_Item;






       try
       {

        VSS_Item = VSS_Database.get_VSSItem(ParentProject, false);
        VSS_Item.Add (ItemToAddPath, AddComment, Flags);
        AddItemCount = AddItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }






       return "";
      }

      /// Adds a user to the database
      public string AddUser(string UserName, string Password, bool ReadOnly)
      {
       try
       {
        VSS_Database.AddUser(UserName, Password, ReadOnly);
        DatabaseAddUserCount = DatabaseAddUserCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }










       return "";
      }

      /// Returns whether project security is enabled
      public string AreProjectRightsEnabled(ref bool Enabled)
      {
       try
       {
        Enabled = VSS_Database.ProjectRightsEnabled;
        DatabaseEnableRightsCount = DatabaseEnableRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }










       return "";
      }

      /// Branches an item
      public string BranchItem(string ItemToBranch, string Comment, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_ItemToBranch;


       try
       {
        VSS_ItemToBranch = VSS_Database.get_VSSItem(ItemToBranch, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        VSS_ItemToBranch.Branch(Comment, Flags);
        BranchItemCount = BranchItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";

      }

      /// Change the user's Password
      public string ChangePassword(string NewPassword, string UserName)
      {
       SourceSafeTypeLib.VSSUser User;


       try
       {
        User = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        User.Password = NewPassword;
        UserChangePasswordCount = UserChangePasswordCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";

      }

      /// Changes the user's Name
      public string ChangeUserName(string UserName, string NewName)
      {
       SourceSafeTypeLib.VSSUser User;


       try
       {
        User = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        User.Name = NewName;
        UserSetNameCount = UserSetNameCount + 1;




       }
       catch(Exception e)
       {
        return e.ToString();
       }



       return "";

      }

      /// Changes the user's Read Only state
      public string ChangeUserReadOnlyRights(string UserName, bool ReadOnly)
      {
       SourceSafeTypeLib.VSSUser User;


       try
       {
        User = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        User.ReadOnly = ReadOnly;
        UserSetReadOnlyCount = UserSetReadOnlyCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";

      }

      /// Check In an Item(s)
      public string CheckInItem(string ItemToCheckIn, string CheckInPath, ref string Comment, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;


       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemToCheckIn, false);
        VSS_Item.Checkin(Comment, CheckInPath, Flags);
        CheckInItemCount = CheckInItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }
      
      /// Check Out Tip Version
      public string CheckOutItem(string ItemToCheckOut, string CheckOutPath, ref string Comment, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;





       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemToCheckOut, false);
        VSS_Item.Checkout(Comment, CheckOutPath, Flags);
        CheckOutItemCount = CheckOutItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }

      /// Checks Out a specific version of a file by Version Number
      public string CheckOutVersion(string Comment, string ItemPath, int VersionNumber, string LocalPath, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;
       SourceSafeTypeLib.VSSItem VSS_Version_Item;



       try
       {
        /// Instantiate the item
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;



        /// Check Out the Version
        VSS_Version_Item = VSS_Item.get_Version(VersionNumber);
        DatabaseGetVersionCount = DatabaseGetVersionCount + 1;
        VSS_Version_Item.Checkout(Comment, LocalPath, 0);
        CheckOutItemCount = CheckOutItemCount + 1;
       }




       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Checks Out a specific version of a file by Label
      public string CheckOutVersionByLabel(string Comment, string ItemPath, string VersionLabelCount, string LocalPath, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;
       SourceSafeTypeLib.VSSItem VSS_Version_Item;



       try
       {
        /// Instantiate the item
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;



        /// Check Out the Version
        VSS_Version_Item = VSS_Item.get_Version(VersionLabelCount);
        GetItemVersionCount = GetItemVersionCount + 1;
        VSS_Version_Item.Checkout(Comment, LocalPath, 0);
        CheckOutItemCount = CheckOutItemCount + 1;
       }




       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Closes a VSS Database
      public string CloseDB()
      {
       try
       {
        VSS_Database = null;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";

      }

      /// Creates a new project
      public string CreateProject(string Parent, string ProjectName, string Comment)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;


       try
       {
        VSS_Item = VSS_Database.get_VSSItem(Parent, false);
        VSS_Item.NewSubproject(ProjectName, Comment);
        CreateProjectCount = CreateProjectCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }

      /// Deletes or destroys an item
      public string DeleteItem(string ItemToDelete, bool Destroy)
      {
       bool Deleted = false;
       SourceSafeTypeLib.IVSSItem VSS_ItemToDelete;
       
       try
       {
        IsItemDeleted(ItemToDelete, ref Deleted);
        VSS_ItemToDelete = VSS_Database.get_VSSItem(ItemToDelete, Deleted);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        if (Destroy == false)
        {
         VSS_ItemToDelete.Deleted = true;
         SetItemDeletedCount = SetItemDeletedCount + 1;
        }
        else
        {
         VSS_ItemToDelete.Destroy();
         DestroyItemCount = DestroyItemCount + 1;
        }



















       }
       catch(Exception e)
       {
        return e.ToString();
       }



       return "";
      }

      /// Deletes a user from the database
      public string DeleteUser(string UserName)
      {
       SourceSafeTypeLib.IVSSUser User;


       try
       {
        User = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        User.Delete();
        DatabaseDeleteUserCount = DatabaseDeleteUserCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";
      }

      /// Compares two items and determines if they differ
      public string DoItemsDiffer(string VSSItemToDiff, string LocalItemToDiff, ref bool ItemsDiff)
      {
       SourceSafeTypeLib.IVSSItem VSSItem;


       try
       {
        VSSItem = VSS_Database.get_VSSItem(VSSItemToDiff, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        ItemsDiff = VSSItem.get_IsDifferent(LocalItemToDiff);
        DiffItemsCount = DiffItemsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";
      }

      /// Enables project security
      public string EnabledProjectRights(bool Enable)
      {
       try
       {
        VSS_Database.ProjectRightsEnabled = Enable;
        DatabaseEnableRightsCount = DatabaseEnableRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }










       return "";
      }
     
      /// Get the checkout folder for an item
      public string GetCheckOutFolder(string ItemPath, string UserName, ref string CheckOutPath)
      {
       CheckOutPath = "";
       SourceSafeTypeLib.VSSItem VSS_Item;      
       
       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        foreach(SourceSafeTypeLib.VSSCheckout VSS_CheckOut in VSS_Item.Checkouts)
        {
         CheckOutUserNameCount = CheckOutUserNameCount + 1;
         if (VSS_CheckOut.Username == UserName)
         {
          CheckOutPath = VSS_CheckOut.LocalSpec;
          CheckOutLocalSpecCount = CheckOutLocalSpecCount + 1;
          break;
         }
        }
        GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }


























       return "";
      }

      /// Get the checkout count for a file
      public string GetCheckOutInfo(out string[,] CheckOutData, string FilePath)
      {  
       int CheckOutCount;
       int Row;



       SourceSafeTypeLib.VSSItem VSS_CheckedOutItem;
       VSS_CheckedOutItem = VSS_Database.get_VSSItem(FilePath, false);
       DatabaseGetItemCount = DatabaseGetItemCount + 1;
       CheckOutCount = VSS_CheckedOutItem.Checkouts.Count;
       GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
       CheckOutData = new string[CheckOutCount, 8];




       try
       {
        Row = 0;
        foreach(SourceSafeTypeLib.VSSCheckout VSS_CheckOut in VSS_CheckedOutItem.Checkouts)
        {
         /// Item Name
         CheckOutData[Row, 0] = VSS_CheckOut.Username;
         CheckOutUserNameCount = CheckOutUserNameCount + 1;
         /// Date
         CheckOutData[Row, 1] = VSS_CheckOut.Date.ToString();
         CheckOutDateCount = CheckOutDateCount + 1;
         /// Version
         CheckOutData[Row, 2] = VSS_CheckOut.VersionNumber.ToString();
         CheckOutVersionNumberCount = CheckOutVersionNumberCount + 1;
         /// Computer
         CheckOutData[Row, 3] = VSS_CheckOut.Machine;
         CheckOutMachineCount = CheckOutMachineCount + 1;
         /// Folder
         CheckOutData[Row, 4] = VSS_CheckOut.LocalSpec;
         CheckOutLocalSpecCount = CheckOutLocalSpecCount + 1;
         /// Project
         if (VSS_CheckedOutItem.Parent.Name == "")
         {
          GetItemParentCount = GetItemParentCount + 1;
          CheckOutData[Row, 5] = proj_Root;
         }
         else                    
         {
          GetItemParentCount = GetItemParentCount + 1;
          CheckOutData[Row, 5] = VSS_CheckedOutItem.Parent.Name;
         }
         /// Comment
         CheckOutData[Row, 6] = VSS_CheckOut.Comment;
         CheckOutCommentCount = CheckOutCommentCount + 1;
         /// FileName
         CheckOutData[Row, 7] = VSS_CheckedOutItem.Name;
         GetItemNameCount = GetItemNameCount + 1;



































         Row = Row + 1;
        }
        GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }






       return "";
      }

      /// Returns CheckOut Status of current VSSItem
      public string GetCheckOutState(string FilePath, ref int CheckOutStatus)
      {
       SourceSafeTypeLib.VSSItem VSS_FileItem;


       try
       {
        VSS_FileItem = VSS_Database.get_VSSItem(FilePath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        CheckOutStatus = VSS_FileItem.IsCheckedOut;
        GetItemIsCheckedOutCount = GetItemIsCheckedOutCount + 1;
       }





       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }
      /// Returns an array of subprojects, files and properties of current Project
      public string GetChildren(string ProjectPath, bool ProjectDeleted, out string[,] Children, bool IncludeDeleted)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;
       SourceSafeTypeLib.IVSSItems ChildCollection;




       /// Instantiate the parent project
       VSS_Item = VSS_Database.get_VSSItem(ProjectPath, ProjectDeleted);

       /// Declare and initialize variables
       int Count =  VSS_Item.get_Items(IncludeDeleted).Count;
       GetItemChildCount = GetItemChildCount + 1;
       int Row = 0;   
       Children = new string[Count, 11];
       Count = 0;




       try
       {    
        ChildCollection = VSS_Item.get_Items(IncludeDeleted);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;


        foreach(SourceSafeTypeLib.VSSItem VSS_ChildItem in ChildCollection)
        {
         /// Item Name
         Children[Row, Count] = VSS_ChildItem.Name;
         GetItemNameCount = GetItemNameCount + 1;
         Count++;




         /// Project or File?
         Children[Row, Count] = VSS_ChildItem.Type.ToString();
         GetItemTypeCount = GetItemTypeCount + 1;
         Count++;


         /// Tip Version Number
         Children[Row, Count] = VSS_ChildItem.VersionNumber.ToString();
         GetItemVersionCount = GetItemVersionCount + 1;
         Count++;


         /// Get File specific properties
         if (VSS_ChildItem.Type == (int)SourceSafeTypeLib.VSSItemType.VSSITEM_FILE)
         {
          /// Checked Out?
          Children[Row, Count] = VSS_ChildItem.IsCheckedOut.ToString();
          GetItemIsCheckedOutCount = GetItemIsCheckedOutCount + 1;
          Count++;





          /// File is Checked Out
          if (Children[Row, Count] != "0")
          {
           foreach (SourceSafeTypeLib.IVSSCheckout VSS_CheckOut in VSS_ChildItem.Checkouts)
           {
            /// Check Out Folder
            Children[Row, Count] = VSS_CheckOut.LocalSpec;
            CheckOutLocalSpecCount = CheckOutLocalSpecCount + 1;
            Count++;







            /// Check Out Comment
            Children[Row, Count] = VSS_CheckOut.Comment;
            CheckOutCommentCount = CheckOutCommentCount + 1;
            Count++;


            /// Check Out User Name

            /// Multiple CheckOuts
            if (VSS_ChildItem.Checkouts.Count > 1)
            {
             /// Checked Out by current user and someone else
             if (VSS_ChildItem.IsCheckedOut == (int)SourceSafeTypeLib.VSSFileStatus.VSSFILE_CHECKEDOUT_ME)
             {
              Children[Row, Count] = VSS_Database.Username + "...";
              DatabaseUserNameCount = DatabaseUserNameCount + 1;
             }
             
              /// Checked Out by current user and someone else
             else
             {
              Children[Row, Count] = VSS_CheckOut.Username + "...";
              CheckOutUserNameCount = CheckOutUserNameCount + 1;
             }
             GetItemIsCheckedOutCount = GetItemIsCheckedOutCount + 1;
             Count++;
             Children[Row, Count] = "1";
            }
            
             /// Single CheckOut
            else
            {
             Children[Row, Count] = VSS_CheckOut.Username;
             CheckOutUserNameCount = CheckOutUserNameCount + 1;
             Count++;
             Children[Row, Count] = "0";
            }
            GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
            Count++;
            break;
           }
           GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
          }
          Count = 8;


































          /// Get the current file date
          GetFileDate(VSS_ChildItem, ref Children[Row, Count]);
          Count++;

          /// Shared?
          if (VSS_ChildItem.Links.Count != 1)
          {
           Children[Row, Count] = "1";
          }
          else
          {
           Children[Row, Count] = "0";
          }
          GetItemLinksCount = GetItemLinksCount + 1;
          Count++;
         }
         GetItemTypeCount = GetItemTypeCount+ 1;
         Count = 10;












         /// Deleted?
         if ((VSS_ChildItem.Deleted == true) || (VSS_Item.Deleted == true ))
         {
          Children[Row, Count] = "1";
         }
         else
         {
          Children[Row, Count] = "0";
         } 
         GetItemDeletedCount = GetItemDeletedCount + 2;
         
         Count = 0;
         Row++;
        }
        DatabaseGetItemCountsCount = DatabaseGetItemCountsCount + 1;
       }
       
       catch(Exception e)
       {
        
        return e.ToString();
       }




















       return "";

      }

      /// Returns the current Project
      public string GetCurrentProject()
      {
       DatabaseGetCurrentProjectCount = DatabaseGetCurrentProjectCount + 1;
       return VSS_Database.CurrentProject;
      }
      
      /// Retrieves the Database Name
      public string GetDatabaseName(ref string DataBaseName)
      {
       try
       {
        DataBaseName = VSS_Database.DatabaseName;
        DatabaseGetDBNameCount = DatabaseGetDBNameCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }

















       return "";
      }

      /// Returns default user rights
      public string GetDefaultUserRights(ref int Rights)
      {
       try
       {
        Rights = VSS_Database.DefaultProjectRights;
        DatabaseGetDefaultRightsCount = DatabaseGetDefaultRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }










       return "";
      }

      /// Get an array of deleted items in a project
      public string GetDeletedItems(out string[,] DeletedItems, string ProjectPath)
      {  
       int Count;
       int DeletedCount;
       SourceSafeTypeLib.VSSItem VSS_Item;
        
       /// Initialize variables
       DeletedCount = 0;
       VSS_Item = VSS_Database.get_VSSItem(ProjectPath, false);
       DatabaseGetItemCount = DatabaseGetItemCount + 1;









       /// Retrieve the deleted items count
       foreach(SourceSafeTypeLib.VSSItem VSS_DeletedItem in VSS_Item.get_Items(true))
       {
        if (VSS_DeletedItem.Deleted == true)
        {
         DeletedCount = DeletedCount + 1;
        }
        GetItemDeletedCount = GetItemDeletedCount + 1;
       }
       DatabaseGetItemCountsCount = DatabaseGetItemCountsCount + 1;
       DeletedItems = new string[DeletedCount, 2];









       try
       {
        /// Populate the array
        Count = 0;
        foreach(SourceSafeTypeLib.VSSItem VSS_DeletedItem in VSS_Item.get_Items(true))
        {
         if (VSS_DeletedItem.Deleted == true)
         {
          DeletedItems[Count, 0] = VSS_DeletedItem.Name;
          GetItemNameCount = GetItemNameCount + 1;
          DeletedItems[Count, 1] = VSS_DeletedItem.Type.ToString();
          GetItemTypeCount = GetItemTypeCount+ 1;
          Count = Count + 1;
         }
         GetItemDeletedCount = GetItemDeletedCount + 1;
        }
        DatabaseGetItemCountsCount = DatabaseGetItemCountsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }




















       return "";
      }
     
      /// Returns the date of the tip version or the checkout
      public string GetFileDate(SourceSafeTypeLib.VSSItem VSS_File, ref string FileDate)
      {   
       try
       {
        /// File is checked out so return the checkout date
        if (VSS_File.Checkouts.Count != 0)
        {
         foreach (SourceSafeTypeLib.VSSCheckout VSS_CheckOut in VSS_File.Checkouts)
         {
          FileDate = VSS_CheckOut.Date.ToString();
          CheckOutDateCount = CheckOutDateCount + 1;
          break;
         }
         GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
        }
         /// File is not checked out so return the date of the tip version
        else
        {
         bool found = false;
         foreach (SourceSafeTypeLib.IVSSVersion VSS_Version in VSS_File.get_Versions(0))
         {
          if (!(found)) FileDate = VSS_Version.Date.ToString();
          CheckOutDateCount = CheckOutDateCount + 1;
          /// Why can't we put a break here?
          found = true;
         }
         GetItemVersionCountsCount = GetItemVersionCountsCount + 1;
        }
        GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
       }
































       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Retrieves history of an item
      public string GetHistory(out string[,] ItemData, string ItemPath, int Flags)
      {
       int Count = 0;
       SourceSafeTypeLib.VSSItem VSS_Item;
       VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
       DatabaseGetItemCount = DatabaseGetItemCount + 1;





       /// Get the version count
       foreach (SourceSafeTypeLib.IVSSVersion VSS_Version in VSS_Item.get_Versions(Flags))
       {
        Count = Count + 1;
       }
       GetItemVersionCountsCount = GetItemVersionCountsCount + 1;
       ItemData = new string[Count, 9];





       try
       {
        /// Populate the version data array
        Count = 0;
        foreach (SourceSafeTypeLib.IVSSVersion VSS_Version in VSS_Item.get_Versions(Flags))
        {
         ItemData[Count, 0] = VSS_Version.VersionNumber.ToString();
         VersionVersionCount = VersionVersionCount + 1;
         ItemData[Count, 1] = VSS_Version.Username;
         VersionUserNameCount = VersionUserNameCount + 1;
         ItemData[Count, 2] = VSS_Version.Date.ToString();
         VersionDateCount = VersionDateCount + 1;
         ItemData[Count, 3] = VSS_Version.Action;
         VersionActionCount = VersionActionCount + 1;
         ItemData[Count, 4] = VSS_Version.Label;
         VersionLabelCount = VersionLabelCount + 1;
         ItemData[Count, 5] = VSS_Version.LabelComment;
         VersionLabelCountCommentCount = VersionLabelCountCommentCount + 1;
         ItemData[Count, 6] = VSS_Version.VSSItem.Name;
         GetItemNameCount = GetItemNameCount + 1;
         ItemData[Count, 7] = VSS_Version.Comment;
         VersionCommentCount = VersionCommentCount + 1;
         ItemData[Count, 8] = VSS_Item.Spec;
         VersionSpecCount = VersionSpecCount + 1;
         Count = Count + 1;
        }
       }

























       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Gets an Item(s)
      public string GetItem(string ItemToGet, ref string GetPath, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;


       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemToGet, false);
        VSS_Item.Get(ref GetPath, Flags);
        GetItemCount = GetItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }

      /// Instantiates the latest version of a file or project item based on passed
      /// criteria
      public string GetLatestVersionInfo(out string[] ItemData, string ItemPath, int WhatToFind)
      {
       bool found = false;
       ItemData = new string[3];
       SourceSafeTypeLib.VSSItem VSS_Item;





       try
       {
        /// Instantiate the item
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;



        foreach (SourceSafeTypeLib.IVSSVersion VSS_Version in VSS_Item.get_Versions(0))
        {
         switch (WhatToFind)
         {
          case (int)Latest.Comment:
          {
           if (!(found))
           {
            if (VSS_Version.Comment.Length != 0)
            {
             found = true;
             ItemData[0] = VSS_Version.Comment;
             VersionCommentCount = VersionCommentCount + 1;
             ItemData[1] = VSS_Version.VersionNumber.ToString();
             VersionVersionCount = VersionVersionCount + 1;
             ItemData[2] = VSS_Version.Date.ToString();
             VersionDateCount = VersionDateCount + 1;
             /// Due to Whidbey Bug 8530 we can't simply break here,
             /// instead we need to complete the version iteration.
            }
           }
           break;
          }
          case (int)Latest.Label:
          {
           if (!(found))
           {
            if (VSS_Version.Label.Length != 0)
            {
             found = true;
             ItemData[0] = VSS_Version.Label;
             VersionLabelCount = VersionLabelCount + 1;
             ItemData[1] = VSS_Version.VersionNumber.ToString();
             VersionVersionCount = VersionVersionCount + 1;
             ItemData[2] = VSS_Version.Date.ToString();
             VersionDateCount = VersionDateCount + 1;
             /// Due to Whidbey Bug 8530 we can't simply break here,
             /// instead we need to complete the version iteration.
            }
           }
           break;
          }
          case (int)Latest.Date:
          {
           if (!(found))
           {
            ItemData[0] = VSS_Version.Date.ToString();
            VersionDateCount = VersionDateCount + 1;
            found = true;
            /// Due to Whidbey Bug 8530 we can't simply break here,
            /// instead we need to complete the version iteration.
           }
           break;
          }
          case (int)Latest.LabelComment:
          {
           if (!(found))
           {
            if (VSS_Version.LabelComment.Length != 0)
            {
             found = true;
             ItemData[0] = VSS_Version.LabelComment;
             VersionCommentCount = VersionCommentCount + 1;
             ItemData[1] = VSS_Version.VersionNumber.ToString();
             VersionVersionCount = VersionVersionCount + 1;
             ItemData[2] = VSS_Version.Date.ToString();
             VersionDateCount = VersionDateCount + 1;
             /// Due to Whidbey Bug 8530 we can't simply break here,
             /// instead we need to complete the version iteration.
            }
           }
           break;
          }
          case (int)Latest.VersionNumber:
          {
           if (!(found))
           {
            ItemData[0] = VSS_Item.VersionNumber.ToString();
            VersionVersionCount = VersionVersionCount + 1;
            found = true;
            /// Due to Whidbey Bug 8530 we can't simply break here,
            /// instead we need to complete the version iteration.
           }
           break;
          }
         }
        }
        GetItemVersionCountsCount = GetItemVersionCountsCount + 1;
       }























































































       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }
      
      /// Get the links data for a file
      public string GetLinksInfo(out string[] LinksData, string FilePath)
      {  
       int Count;
       int LinkCount;
       
       SourceSafeTypeLib.VSSItem VSS_Item;
       
       /// Initialize variables
       VSS_Item = VSS_Database.get_VSSItem(FilePath, false);
       DatabaseGetItemCount = DatabaseGetItemCount + 1;
       LinkCount = VSS_Item.Links.Count;
       LinksData = new string[LinkCount];













       try
       {
        Count = 0;
        foreach(SourceSafeTypeLib.VSSItem VSS_Link in VSS_Item.Links)
        {
         LinksData[Count] = VSS_Link.Parent.Spec;
         GetItemParentCount = GetItemParentCount + 1;
         Count = Count + 1;
        }
        GetItemLinksCount = GetItemLinksCount + 1;
       }









       catch(Exception e)
       {
        return e.ToString();
       }


       return "";
      }

      /// Returns the SRCSafe.ini path
      public string GetSrcSafeINIPath()
      {
       DatabaseGetSrcSafeINICount = DatabaseGetSrcSafeINICount + 1;
       return VSS_Database.SrcSafeIni;
      }




      /// Returns the User Count
      public int GetUserCount()
      {
       DatabaseUsersCount = DatabaseUsersCount + 1;   
       return VSS_Database.Users.Count;
      }




      /// Returns an array containing all user data
      public string GetUserData(out string[,] UserData)
      {
       /// Initialize variables
       int Count = 0;
       int UserCount = 0;
       UserCount = VSS_Database.Users.Count;
       DatabaseUsersCount = DatabaseUsersCount + 1;
       UserData = new string[UserCount, 2];
       try
       {
        /// Retrieve the database users
        foreach(SourceSafeTypeLib.VSSUser VSS_UserName in VSS_Database.Users)
        {
         UserData[Count, 0] = VSS_UserName.Name;
         UserGetNameCount = UserGetNameCount + 1;
         UserData[Count, 1] = VSS_UserName.ReadOnly.ToString();
         UserGetReadOnlyCount = UserGetReadOnlyCount + 1;
         Count = Count + 1;
        }
        DatabaseGetUserNamesCount = DatabaseGetUserNamesCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }
























       return "";
      }

      /// Returns the current User Name
      public string GetUserName(ref string UserName)
      {
       try
       {
        DatabaseUserNameCount = DatabaseUserNameCount + 1;
        UserName = VSS_Database.Username;
       }
       catch(Exception e)
       {
        return e.ToString();
       }










       return "";

      }

      /// Returns the user's Password
      public string GetUserPassword(ref string UsersPassword)
      {
       try
       {
        UsersPassword = CurrentPassword;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";

      }

      /// Returns user rights for a project
      public string GetUserRights(string ProjectPath, string UserName, ref int Rights)
      {
       SourceSafeTypeLib.VSSUser VSSUser;


       try
       {
        VSSUser = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        Rights = VSSUser.get_ProjectRights(ProjectPath);
        UserGetRightsCount = UserGetRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";
      }

      /// Gets a specific version of a file or project item by label
      public string GetVersionByLabel(string ItemPath, string Label, string LocalPath, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;
       SourceSafeTypeLib.VSSItem VSS_Version_Item;



       try
       {
        /// Instantiate the item
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;



        /// Get the Version
        VSS_Version_Item = VSS_Item.get_Version(Label);
        DatabaseGetVersionCount = DatabaseGetVersionCount + 1;
        VSS_Version_Item.Get(ref LocalPath, Flags);
        GetItemCount = GetItemCount + 1;



       }

       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Gets a specific version of a file or project item by version number
      public string GetVersionByVersionNumber(string ItemPath, int VersionNumber, string LocalPath, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;
       SourceSafeTypeLib.VSSItem VSS_Version_Item;



       try
       {
        /// Instantiate the item
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;



        /// Get the Version
        VSS_Version_Item = VSS_Item.get_Version(VersionNumber);
        DatabaseGetVersionCount = DatabaseGetVersionCount + 1;
        VSS_Version_Item.Get(ref LocalPath, Flags);
        GetItemCount = GetItemCount + 1;



       }

       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Returns the Working Folder of the passed Project or File
      public string GetWorkingFolder(string ProjectPath, ref string WorkingFolder, bool Deleted)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_Item;
       
       /// Instantiate the project
       try
       {
        if (Deleted == true)
        {
         return "";
        }
        else
        {
         VSS_Item = VSS_Database.get_VSSItem(ProjectPath, Deleted);
         DatabaseGetItemCount = DatabaseGetItemCount + 1;
         WorkingFolder =  VSS_Item.LocalSpec;
         SetItemCheckOutFolderCount = SetItemCheckOutFolderCount + 1;
         return "";
        }
       }




















       catch(Exception e)
       {
        return e.ToString();
       }
      }



      /// Returns an array of subprojects of the current project.
      public string HasSubProject(out string[,] Children, string ProjectPath, bool ItemIsDeleted, bool IncludeDeleted)
      {
       Children = new string[0,0];
       SourceSafeTypeLib.IVSSItems ChildCollection;
       SourceSafeTypeLib.VSSItem VSS_Item;




       try
       {
        /// Initialize variables
        int Count = 0;


        /// Instantiate the project
        VSS_Item = VSS_Database.get_VSSItem(ProjectPath, ItemIsDeleted);
        ChildCollection = VSS_Item.get_Items(IncludeDeleted);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;


        /// Get the subproject count
        foreach(SourceSafeTypeLib.VSSItem VSS_ChildItem in ChildCollection)
        {
         if (VSS_ChildItem.Type == (int)SourceSafeTypeLib.VSSItemType.VSSITEM_PROJECT)
         {
          Count++;
         }
         GetItemTypeCount = GetItemTypeCount + 1;
        }
        DatabaseGetItemCountsCount = DatabaseGetItemCountsCount + 1;








        Children = new string[Count, 2];
        Count = 0;

        foreach(SourceSafeTypeLib.VSSItem VSS_ChildItem in ChildCollection)
        {
         if (VSS_ChildItem.Type == (int)SourceSafeTypeLib.VSSItemType.VSSITEM_PROJECT)
         {
          Children[Count,0] = VSS_ChildItem.Name;
          GetItemNameCount = GetItemNameCount + 1;
          if ((VSS_ChildItem.Deleted == true) || (VSS_Item.Deleted == true ))
          {
           Children[Count,1] = "True";
          }
          else
          {
           Children[Count,1] = VSS_ChildItem.Deleted.ToString();
           GetItemDeletedCount = GetItemDeletedCount + 1;
          }
          GetItemDeletedCount = GetItemDeletedCount + 1;
          Count++;
         }
         GetItemTypeCount = GetItemTypeCount + 1;
        }
        DatabaseGetItemCountsCount = DatabaseGetItemCountsCount + 1;
       }




















       catch(Exception e)
       {
        
        return e.ToString();
       }



       return "";

      }

      /// Returns true if passed file is binary
      public string IsFileBinary(string FilePath, ref bool Binary)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_Item;
       
       /// Instantiate the file
       try
       {
        VSS_Item = VSS_Database.get_VSSItem(FilePath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        Binary =  VSS_Item.Binary;
        GetItemBinaryCount = GetItemBinaryCount + 1;
        return "";
       }













       catch(Exception e)
       {
        return e.ToString();
       }
      }



      /// Returns true if file is checked out
      public string IsFileCheckedOut(string FilePath, ref bool CheckOutState)
      {
       SourceSafeTypeLib.VSSItem VSS_FileItem;


       try
       {
        VSS_FileItem = VSS_Database.get_VSSItem(FilePath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        CheckOutState = (VSS_FileItem.IsCheckedOut != 0);
        GetItemIsCheckedOutCount = GetItemIsCheckedOutCount + 1;
       }





       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Indicates if File is Checked Out multiple
      public string IsFileCheckedOutMultiple(string FilePath, ref bool CheckedOutMultiple)
      {
       SourceSafeTypeLib.VSSItem VSS_FileItem;


       try
       {
        VSS_FileItem = VSS_Database.get_VSSItem(FilePath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        CheckedOutMultiple = (VSS_FileItem.Checkouts.Count > 1);
        GetItemCheckOutsCount = GetItemCheckOutsCount + 1;
       }





       catch(Exception e)
       {
        return e.ToString();
       }


       return "";

      }

      /// Returns if passed file is deleted
      public string IsItemDeleted(string FilePath, ref bool Deleted)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_Item;
       Deleted = false;




       /// Instantiate the file
       try
       {
        VSS_Item = VSS_Database.get_VSSItem(FilePath, true);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        Deleted =  (VSS_Item.Deleted == true);
        GetItemDeletedCount = GetItemDeletedCount + 1;
        return "";
       }







       catch(Exception e)
       {
        if (e.Message == "File or project not found")
        {
         return "";
        }
        return e.ToString();
       }
      }







      /// Returns true if passed file is shared
      public string IsItemShared(string FilePath, ref bool Shared)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_Item;
       
       /// Instantiate the project
       try
       {
        VSS_Item = VSS_Database.get_VSSItem(FilePath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        Shared =  (VSS_Item.Links.Count > 1);
        GetItemLinksCount = GetItemLinksCount + 1;
        return "";
       }













       catch(Exception e)
       {
        return e.ToString();
       }
      }
      
      /// Returns Read Only Status of user
      public string IsUserReadOnly(string UserName, ref bool ReadOnly)
      {
       SourceSafeTypeLib.VSSUser User;








       try
       {
        User = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        ReadOnly = User.ReadOnly;
        UserGetReadOnlyCount = UserGetReadOnlyCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";

      }

      /// Returns true if valid username is passed
      public string IsUserValid(string UserName, ref bool IsValidUser)
      {
       /// Initialize variables
       IsValidUser = false;
       
       /// Instantiate the user
       try
       {
        foreach (SourceSafeTypeLib.VSSUser VSS_User in VSS_Database.Users)
        {
         if (UserName.ToUpper() == VSS_User.Name.ToUpper())
         {
          IsValidUser = true;
          DatabaseGetUserCount = DatabaseGetUserCount + 1;
          break;
         }
         DatabaseGetUserNamesCount = DatabaseGetUserNamesCount + 1;
        }
        return "";
       }



















       catch(Exception e)
       {
        return e.ToString();
       }
      }



      /// Labels an item
      public string LabelItem(string ItemToLabel, string Label, string Comment)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;


       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemToLabel, false);
        VSS_Item.Label(Label, Comment);
        SetItemLabelCount = SetItemLabelCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }

      /// Moves a project
      public string MoveProject(string SourcePath, string TargetPath)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_SourceItem;
       SourceSafeTypeLib.VSSItem VSS_TargetItem;
       
       /// Instantiate the project
       try
       {
        VSS_SourceItem = VSS_Database.get_VSSItem(SourcePath, false);
        VSS_TargetItem = VSS_Database.get_VSSItem(TargetPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 2;
        VSS_SourceItem.Move(VSS_TargetItem);
        MoveItemCount = MoveItemCount + 1;
        return "";
       }
       
       catch(Exception e)
       {
        return e.ToString();
       }
      }





















      /// Opens a VSS Database
      public string OpenDB(string UserName, string PassWord, string Path)
      {
       VSS_Database = new SourceSafeTypeLib.VSSDatabase();


       try
       {
        VSS_Database.Open (Path, UserName, PassWord);
        CurrentPassword = PassWord;
        OpenMethodCount = OpenMethodCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";

      }
      
      /// Deletes or destroys an item
      public string RecoverItem(string ItemToRecover)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;




       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemToRecover, true);
        VSS_Item.Deleted = false;
        SetItemDeletedCount = SetItemDeletedCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }

      /// Removes all user rights for a project
      public string RemoveUserRights(string ProjectPath, string UserName)
      {
       SourceSafeTypeLib.VSSUser VSSUser;


       try
       {
        VSSUser = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        VSSUser.RemoveProjectRights(ProjectPath);
        UserRemoveRightsCount = UserRemoveRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";
      }

      /// Renames an item
      public string Rename(string ItemPath, string NewName)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_Item;
       
       /// Instantiate the project
       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        VSS_Item.Name = NewName;
        SetItemNameCount = SetItemNameCount + 1;
        return "";
       }
       
       catch(Exception e)
       {
        return e.ToString();
       }
      }
      
      /// Sets the current Project
      public string SetCurrentProject(string ProjectPath)
      {
       try
       {
        DatabaseSetCurrentProjectCount = DatabaseSetCurrentProjectCount + 1;
        VSS_Database.CurrentProject = ProjectPath;
       }
       catch(Exception e)
       {
        return e.ToString();
       }
































       return "";

      }
      
      /// Returns default user rights
      public string SetDefaultUserRights(int Rights)
      {
       try
       {
        VSS_Database.DefaultProjectRights = Rights;
        DatabaseSetDefaultRightsCount = DatabaseSetDefaultRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }












       return "";
      }

      /// Sets the file type of a VSS File
      public string SetFileType(string FilePath, bool Binary)
      {
       /// Initialize variables
       SourceSafeTypeLib.VSSItem VSS_Item;
       
       /// Instantiate the file
       try
       {
        VSS_Item = VSS_Database.get_VSSItem(FilePath, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        VSS_Item.Binary = Binary;
        SetItemTypeCount = SetItemTypeCount + 1;
        return "";
       }













       catch(Exception e)
       {
        return e.ToString();
       }
      }



      /// Sets the user rights for a project
      public string SetUserRights(string ProjectPath, string UserName, int Rights)
      {
       SourceSafeTypeLib.VSSUser VSSUser;


       try
       {
        VSSUser = VSS_Database.get_User(UserName);
        DatabaseGetUserCount = DatabaseGetUserCount + 1;
        VSSUser.set_ProjectRights(ProjectPath, Rights);
        UserSetRightsCount = UserSetRightsCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }









       return "";
      }

      /// Sets a Working Folder
      public string SetWorkingFolder(string ItemPath, string LocalFolder)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;


       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemPath, false);
        VSS_Item.LocalSpec = LocalFolder; 
        SetItemCheckOutFolderCount = SetItemCheckOutFolderCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }

      /// Shares an item
      public string ShareItem(string ShareTarget, string ItemToShare, string Comment, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;
       SourceSafeTypeLib.VSSItem VSS_ItemToShare;



       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ShareTarget, false);
        VSS_ItemToShare = VSS_Database.get_VSSItem(ItemToShare, false);
        DatabaseGetItemCount = DatabaseGetItemCount + 1;
        VSS_Item.Share(VSS_ItemToShare, Comment, Flags);
        ShareItemCount = ShareItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }










       return "";
      }

      /// UnCheck Out Item(s)
      public string UnCheckOutItem(string ItemToUnCheckOut, string UnCheckOutPath, int Flags)
      {
       SourceSafeTypeLib.VSSItem VSS_Item;


       try
       {
        VSS_Item = VSS_Database.get_VSSItem(ItemToUnCheckOut, false);
        VSS_Item.UndoCheckout(UnCheckOutPath, Flags);
        UnCheckOutItemCount = UnCheckOutItemCount + 1;
       }
       catch(Exception e)
       {
        return e.ToString();
       }








       return "";
      }
      
      /// Store the user's password
      private string UserPassword(string Password)
      {
       return CurrentPassword = Password;
      }
     }
    }










  • 3 years ago
    The chances of anyone looking through all that code are very small.  I'd suggest deleting all but the relevant parts.

  • 1 year ago

    [quote user="sivaraj"]

    HI

     

    i need a code for moving a file from one folder to another folder in visual source safe using .net code. it is very urgent to me.

    thanks in advance.

     

     

    [/quote]Presumably you would use this method.  You would have to navigate the database to get the two folders first.

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback