question

JanardanKortikere-9639 avatar image
0 Votes"
JanardanKortikere-9639 asked saldana-msft edited

Getting 403 error when trying to read PowerApps List in Microsoft Graph Explorer.

Using GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id} in Microsoft Graph Explorer to read PowerApps List, but I a getting 403 error. However, I can read the same list using the same user in Visual Studio console project with CSOM.

microsoft-graph-sites-listsmicrosoft-graph-search
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered JanardanKortikere-9639 commented
  • Do you use the same user context in Microsoft Graph Explorer/POSTMAN & Visual Studio console project as well?

  • Validate the token using https://jwt.ms and see if there is any difference available.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sorry for the delay in reply. I use the same user id and password. I am not sure what else would be different in user context. I viewed the token that was in the Microsoft Graph Explorer using https://jwt.ms and I found that it did have the required permission "Sites.Read.All". I am unable to see token details in Visual Studio console project with CSOM.

0 Votes 0 ·
Deva-MSFT avatar image Deva-MSFT JanardanKortikere-9639 ·

Which permission (delegated/application) you used in your custom app? Have you tried the same in Graph explorer as well?

0 Votes 0 ·

Here is the code in my custom Console app using CSOM. You can see I am not providing permissions.

 using (var ctx = new ClientContext("https://..."))
 {
 string userId = ConfigurationManager.AppSettings["sharePointUserId"];
 string userPassword = ConfigurationManager.AppSettings["sharePointUserPassword"];

 SecureString password = new SecureString();
 foreach (char c in userPassword)
 {
     password.AppendChar(c);
 }               

 ctx.Credentials = new SharePointOnlineCredentials(userId, password);
 var web = ctx.Web;

 List list1 = web.Lists.GetByTitle("List1");
 CamlQuery query = CamlQuery.CreateAllItemsQuery();
 query.ViewXml = "<View><Query><Where>....</Where></Query></View>";
 ListItemCollection items = list1.GetItems(query);

 ctx.Load(items);
 ctx.ExecuteQuery();

 foreach (ListItem listItem in items)
 {
    Console.WriteLine(.....)
 }
 Console.ReadKey();
 }  
0 Votes 0 ·