private async Task <ValidateResult> ValidateSPOUserID(UserAuthorizationQuery state, object value)
        {
            string _inputSPOUserID = Convert.ToString(value);
            var    result          = new ValidateResult {
                IsValid = false, Value = _inputSPOUserID
            };

            SharePointPrimary obj = new SharePointPrimary(state.SiteCollectionURL);

            result.IsValid = obj.IsValidSPOUser(_inputSPOUserID);
            if (!result.IsValid)
            {
                result.Feedback = $"I could not find your profile {_inputSPOUserID} in our O365 tenant. " +
                                  "\r\r If you are an external user, please raise your request in the 'External User Access' option" +
                                  "\r\r or enter a valid user id.";
            }
            else
            {
                // call method to check permission
                string _userPermission = obj.CheckUserPermission(state.SiteCollectionURL, _inputSPOUserID);
                if (string.IsNullOrEmpty(_userPermission))
                {
                    result.Feedback = "Yes. I have found your profile in our O365 tenant. ";// +
                }
                //"\r\r To know more about permission, please visit : "+ Constants.RoleTypeMSDN;
                else
                {
                    result.Feedback = $"Looks like you already have some permissions assigned to you : " +
                                      $"\r\r {_userPermission}";  // +
                }
                // "\r\r To know more about permission,please visit : " + Constants.RoleTypeMSDN;
            }

            return(result);
        }
Esempio n. 2
0
        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);
        }
        private async Task <ValidateResult> ValidateSPOUserID(SiteQuotaChangeQuery state, object value)
        {
            string _inputSPOUserID = Convert.ToString(value);
            var    result          = new ValidateResult {
                IsValid = false, Value = _inputSPOUserID
            };

            SharePointPrimary obj = new SharePointPrimary(state.SiteCollectionURL);

            result.IsValid = obj.IsValidSPOUser(_inputSPOUserID);
            if (!result.IsValid)
            {
                result.Feedback = $"I could not find the profile {_inputSPOUserID} in our O365 tenant. ";
            }
            else
            {
                result.Feedback = "Yes, I have found your profile in our O365 tenant.";
            }

            return(result);
        }