Error in contact integration by the api

1

I updated the spring to the latest version and started to have an error in the integration of customer contacts, so I analyzed the problem should be in dependency, error:

  

Can not bind COM object of type 'System .__ ComObject' to   Interop.CrmBE900.CrmBELinhaContactoEntidade 'interface type. It is   operation failed because the QueryInterface call on the COM component to   the interface with the IID '{26A25BB5-A85E-47FF-B604-A87C9E7CB9D5}' failed   with the following error: This interface is not supported (Exception from   HRESULT: 0x80004002 (E_NOINTERFACE)).

I have already imported all the dlls and compiled, but continue with this problem in the integration of contacts. The error is thrown when I instantiate the linecontact:

LinhaContacto = new Interop.CrmBE900.CrmBELinhaContactoEntidade();

Dlls I'm referencing in the whole project:

  

Interop.CrmBE900   
Interop.ErpBS900   
Interop.ErpDS900   
Interop.GcpBE900   
Interop.ICrmBS900   
Interop.IGcpBS900   
Interop.IStpBS900   
Interop.StdBE900   
Interop.StdBSSql900   
Interop.StdDS900   
Interop.StpBE900   
Interop.StdBE900

Missing me some dll?

    
asked by anonymous 25.05.2018 / 18:32

2 answers

0

This particular error is related to the interop used (Interop.CrmBE), which we could (internally) realize was caused by adding a new property to the class and some < in> builds caused compilation problems. The latest version of the DLL will certainly solve the problem.

As noted earlier, external developments should always have references "pointed" to ERP's ... \ CommonFiles (manually adding references to the project, or using the code provided above), making sure that the latest versions of interops .

    
29.05.2018 / 16:01
1

The error is not related to the references you have in the project, but to the versions you are using. Confirm that you have the settings suggested in the image below for all SPRING INTEROPS.

Another thing you can do is ensure that all the assemblies in your project are loaded from the c: .. \ Common Files \ Spring folder. Note that this code should be the 1 thing to be evoked.

  static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        //Este handler tem que ser adicionado antes de existir qualquer referência para classes existentes nos Interop's,
        //isto é, no método Main() da aplicação NÃO PODERÁ EXISTIR DECLARAÇÕES DE VARIÁVEIS DE TIPOS EXISTENTES NOS INTEROPS.
        //Com este método, na pasta da aplicação não deverão existir os Interops e as referências para os mesmos deverão ser
        //adicionadas com Copy Local = False e Specific Version = false.
        AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

        Application.Run(new Form1());
    }

/// <summary>
    /// Método para resolução das assemblies.
    /// </summary>
    /// <param name="sender">Application</param>
    /// <param name="args">Resolving Assembly Name</param>
    /// <returns>Assembly</returns>
    static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
        string assemblyFullName;

        System.Reflection.AssemblyName assemblyName;

        const string PRIMAVERA_COMMON_FILES_FOLDER = "PRIMAVERA\SG900"; 

        assemblyName = new System.Reflection.AssemblyName(args.Name);
        assemblyFullName = System.IO.Path.Combine(System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86), PRIMAVERA_COMMON_FILES_FOLDER), assemblyName.Name + ".dll");

        if (System.IO.File.Exists(assemblyFullName))
            return System.Reflection.Assembly.LoadFile(assemblyFullName);
        else
            return null;
    }

    
25.05.2018 / 22:40