M-Files / Samples.CustomExternalObjectTypeDataSources

Example implementations of M-Files External Object Type Data Sources.
https://developer.m-files.com/Built-In/External-Object-Type-Data-Source/Custom/
MIT License
2 stars 3 forks source link

Connecting we web API Sample #1

Closed itahirikba closed 2 years ago

itahirikba commented 2 years ago

hello,

I do not see how to connect to web api in this sample. For a customer project, we need to connect to a ODATA API with a static token. Where should I do this ? In this example, everything seem to be around a connection string. (DataSource.cs)

Many thanks for your help. BR ISA

itahirikba commented 2 years ago

In your documentation : https://developer.m-files.com/Built-In/External-Object-Type-Data-Source/Custom/

This method is passed the string entered into the “OLE DB connection string” box on the “Connection to External Database” tab of the Object Type Properties. You can use this to pass custom information into your class to allow you to connect to a remote resource, such as web service address or authentication credentials.

Not sure of what it means. Does that mean that I need to pass my auth parameters in the in the first paramter ConnectionString of the method "OpenConnection" ? Or is there any other signature of the method "OpenConnection" ?

Do you have a API documentation of these classe ?

CraigHawker commented 2 years ago

Hi,

Please do not open issues for support. If you would like assistance then feel free to reach out to your reseller (or, if you work for a reseller, your Channel Account Manager). Alternatively, please do also post questions on the M-Files Community (https://community.m-files.com).

In regards to your specific question, though...

You would typically include credentials - in this context, your access token - in the "connection string" that is entered in the "Object Type Properties" screen shown here: https://developer.m-files.com/Built-In/External-Object-Type-Data-Source/Custom/#using-idatasource. This would then be passed into your implementation of IDataSource.OpenConnection, as you can see in the sample here. In the case of the example we then use a helper method to extract various data from the connection string and populate the in-memory settings object.

If you need access to this information from within your other objects then you would need to ensure that you pass the credentials into those objects as they are used/created. The sample does this by passing a reference to the DataSource into the DataConnection when it is created, and then using it when it needs to read settings (such as the type provided in the connection string).

Regards,

Craig.

itahirikba commented 2 years ago

Hi,

Really sorry the late answer. It seems that the notifications did not come to my inbox somehow. Thank you very much for your answer.

I'm working with a M-Files reseller. They actually asked me to implement this solution for them. I will try to play a bit with your solution and hope to make it work.

Regards, Isa

itahirikba commented 2 years ago

One last question. InstallShield Lite has been discontinued. (see Announcement link)

Do you have any tips for an alternative ? (Clickonce or manually copying the dll and exe files somewhere) I think this is also useful to update the doc page.

Thank you very much.

CraigHawker commented 2 years ago

You can use any technology that creates the required registry keys as defined in the documentation.

We have just launched beta versions of our IML-based External Object Type Data Source Connectors. The template for these is in the latest Visual Studio Template Package. Applications created this way are installed into the vault and do not need to be explicitly installed/registered on the server.

We will be updating our documentation and examples over the coming few months.

I would again suggest that issues are not the correct way for you to obtain support. Please request it via your Channel Account Manager or reseller.

itahirikba commented 2 years ago

Thanks for the answer. We also opened a ticket via the reseller for more info on the beta "IML-Based External Object Type Data Connectors" and the deployment.

Thanks for your help BR ISA