Skip to content

Commit eaf6f6c

Browse files
committed
Version 1.1
2 parents 91a23f8 + ca3bbd4 commit eaf6f6c

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

Client/Client.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<Compile Include="Credential.cs" />
6060
<Compile Include="CredentialFolder.cs" />
6161
<Compile Include="CredentialSQL.cs" />
62+
<Compile Include="CredentialOData.cs" />
6263
<Compile Include="CredentialWeb.cs" />
6364
<Compile Include="CredentialFile.cs" />
6465
<Compile Include="Credentials.cs" />

Client/Credential.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ namespace PowerQueryNet.Client
1919
[KnownType(typeof(CredentialWeb))]
2020
[XmlInclude(typeof(CredentialSQL))]
2121
[KnownType(typeof(CredentialSQL))]
22+
[XmlInclude(typeof(CredentialOData))]
23+
[KnownType(typeof(CredentialOData))]
2224
public abstract class Credential
2325
{
2426

Client/CredentialOData.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace PowerQueryNet.Client
8+
{
9+
/// <summary>
10+
/// Credential to access an OData resource from the Power Query (M) formulas.
11+
/// </summary>
12+
public class CredentialOData : Credential
13+
{
14+
/// <summary>
15+
/// URL address of the resource
16+
/// </summary>
17+
public string Url { get; set; }
18+
}
19+
}

Engine/CommandCredentials.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ public void SetCredentialSQL(string sql, string userName, string password)
6464

6565
return;
6666
}
67-
67+
68+
public void SetCredentialOData(string url)
69+
{
70+
DataSource dataSource = new DataSource("OData", url);
71+
DataSourceSetting dataSourceSetting = new DataSourceSetting("Anonymous");
72+
73+
CredentialStore.SetCredential(dataSource, dataSourceSetting, null);
74+
75+
return;
76+
}
77+
6878
public bool LoadCredentials(string fileName)
6979
{
7080
try

0 commit comments

Comments
 (0)