Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Trying to create a pretty simple custom connector for Power BI. .pq code is listed below and I have attached the .mez file. The idea for the connector is to connect to a folder and pull back all of the files in the folder (CSV files) and allow you to choose which files you want and each becomes its own query. The current problem I have is that my Windows credentials are not associating with my selected folder. So, when I use the connector the following happens:
1. Prompts me for a folder path
2. Prompts me for credentials
3. Errors and tells me I need to provide credentials or "Please specifyhow to connect"
I'm sure it's something silly and easy but I can't figure it out.
// This file contains your Data Connector logic
[Version = "1.0.0"]
section TDGTPQM_FolderFile;
TDGTPQM_FolderFile.GetFile = ( filePath as text) as table =>
let
output = Csv.Document(File.Contents(filePath),[Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.None])
in
output;
[DataSource.Kind="TDGTPQM_FolderFile", Publish="TDGTPQM_FolderFile.Publish"]
shared TDGTPQM_FolderFile.Contents = ( folder as text ) =>
let
//Credential = Extension.CurrentCredential(),
files =
Table.DuplicateColumn(
Table.CombineColumns(
Table.SelectColumns(
Folder.Contents( folder ),
{ "Name", "Folder Path"}
),
{ "Folder Path", "Name" },
Combiner.CombineTextByDelimiter("", QuoteStyle.None),
"Name"
),
"Name",
"Key"
),
addDataColumn = Table.AddColumn( files, "Data", each TDGTPQM_FolderFile.GetFile([Key])),
addItemKindColumn = Table.AddColumn( addDataColumn, "ItemKind", each "Table"),
addItemNameColumn = Table.AddColumn( addItemKindColumn, "ItemName", each "Table"),
addIsLeafColumn = Table.AddColumn( addItemNameColumn, "IsLeaf", each true),
Navigation = Table.ToNavigationTable( addIsLeafColumn, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
Navigation;
// Data Source Kind description
TDGTPQM_FolderFile = [
TestConnection = ( dataSourcePath ) => { "TDGTPQM_FolderFile.Contents" },
Authentication = [
// Key = [],
//UsernamePassword = [],
Windows = [ SupportsAlternateCredentials = true ]
//Anonymous = []
]
];
// Data Source UI publishing description
TDGTPQM_FolderFile.Publish = [
Beta = true,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://powerbi.microsoft.com/",
SourceImage = TDGTPQM_FolderFile.Icons,
SourceTypeImage = TDGTPQM_FolderFile.Icons
];
TDGTPQM_FolderFile.Icons = [
Icon16 = { Extension.Contents("TDGTPQM_FolderFile16.png"), Extension.Contents("TDGTPQM_FolderFile20.png"), Extension.Contents("TDGTPQM_FolderFile24.png"), Extension.Contents("TDGTPQM_FolderFile32.png") },
Icon32 = { Extension.Contents("TDGTPQM_FolderFile32.png"), Extension.Contents("TDGTPQM_FolderFile40.png"), Extension.Contents("TDGTPQM_FolderFile48.png"), Extension.Contents("TDGTPQM_FolderFile64.png") }
];
Table.ToNavigationTable = (
table as table,
keyColumns as list,
nameColumn as text,
dataColumn as text,
itemKindColumn as text,
itemNameColumn as text,
isLeafColumn as text
) as table =>
let
tableType = Value.Type(table),
newTableType = Type.AddTableKey(tableType, keyColumns, true) meta
[
NavigationTable.NameColumn = nameColumn,
NavigationTable.DataColumn = dataColumn,
NavigationTable.ItemKindColumn = itemKindColumn,
Preview.DelayColumn = itemNameColumn,
NavigationTable.IsLeafColumn = isLeafColumn
],
navigationTable = Value.ReplaceType(table, newTableType)
in
navigationTable;
Hi @Greg_Deckler ,
Could you please try the following steps and check if can solve your problem?
Best Regards
@v-yiruan-msft Thanks but did not work. My fear is that Folder.Contents is not supported: Custom connector for proprietary file type - Microsoft Fabric Community
User | Count |
---|---|
18 | |
5 | |
2 | |
1 | |
1 |
User | Count |
---|---|
23 | |
4 | |
3 | |
2 | |
1 |