sharepointcsomspfx-extension

How to get CorporateCatalogUrl url using csom


I want to get tenant CorporateCatalogUrl using CSOM . I tried following code & didn't work . I am also not sure that is the correct way.Is there way to get CorporateCatalogUrl using CSOM ?

using (ClientContext context = new ClientContext("https://abc-admin.sharepoint.com"))
                {
                    context.ExecutingWebRequest += delegate (object sender, WebRequestEventArgs e)
                    {
                        e.WebRequestExecutor.WebRequest.Headers.Add("Authorization", "Bearer " + AccessToken);
                    }; 
           
                    var TenantSettings = Microsoft.SharePoint.Client.TenantSettings.GetCurrent(context);                       
                    context.Load(TenantSettings);
                    context.ExecuteQueryRetry();   
                }

Solution

  • I use SharePointOnlineCredentials(name, securePassword); for authentication, and I could get the tenant CorporateCatalogUrl as the below picture. If you are using access token, please make sure you have grant necessary permissions.

    enter image description here