Beispiel #1
0
        private static PSAuthenticationMethod?GuessAuthenticationMethodFromHostname(SearchRequest searchRequest, PSAuthenticationMethod alternateMethod)
        {
            PSAuthenticationMethod?result = null;

            var siteUrl = searchRequest.SharePointSiteUrl;

            if (!String.IsNullOrWhiteSpace(siteUrl))
            {
                if (Uri.TryCreate(siteUrl, UriKind.Absolute, out Uri uri))
                {
                    if (uri.Host.ToLower().EndsWith("sharepoint.com"))
                    {
                        result = PSAuthenticationMethod.SPOManagement;
                    }
                    else
                    {
                        result = alternateMethod;
                    }
                }
            }

            return(result);
        }