Hide Table of Contents

This topic describes how to create a C# stand-alone application that logs into a SOLIDWORKS PDM Professional file vault and lists the files in the root folder.

  1. Start up Microsoft Visual Studio.

  2. Click File > New > Project > Visual C# > Windows Forms App (.NET Framework).

    1. Type StandaloneApplicationCSharp in Name.

    2. Click Browse and navigate to the folder where to create the project.

    3. Click OK.

    4. Right-click the name of your project in the Solution Explorer and select Add Reference to add the SOLIDWORKS PDM Professional primary assembly interop to your project.

      1. Browse to the top folder of your SOLIDWORKS PDM Professional installation.
      2. Locate and click EPDM.Interop.epdm.dll.
      3. Click Open.
      4. Click Add.
      5. Click Close.
  3. Change the version of the .NET Framework and the platform target.

    1. Click Project > StandaloneApplicationCSharp Properties > Build and set Platform target to Any CPU.
    2. Click Application and keep suggested Target framework or change it to .NET Framework 4.5 (or later).
    3. De-select Prefer 32-bit.
    4. Click Yes.
  4. Right-click Form1.cs in the Solution Explorer and click View Designer.

  5. Click View > Toolbox.

  6. Drag a button from the Toolbox onto the form.

  7. Double-click the button to open Form1.cs and replace all of the code in the code window with the following code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;
namespace StandaloneApplicationCSharp
    public partial class Form1 : Form
        public Form1()
        private void button1_Click(System.Object sender, System.EventArgs e)
                //Create a file vault interface and log into a vault
                IEdmVault5 vault = new EdmVault5();
                //Get the vault's root folder interface
                string message = "";
                IEdmFile5 file = null;
                IEdmFolder5 folder = null;
                folder = vault.RootFolder;
                //Get position of first file in the root folder
                IEdmPos5 pos = null;
                pos = folder.GetFirstFilePosition();
                if (pos.IsNull)
                    message = ("The root folder of your vault does not contain any files.");
                message = ("The root folder of your vault contains these files: " + "\n");
                while (!pos.IsNull)
                    file = folder.GetNextFile(pos);
                    message = message + file.Name + "\n";
                //Show the names of all files in the root folder
            catch (System.Runtime.InteropServices.COMException ex)
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            catch (Exception ex)
  1. Replace MyVaultName in the code with the name of a SOLIDWORKS PDM Professional vault on your computer.

  2. Click Debug > Start Debugging or press F5.

    1. Click Button1 on the form.

      A message box is displayed that either contains the names of the files in the root folder of the specified vault or informs you that the root folder of the specified vault does not contain any files.

    2. Close the form.

  3. Click File > Save All.

 See Also

Stand-alone Applications (VB.NET)

Stand-alone Applications (C++)

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   Stand-alone Applications (C#)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2024 SP02

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.