Solidworks PDM API connect .Net

Hello all,

I am a Programmer at my company, I am currently in charge of creating a Program that connects to the Solidworks PDM.

I am simply just trying to connect to the Solidworks PDM through the API.

Following the directions on help.solidworks.com I took the 2 dll files that are in the installation folder.

EPDM.Interop.epdm.dll and EPDM.Interop.EPDMResultCode.dll

I have my own credentials to connect to the Solidworks PDM. When I use these credentials in my code I get the error: “Error: Retrieving the COM class factory for component with CLSID {9FF1D873-77F2-4743-99BA-6A5B8A361275} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). “ After reading about this error I have tried changing the Build Platform targer to “Any CPU, x86, and x64” I also have tried using the 32 bit dlls and the 64 bit dlls to match accordingly. I don’t actually have solidworks installed on my machine but I took the dlls out of the install folder. The program I am creating is just supposed to connect to the PDM and copy files. Solidworks should not be needed on the machine to do this, just access to the PDM. Here is my API code.

I have a C# winform or WPF app just trying to connect to the PDM.

        private void btnLogin_Click(object sender, RoutedEventArgs e)

        {

            try

            {

                IEdmVault5 vault = new EdmVault5();

 

                //#1

                if (vault == null)

                {

                    vault = new EdmVault5();

                }

 

                if (!vault.IsLoggedIn)

                {

                    vault.Login("pdmusername", "pdmpassword", "vaultnameORip");

                    lbltest.Content = "Possible Success!?!";

                }

 

                ///#2

                vault.LoginAuto("vaultnameORip", 0);

 

                string vaultName = null;

                string message = "";

 

                IEdmFile5 file = null;

                IEdmFolder5 folder = null;

                folder = vault.RootFolder;

 

                IEdmPos5 position = null;

                position = folder.GetFirstFilePosition();

 

                if (position.IsNull)

                {

                    message = "Contains none";

                    lbltest.Content = message;

                    return;

                }

 

                message = "Contains true";

                while (!position.IsNull)

                {

                    file = folder.GetNextFile(position);

                    lstFiles.Items.Add(file.Name);

 

                }

                //vaultName = vault.Name;

                //lbltest.Content = vaultName;

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

SolidworksApi/macros