cancel
Showing results for 
Search instead for 
Did you mean: 

Class object can not be instantiated

Former Member
0 Kudos

Hello,

I am facing problem in instantiating Class object of SAPbobsCOM. The possible reasons I found on web is that the version of dll might be older which i am using for development than the actual application's version.

Code :

SAPbobsCOM.ActivityClass oAct = new SAPbobsCOM.ActivityClass();

Error :

“Retrieving the COM class factory for component with CLSID {5EC86D5B-840B-4676-8D5B-6154AD738D09} failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).”

Is there any other possibility for the error?

Best Regards,

Het Adhavryu

Accepted Solutions (1)

Accepted Solutions (1)

pedro_magueija
Active Contributor
0 Kudos

Hi Het,

B1 has factories for it's types. In the case of activities use the ActivitiesService.

ActivitiesService oActSrv = (ActivitiesService)oCmpSrv.GetBusinessService(ServiceTypes.ActivitiesService); 
Activity oAct = (Activity)oActSrv.GetDataInterface(ActivitiesServiceDataInterfaces.asActivity);
ActivityParams oParams;
oAct.CardCode = "C001";                
oAct.ContactDate = DateTime.Parse("15/01/2010");
oAct.Activity = BoActivities.cn_Conversation;
oAct.Notes = "Discuss next year's financial plan";
oParams = oActSrv.AddActivity(oAct);
long singleActCode = oParams.ActivityCode;

The sample above is from the SDK Help Center.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

Thanks for the reply. I tried your solution but the result is same.

This time the error generated on instantiating CompanyService object.

CompanyService oCompserv = new CompanyService();

Best Regards,

Het Adhavryu

Former Member
0 Kudos

Found the solution

I was directly instantiating the object. It was the problem.

CompanyService oCompserv = oCompany.GetCompanyService();

solve the problem.

Thanks Ad Kerremans and Pedro Magueija for replies.

Best Regards,

Het Adhavryu

pedro_magueija
Active Contributor
0 Kudos

Hi Het,

Great . Please close the thread whenever you can.

Thanks.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Answers (1)

Answers (1)

AdKerremans
Active Contributor
0 Kudos

Hi Het,

you should use getBusinessObject to do this.

Kind regards

Ad