ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
AHAndrew Harkins15/09/2020

Hello all,

I have a C# program winform/WPF and I can successfully log into my vault. I can get all of my files in the whole vault in my listview. Now I want to put only the files in a certain directory. My vault is setup like so:

Vault1 -> (multiple county folder names) US, DE, IN, Global -> PDF, Docx, DXF.

I would like only the files in the path Vault1->US->PDF

When I try to edit IEdmFolder5.LocalPath to the correct directory it will not cuz its ‘Read-Only’

I am new with this API so I don’t fully understand what each number behind the type of object means.

IEdmVault5 vault5 = new EdmVault5();;

private void btnLogin_Click(object sender, RoutedEventArgs e)

        {

            try

            {

                if (!vault5.IsLoggedIn)

                {

                    vault5.Login("loginName", "loginPass", "Vault1");

                }

                TraverseGlobalVault(vault5.RootFolder);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

private void TraverseGlobalVault(IEdmFolder5 folder)

        {

            string lvlTwo = "PDF";

            string lvlOne = "Global";

            try

            {

                //folder.LocalPath = @"C:\\Vault1\" + lvlOne + "\" + lvlTwo;

                //enumerate the files in the folder

                IEdmPos5 filePos = default(IEdmPos5);

                filePos = folder.GetFirstFilePosition();

 

                IEdmFile5 file = default(IEdmFile5);

                while (!filePos.IsNull)

                {

                    file = folder.GetNextFile(filePos);

                    lstFiles.Items.Add(file.Name);

                }

 

                //Enumerate the sub-folders

                IEdmPos5 folderPos = default(IEdmPos5);

                folderPos = folder.GetFirstSubFolderPosition();

                while (!folderPos.IsNull)

                {

                    // MessageBox.Show(folderPos.ToString());

                    //IEdmFolder5 folder5 = (IEdmFolder5) folderPos;

                    MessageBox.Show(folder.LocalPath);

                    //if (folderPos.Equals(@"C:\\Vault1\" + lvlOne + @"\" + lvlTwo))

                    //{                   

                    //    IEdmFolder5 subFolder = default(IEdmFolder5);

                    //    subFolder = folder.GetNextSubFolder(folderPos);

                    //    TraverseVault(subFolder);

                    //}

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }