Exemplo n.º 1
0
 public async Task DeleteAsync(string id)
 {
     using (var client = new SharePointRestClient(_uri))
     {
         await client.DeleteListItemAsync(SharePointStudentsListName, id);
     }
 }
Exemplo n.º 2
0
 public async Task UpdateAsync(Student student)
 {
     using (var client = new SharePointRestClient(_uri))
     {
         await client.UpdateListItemAsync(SharePointStudentsListName, student.Id, student);
     }
 }
Exemplo n.º 3
0
 public async Task AddAsync(Student student)
 {
     using (var client = new SharePointRestClient(_uri))
     {
         await client.InsertListItemAsync(SharePointStudentsListName, new { student.__metadata, student.Title });
     }
 }
Exemplo n.º 4
0
        public async Task <Student> GetOneAsync(string id)
        {
            using (var client = new SharePointRestClient(_uri))
            {
                JToken studentListItem = await client.GetListItemAsync(SharePointStudentsListName, id);

                return(new Student {
                    Id = studentListItem["Id"]?.ToString(), Title = studentListItem["Title"]?.ToString()
                });
            }
        }
Exemplo n.º 5
0
        public async Task <IEnumerable <Student> > GetAllAsync()
        {
            using (var client = new SharePointRestClient(_uri))
            {
                JToken studentsListItems = await client.GetListItemsAsync(SharePointStudentsListName);

                return(studentsListItems.Select(x => new Student {
                    Id = x["Id"]?.ToString(), Title = x["Title"]?.ToString()
                }));
            }
        }
Exemplo n.º 6
0
 public TestPnPContextFactory(
     ILogger <PnPContext> logger,
     SharePointRestClient sharePointRestClient,
     MicrosoftGraphClient microsoftGraphClient,
     IOptions <PnPContextFactoryOptions> contextOptions,
     IOptions <PnPGlobalSettingsOptions> globalOptions) : base(logger, sharePointRestClient, microsoftGraphClient, contextOptions, globalOptions)
 {
     if (TelemetryManager != null && !TestCommon.RunningInGitHubWorkflow())
     {
         // Send telemetry to the test Azure AppInsights instance
         TelemetryManager.TelemetryClient.InstrumentationKey = "6073339d-9e70-4004-9ff7-1345316ade97";
     }
 }