全て
| カテゴリ未分類
| 通常
| 数学
| 投資
| 副業
| 転職・就職
| ブログ
| 株Stock
| VBA
| SharePoint
| REST API
| RenderListDataAsStream
| PowerAutomateDesktop
| Graph API
| PowerApps
| PowerAutomate
| PowerFx
| OfficeScriptオフィススクリプト
| PowerAutomate日時Excel日時相互関係
| PowerShell
| Dataverse
| UiPath
| OneDrive
| LINQ
| VB.NET
| C#.NET
| WPFC#.NET
| Git
カテゴリ:VB.NET
Imports System.Net.Http Imports System.Text Imports System.Threading.Tasks Imports Newtonsoft.Json.Linq Module Module1 Sub Main() Dim siteUrl As String = "https://your-sharepoint-site-url" Dim username As String = "your-username" Dim password As String = "your-password" Dim listName As String = "YourListName" GetListItems(siteUrl, username, password, listName).Wait() End Sub Async Function GetListItems(siteUrl As String, username As String, password As String, listName As String) As Task Dim credentials As String = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}")) Using client As New HttpClient() client.DefaultRequestHeaders.Authorization = New System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials) Dim endpointUrl As String = $"{siteUrl}/_api/web/lists/getbytitle('{listName}')/items" Dim response As HttpResponseMessage = Await client.GetAsync(endpointUrl) If response.IsSuccessStatusCode Then Dim responseContent As String = Await response.Content.ReadAsStringAsync() Dim json As JObject = JObject.Parse(responseContent) Dim items As JArray = json("value") For Each item As JObject In items Dim itemId As Integer = item("Id") Dim title As String = item("Title") Console.WriteLine($"Item ID: {itemId}, Title: {title}") Next Else Console.WriteLine($"Failed to retrieve list items. StatusCode: {response.StatusCode}") End If End Using End Function End Module お気に入りの記事を「いいね!」で応援しよう
Last updated
2024.02.26 02:50:16
[VB.NET] カテゴリの最新記事
|