Я пытаюсь создать настраиваемый соединитель данных для Power BI на основе этого учебного пособия по ms docs с использованием Visual Studio Community 2019 с Power Query SDK V1.0.0.25. Однако, когда я пытаюсь запустить fike запроса проекта в Visual Studio, я получаю сообщение о том, что "The name MyProjectName.Contents()"
не может быть найдено в текущем контексте ...
Я искал Power Query Spe c для решения без решения. Любая помощь будет принята с благодарностью.
MyProjectName.query.pq
let
result = ProjectName.Contents()
in
result
MyProjectName.pq
// This file contains your Data Connector logic
section MyProjectName;
oktaEndpoint="XXX";
oktaServerId="XXX";
oktaClientId= "XXX";
redirect_uri = "https://oauth.powerbi.com/views/oauthredirect.html" ;
windowHeight = "600";
windowWidth = "1000";
[DataSource.Kind="MyProjectName", Publish="MyProjectName.Publish"]
shared MyProjectName.Contents = (optional message as text) =>
let
_message = if (message <> null) then message else "(no message)",
a = "Hello from MyProjectName: " & _message
in
a;
StartLogin = (resourceUrl, state, display) =>
let
authorizeUrl = Text.Format(
"#[oktaEndpoint]/oauth2/#[oktaServerId]/v1/authorize?", [oktaEndpoint = oktaEndpoint, oktaServerId = oktaServerId]) &
Uri.BuildQueryString([
response_type = "code",
scope = "openid",
client_id = oktaClientId,
redirect_uri = redirect_uri,
state = state
])
in
[
LoginUri = authorizeUrl,
CallbackUri = redirect_uri,
WindowHeight = windowHeight,
WindowWidth = windowWidth,
Context = null
];
FinishLogin = [];
// Data Source Kind description
MyProjectName= [
Authentication = [
// Key = [],
// UsernamePassword = [],
// Windows = [],
//Implicit = [],
OAuth = [
StartLogin = StartLogin,
FinishLogin = FinishLogin
// Refresh = Refresh,
// Logout = Logout
]
],
Label = Extension.LoadString("DataSourceLabel")
];
// Data Source UI publishing description
MyProjectName.Publish = [
Beta = true,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://powerbi.microsoft.com/",
SourceImage = MyProjectName.Icons,
SourceTypeImage = MyProjectName.Icons
];
MyProjectName.Icons = [
Icon16 = { Extension.Contents("MyProjectName16.png"), Extension.Contents("MyProjectName20.png"), Extension.Contents("MyProjectName24.png"), Extension.Contents("MyProjectName32.png") },
Icon32 = { Extension.Contents("MyProjectName32.png"), Extension.Contents("MyProjectName40.png"), Extension.Contents("MyProjectName48.png"), Extension.Contents("MyProjectName64.png") }
];