Mar 31 2020 10:04 PM - edited Mar 31 2020 10:05 PM
I have a Winforms app that displays a SharePoint site collection and document libraries in a TreeView control with hierarchy according to the site level.
I use the following code for account with MFA enabled
AuthenticationManager authManager = new AuthenticationManager();
using (ClientContext clientContext = authManager.GetWebLoginClientContext(siteUrl))
{
Web web = clientContext.Web;
WebCollection site = web.GetSubwebsForCurrentUser(null);
clientContext.Load(site, we => we.Include(w => w.Url, w => w.Title));
clientContext.ExecuteQuery();
teamSites = site.ToDictionary(w => w.Url, w => w.Title);
teamSites = teamSites.OrderBy(kvp => kvp.Value).ToDictionary(k => k.Key, k => k.Value);
ListCollection libraries = web.Lists;
clientContext.Load(libraries, l => l.Include(li => li.DefaultViewUrl, li => li.BaseType, li => li.Title, li => li.BaseTemplate, li => li.Hidden));
clientContext.ExecuteQuery();
documentLibraries = libraries.Where(lib => lib.BaseType == BaseType.DocumentLibrary && lib.Hidden == false && lib.BaseTemplate == 101).ToList();
}
The team site URL will be added to each TreeNode in my TreeView, whenever user clicks on a TreeNode, it will need to load the sub-sites and document libraries using the above method. However, every time it loads, the pop up shows and disappears because user is already logged in. Is there anyway to prevent it popping up every single time user clicks on the site TreeNode?
Apr 01 2020 11:22 AM
Apr 01 2020 03:57 PM
Apr 01 2020 10:32 PM
Apr 01 2020 10:54 PM
@jcgonzalezmartin
I followed this article to set things up. https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
But I keep getting the error (see attachment).
Apr 02 2020 04:15 PM