Forum Discussion

KrisKegel's avatar
KrisKegel
Frequent Visitor
6 years ago

Reading files from custom data connector

Hi,

 

I can't find any Custom Data Connector examples on how to use File.Contents and when I try to use File.Contens it tells me that credentials are required. Do anyone know if it is possible to use File.Contents from a Custom Data Connector?

 

My code:

[DataSource.Kind="BPXDataConnector", Publish="BPXDataConnector.Publish"]
shared BPXDataConnector.Contents = (optional message as text) =>
let

source = Lines.FromBinary(File.Contents("C:\Documents\code.txt"), null, null, 1252)

in
source;

// Data Source Kind description
BPXDataConnector = [
Authentication = [
Anonymous = []

],
Label = Extension.LoadString("DataSourceLabel")
];

 

Thanks and best regards

Kris

4 Replies

  • Even though it sounds silly that a local source would require authentication i think that's just a manifestation of the general usage paradigm for custom connectors. They are supposed to live both on the desktop and on the gateways. And there authentication is a required part of the process.

    • KrisKegel's avatar
      KrisKegel
      Frequent Visitor

      Thanks for the quick response. Do you have some hint on which authorization should be added? I tried 

       

      UsernamePassword = [], Windows = [], Implicit = []

       

      Thanks and the best regards

      Kris

       

      • lbendlin's avatar
        lbendlin
        Super User

        if you specify user name and password in the URL (I hope you are aware that these are transmitted in clear text) then you need to use anonymous authentication in the connector, or specify username and password and then select "Skip Test Connection"

  • hassanemam's avatar
    hassanemam
    Regular Visitor

    Have you managed to read files as I am facing the same issue and I was wondeying whether you have managed to get it working