Is it possible to get the 'Primary Site Collection Administrator' using Microsoft.SharePoint.Client csom?
I can get the site collection administrators by checking the site users and the isadmin flag but there could be multiple users with this set.
Below is a screenshot of what I'm trying to retrieve, this is what I have so far:
Web oWebsite = clientContext.Web;
clientContext.Load(oWebsite, website => website.Webs, website => website.Title, website => website.SiteUsers.Include(_=>_.IsSiteAdmin, _=>_.LoginName));
clientContext.ExecuteQuery();
foreach (var user in oWebsite.SiteUsers) {
if (user.IsSiteAdmin) {
Console.WriteLine(user.LoginName);
}
}