internal static void EnsureRegistered()
 {
     if (SharePointOnlineAuthenticationModule.s_instance == null)
     {
         lock (SharePointOnlineAuthenticationModule.s_lock)
         {
             if (SharePointOnlineAuthenticationModule.s_instance == null)
             {
                 SharePointOnlineAuthenticationModule.s_instance = new SharePointOnlineAuthenticationModule();
                 //Edited for .NET Core
                 //AuthenticationManager.Register(SharePointOnlineAuthenticationModule.s_instance);
             }
         }
     }
 }
Пример #2
0
        public SharePointOnlineCredentials(string username, SecureString password)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw ClientUtility.CreateArgumentNullException("username");
            }
            int num = username.IndexOf('@');

            if (num < 0 || num == username.Length - 1)
            {
                throw ClientUtility.CreateArgumentException("username");
            }
            if (password == null)
            {
                throw ClientUtility.CreateArgumentNullException("password");
            }
            SharePointOnlineAuthenticationModule.EnsureRegistered();
            this.m_userName = username;
            this.m_password = password;
        }