I’m trying to write a small VSTO for Office365 (PowerPoint desktop). When the user clicks a button on the ribbon, it will read a SharePoint list as the current Office user, then display some details on a Windows form. That’s it. I thought this was going to be an easy exercise. I’ve tried a few approaches but there’s a lot of dated guidance to sift through.
My approach so far is:
- use Vb.net (C# examples ok)
- use CSOM Client objects
- use ClientContext credentials
- read a list from https://abcde.sharepoint.com
However, I’ve not been successful so far with any example code I’ve found. Authentication usually fails with 401 (unauthorized). I’m wondering how much of this is deprecated in 2024 for Office365 SharePoint online.
Questions I have:
- Can I avoid prompting the user for credentials and instead use their currently logged-in Office365 account? Is that possible from a VSTO?
- Is it essential to supply the uid,pwd pair?
- Do I need to set:
ClientContext.usedefaultcredentials = True ? - Should I be using PNP instead? How?
- Is there a better way, which avoids COSM DLLs? I looked for a .Net class which wrappered a RESTful API call to SharePoint, but didn’t find anything.
Thanks for any guidance. I’m learning how to call SharePoint365 from a VSTO and it surprises me how hard it is!
1