|
1 | 1 | using Microsoft.AspNetCore.Http;
|
2 | 2 | using Microsoft.AspNetCore.Mvc;
|
| 3 | +using Microsoft.Azure.Functions.Worker; |
3 | 4 | using Microsoft.Azure.WebJobs;
|
4 |
| -using Microsoft.Azure.WebJobs.Extensions.Http; |
5 | 5 | using Microsoft.Extensions.Logging;
|
6 | 6 | using Microsoft.Extensions.Options;
|
7 | 7 | using Microsoft.Graph;
|
8 | 8 | using Microsoft.Graph.Models;
|
9 | 9 | using System.Collections.Generic;
|
10 | 10 | using System.Threading.Tasks;
|
| 11 | +using static System.Runtime.InteropServices.JavaScript.JSType; |
11 | 12 |
|
12 | 13 | namespace Plumsail.DataSource.SharePoint
|
13 | 14 | {
|
14 | 15 | public class ListData
|
15 | 16 | {
|
16 | 17 | private readonly Settings.ListData _settings;
|
17 | 18 | private readonly GraphServiceClientProvider _graphProvider;
|
| 19 | + private readonly ILogger<ListData> _logger; |
18 | 20 |
|
19 |
| - public ListData(IOptions<Settings.AppSettings> settings, GraphServiceClientProvider graphProvider) |
| 21 | + public ListData(IOptions<Settings.AppSettings> settings, GraphServiceClientProvider graphProvider, ILogger<ListData> logger) |
20 | 22 | {
|
| 23 | + _logger = logger; |
21 | 24 | _settings = settings.Value.ListData;
|
22 | 25 | _graphProvider = graphProvider;
|
23 | 26 | }
|
24 | 27 |
|
25 |
| - [FunctionName("SharePoint-ListData")] |
| 28 | + [Function("SharePoint-ListData")] |
26 | 29 | public async Task<IActionResult> Run(
|
27 |
| - [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, |
28 |
| - ILogger log) |
| 30 | + [HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req) |
29 | 31 | {
|
30 |
| - log.LogInformation("ListData is requested."); |
| 32 | + _logger.LogInformation("ListData is requested."); |
31 | 33 |
|
32 | 34 | var graph = _graphProvider.Create();
|
33 | 35 | var list = await graph.GetListAsync(_settings.SiteUrl, _settings.ListName);
|
34 | 36 | var itemsPage = await list.Items.GetAsync(requestConfiguration =>
|
35 | 37 | {
|
| 38 | + //requestConfiguration.QueryParameters.Filter = "fields/Title eq 'item 1'"; |
36 | 39 | requestConfiguration.QueryParameters.Select = ["id"];
|
37 |
| - requestConfiguration.QueryParameters.Expand = ["fields(select=Title,Author)"]; |
| 40 | + requestConfiguration.QueryParameters.Expand = ["fields($select=Title,Author)"]; |
38 | 41 | });
|
39 | 42 |
|
40 | 43 | var items = new List<ListItem>();
|
|
0 commit comments