4 Replies Latest reply on Feb 29, 2012 3:34 PM by Wayne Matus

    Can dispatch copy the SW Part card into another folder?

    Ty Toney

      I'm looking to automate my new project creation as much as I can. I'm just starting to learn C# so that I can get into API, I'm trying to figure a dispatch solution in the meantime. Is dispatch able to copy a file card template into another folder? I have a folder based numbering system that requires a file card template in each folder where parts and assemblies are placed. What I'd like is to have it that when a new project is created that a copy of the SW Part and Assy file card templates are placed into each of the sub project folders. What I'm planning to use as a trigger is when a .mpp file is added to the vault. What is daunting me is the file paths in the copy function. If I direct it to the appropriate file card template in the source line, how do I direct it to the folders of the new project? If I use the funtion 'filepathtoselectedfile' is that going to use the file path to the source file card template or the .mpp file?

        • Re: Can dispatch copy the SW Part card into another folder?
          Joy Garon

          Hello Ty,

           

          Unfortunately the answer is no.

          This is an enhancement request I often hear (Template definition: allow file data card to be placed into specified folder)

          Please feel free to report this as an enhancement request.

           

          I'd be interested from hearing from any admin out there (Lou, Wayne, Jeff, etc) who may have found a way to do this

           

          Regards,

          Joy

            • Re: Can dispatch copy the SW Part card into another folder?
              Ty Toney

              Joy,

              Is this something that could be accomplished with API? I created a numbering scheme that works for my company, unfortunately it also creates a lot of administration in creating a new project. We only have one or two project a year, but all the manual additions allows for mistakes.

              Thanks,

              Ty

                • Re: Can dispatch copy the SW Part card into another folder?
                  Joy Garon

                  Hi Ty,

                   

                  I'm not a programmer so, I think I'll defer to the programmers in the group on that one

                  I'm pretty sure that you would have to use the API to create the folders and abandon creation through templates.

                   

                  Report it to your VAR and have him add you to SPR 370141 (data card support in a template).

                   

                  Regards,

                  Joy

                  • Re: Can dispatch copy the SW Part card into another folder?
                    Wayne Matus

                    I have not tried it, but there is a sample vb6 sub in the API help file.

                     

                    Sample Code (Visual Basic)

                    This routine creates a new sub-folder in a certain folder and applies read and check out rights for the user called "Smith". It will also assign full privileges to the members of the group "Administrators". Finally it will copy the card definition of the DOC card from the folder "Samples" and use it for the extensions DOC and XLS in the new folder:

                     

                    Private Sub CreateFolder(parentFolder As IEdmFolder5, folderName As String)
                    On Error GoTo ErrHand

                      Dim usrMgr As IEdmUserMgr5
                      Set usrMgr = parentFolder.vault

                      Dim data As EdmFolderData
                      Set data = New EdmFolderData

                      data.SetUserRights usrMgr.GetUser("Smith").ID, EdmRight_Read Or EdmRight_Lock
                      data.SetGroupRights usrMgr.GetUserGroup("Administrators").ID, EdmRight_All

                      Dim card As IEdmCard5
                      Set card = parentFolder.vault.RootFolder.GetSubFolder("Samples").GetCard("doc")
                    data.SetCardSource card.ID, "doc;xls"

                      Dim folder As IEdmFolder5
                    Set folder = parentFolder.AddFolder(Me.hWnd, folderName, data)
                      MsgBox "Created folder " + folderName + " successfully. It was given the ID " + str(folder.ID)
                      Exit Sub

                    ErrHand:
                      Dim ename As String
                      Dim edesc As String
                      parentFolder.vault.GetErrorString Err.Number, ename, edesc
                      MsgBox ename + vbLf + edesc
                    End Sub