public async Task DeleteAsync(string id) { using (var client = new SharePointRestClient(_uri)) { await client.DeleteListItemAsync(SharePointStudentsListName, id); } }
public async Task UpdateAsync(Student student) { using (var client = new SharePointRestClient(_uri)) { await client.UpdateListItemAsync(SharePointStudentsListName, student.Id, student); } }
public async Task AddAsync(Student student) { using (var client = new SharePointRestClient(_uri)) { await client.InsertListItemAsync(SharePointStudentsListName, new { student.__metadata, student.Title }); } }
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() }); } }
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() })); } }
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"; } }