WebExtensions.GetAllWebUrls (PnP Core Component) – This extension method returns the collections of the URLs of all web sites that are contained within the site collection including the top-level site and its sub sites.
Supports: SharePoint 2013+, SharePoint Online
Assembly: OfficeDevPnP.Core.dll
Namespace: Microsoft.SharePoint.Client
Syntax:
Single Line Code: Site.GetAllWebUrls()
Code Snippet:
The following example returns the collection of all web sites from the Site Collection including top level site and its sub site.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.SharePoint.Client;
- using OfficeDevPnP.Core;
- // Assembly Reference Used: OfficeDevPnP.Core, Version=2.4.1605.0, Culture=neutral, PublicKeyToken=3751622786b357c2
- namespace SampleApplication
- {
- class Program
- {
- static void Main(string[] args)
- {
- string siteUrl = "https://sharepointonline.sharepoint.com";
- AuthenticationManager authManager = new AuthenticationManager();
- //Interactive Login to SharePoint site - Opens a Online signin page to authenticate the user
- var context = authManager.GetWebLoginClientContext(siteUrl);
- IEnumerable<string> webUrls= context.Site.GetAllWebUrls();
- string weburl = "";
- foreach(var url in webUrls)
- {
- weburl += url + "\r\n";
- }
- Console.WriteLine(weburl);
- Console.WriteLine("Press any key to exit.");
- Console.ReadKey();
- }
- }
- }

Naveen PrasathPosted Jan 17, 2019, 1:14 AM
Hi, Is it possible to use GetWebLoginClientContext in Azure web application? If No, what is the best way to get the clientcontext from Azure web app? Have to obtain the ClientContext within user context not an app only context? Please suggest an idea.
Vipin TyagiPosted Jul 27, 2016, 6:18 AM
Yes,I want to discuss the core idea behind it and how I can be good in it.
Vipin TyagiPosted Jul 21, 2016, 6:20 AM
Shantha Kumar T Sir,I want a discussion for PnP Core.How It is possible?
Bhuvanesh MohankumarPosted May 18, 2016, 7:43 AM
Good one...
naveen kumarPosted May 17, 2016, 6:04 AM
i think OfficeDevPnP.Core.AuthenticationManager authManager = new OfficeDevPnP.Core.AuthenticationManager(); is the solution
naveen kumarPosted May 17, 2016, 6:03 AM
new AuthenticationManager() giving has no Constructor defined