private async Task <ValidateResult> ValidateSiteCollectionURL(SiteCreationQuery state, object value) { string _inputSiteCollectionTitle = Convert.ToString(value); var result = new ValidateResult { IsValid = false, Value = _inputSiteCollectionTitle }; SharePointPrimary obj = new SharePointPrimary(); result.IsValid = obj.DoesContainSpecialCharacter(_inputSiteCollectionTitle); if (result.IsValid) { result.IsValid = !obj.DoesURLExist(_inputSiteCollectionTitle); if (!result.IsValid) { result.Feedback = $"A site collection with url '{_inputSiteCollectionTitle}' is already present in our tenant. Try something different."; } else { result.Feedback = "The site title is available to use."; } } else { result.Feedback = "Special characters are not allowed in site collection URL."; } return(result); }
private async Task <ValidateResult> ValidatePrimaryAdmin(SiteCreationQuery state, object value) { string _inputSPOUserID = Convert.ToString(value); var result = new ValidateResult { IsValid = false, Value = _inputSPOUserID }; SharePointPrimary obj = new SharePointPrimary(); result.IsValid = obj.IsValidSPOUser(_inputSPOUserID); if (!result.IsValid) { result.Feedback = $"I could not find the site collection administrator's profile {_inputSPOUserID} in our O365 tenant. "; } else { result.Feedback = "Yes. I have found the primary site collection administrator's profile in our O365 tenant. "; } return(result); }