2 Replies Latest reply on Jul 30, 2015 11:41 AM by Lee CS Young

    iedmfile6 from string

    Jeff Gallo

      I am trying to create a program that is going to take a group of files from my local or somewhere else on my network (not in the vault) and move them into the vault.

      I am having trouble getting the file to become the iedmfile6 format from a string.

       

      What i am trying to do is use Getfilefrompath.

      in the below code what i am trying to do to make it work is use the windows based move to move the files into the vault and then convert to a iedmfile6 and move them to there final destination.

       

      That is the general gist of what i want to do but i know i have something not wanting to work..

       

      Thanks,

       

      Private Sub Move_Ok_Click(sender As Object, e As EventArgs) Handles Move_Ok.Click

              Dim File_Name As String

              Dim Name_File As String

              Dim Create_Date As Date

              Dim New_Name As String

              Dim File_Dest As String

              Dim File_Ext As String

              Dim vault2 As IEdmVault7 = Nothing

              If vault1 Is Nothing Then

                  vault1 = New EdmVault5()

              End If

              vault2 = DirectCast(vault1, IEdmVault7)

              If Not vault1.IsLoggedIn Then

                  vault1.LoginAuto(Pick_Vault.Text, Me.Handle.ToInt32)

              End If

              Dim afile As IEdmFile6

              Dim folder As IEdmFolder6

              folder = vault2.RootFolder

              Dim Files() As EdmAddFileInfo

              ReDim Files(Input_File.Items.Count - 1)

              Dim Index As Integer = 0

              Dim Dest As IEdmFolder5 = Nothing

              Dest = vault2.GetFolderFromPath(Destination.Text)

              For Each File_Name In Input_File.Items

                  Files(Index).mbsPath = File_Name

                  Files(Index).mlEdmAddFlags = EdmAddFlag.EdmAdd_Simple

                  Files(Index).mlFileID = 0

                  Files(Index).mlSrcDocumentID = 0

                  Files(Index).mlSrcProjectID = 0

                  Files(Index).mbsNewName = ""

       

                  File_Ext = System.IO.Path.GetExtension(File_Name)

                  Name_File = System.IO.Path.GetFileName(File_Name)

                  Create_Date = System.IO.File.GetCreationTime(File_Name)

       

       

                  New_Name = Create_Date.ToString("MM.dd.yy_hhmmss")

                  File_Dest = Destination.Text & "\" & New_Name & File_Ext

                  My.Computer.FileSystem.MoveFile(File_Name, File_Dest)

                  Stop

       

                  afile = vault2.GetFileFromPath(File_Dest)

                  afile.Move(Me.Handle.ToInt32(), folder.ID, Dest.ID, 0)

                  afile.RenameEx(Me.Handle.ToInt32(), New_Name, 0)

       

       

       

                  'MsgBox(Name_File & "  " & File_Ext & "  " & New_Name)

       

              Next

       

       

       

       

              LBL_Done.Visible = True

          End Sub