Ask Your Question
0

How can I retrieve a Sharepoint list from MS Teams using VB.net?

asked 2022-03-18 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-18 14:00:00 +0000

david gravatar image

To retrieve a SharePoint list from MS Teams using VB.net, you can use the Microsoft Graph API to query the SharePoint site within the MS Teams team. Here are the general steps:

  1. Authenticate your VB.net app with Microsoft Graph using OAuth 2.0 access tokens.
  2. Use the Graph API to query the SharePoint site. Your request should include the site ID or URL and the list name or ID.
  3. Parse the response data and extract the relevant information about the SharePoint list, such as the item IDs, titles, and metadata.
  4. Use the retrieved data as needed within your VB.net app.

Here is some example code to get started:

Dim graphClient As GraphServiceClient = New GraphServiceClient(authProvider)

' Replace the placeholders with the actual values for your SharePoint site and list
Dim siteId As String = "YOUR_SITE_ID_HERE"
Dim listName As String = "YOUR_LIST_NAME_HERE"

' Query the SharePoint list using the Microsoft Graph API
Dim listItems As IListItemsCollectionPage = Await graphClient.Sites(siteId).Lists(listName).Items.Request().GetAsync()

' Loop through the retrieved items and do something with each one
For Each item As ListItem In listItems.CurrentPage
    Console.WriteLine($"Item ID: {item.Id}, Title: {item.Fields("Title")}")
Next
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-03-18 11:00:00 +0000

Seen: 8 times

Last updated: Dec 18 '21