title: Referencing the Shared Context in Power Query SDK
body: <p>Im attempting to build a custom data connector for Power BI based on this <a href="https://docs.microsoft.com/en-us/power-query/startingtodevelopcustomconnectors" rel="nofollow noreferrer">ms docs connectors tutorial</a> using Visual Studio Community 2019 with Power Query SDK V1.0.0.25. However, when I attempt to run the project query fike in Visual Studio I receive an error stating 
  <code>"The name MyProjectName.Contents()"</code> cannot be found in the current context...</p>
  
  <p>I've searched the <a href="https://docs.microsoft.com/en-us/powerquery-m/power-query-m-language-specification" rel="nofollow noreferrer">Power Query Spec</a> for a solution with no resolve yet. Any help would be greatly appreciated.</p>
  
  <h2><strong>MyProjectName.query.pq</strong></h2>
  
  <pre><code>let
      result = ProjectName.Contents()
  
  in
      result  
  </code></pre>
  
  <h2><strong>MyProjectName.pq</strong></h2>
  
  <pre><code>// 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) =&gt;
      let
          _message = if (message &lt;&gt; null) then message else "(no message)",
          a = "Hello from MyProjectName: " &amp; _message
      in
          a;
  
  StartLogin = (resourceUrl, state, display) =&gt;
  let
      authorizeUrl = Text.Format(
      "#[oktaEndpoint]/oauth2/#[oktaServerId]/v1/authorize?", [oktaEndpoint = oktaEndpoint, oktaServerId = oktaServerId]) &amp; 
      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") }
  ];
  
  </code></pre>