I'm following the below link to create a personal tab in a Team App.
https://learn.microsoft.com/en-us/microsoftteams/platform/build-your-first-app/build-personal-tab
I need to fetch and display contents from a SharePoint list here. I get the below error-
{"odata.error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}
The user is a SharePoint Administrator and Site collection Admin.
Code-
var spUrl="https://****.sharepoint.com/sites/Project4thCOM2"; //hard coded SP Site URL
var web = Web(spUrl);
await web.lists.getByTitle("Teams List").items().then((items)=>{
items.forEach(element=>{
this.setState({
Title:element['Title'],
SingleLine:element['SingleLine']
})
})
}).catch(err=>console.log(err))
Could anyone please suggest how we can access the SharePoint list data here.
Regards,
Kevin