コード例 #1
0
        /// <summary>
        /// Initialize OneDrive Service only for OnlineId Provider
        /// </summary>
        /// <param name="onlineIdPromptType">Specify whether to prompt for credentials. Set to DoNotPrompt if calling from a background task.</param>
        /// <returns>Success or failure</returns>
        public bool Initialize(OnlineIdAuthenticationProvider.PromptType onlineIdPromptType)
        {
            OneDriveScopes scopes = OneDriveScopes.ReadWrite | OneDriveScopes.OfflineAccess;

            _onlineIdPromptType = onlineIdPromptType;
            return(Initialize(scopes, _onlineIdPromptType));
        }
コード例 #2
0
        /// <summary>
        /// Initialize OneDrive service
        /// </summary>
        /// <param name="appClientId">Application Id Client. Could be null if AccountProviderType.OnlineId is used</param>
        /// <param name="accountProviderType">Account Provider type.
        /// <para>AccountProviderType.OnlineId: If the user is signed into a Windows system with a Microsoft Account, this user will be used for authentication request. Need to associate the App to the store</para>
        /// <para>AccountProviderType.Msa: Authenticate the user with a Microsoft Account. You need to register your app https://apps.dev.microsoft.com in the SDK Live section</para>
        /// <para>AccountProviderType.Adal: Authenticate the user with a Office 365 Account. You need to register your in Azure Active Directory</para></param>
        /// <param name="scopes">Scopes represent various permission levels that an app can request from a user. Could be null if AccountProviderType.Adal is used </param>
        /// <param name="onlineIdPromptType">Specify whether to prompt for credentials. Set to DoNotPrompt if calling from a background task.</param>
        /// <remarks>If AccountProvider</remarks>
        /// <returns>Success or failure.</returns>
        public bool Initialize(string appClientId, AccountProviderType accountProviderType = AccountProviderType.OnlineId, OneDriveScopes scopes = OneDriveScopes.ReadWrite | OneDriveScopes.OfflineAccess, OnlineIdAuthenticationProvider.PromptType onlineIdPromptType = OnlineIdAuthenticationProvider.PromptType.PromptIfNeeded)
        {
            _onlineIdPromptType = onlineIdPromptType;

            if (accountProviderType != AccountProviderType.OnlineId && string.IsNullOrEmpty(appClientId))
            {
                throw new ArgumentNullException(nameof(appClientId));
            }

            AppClientId = appClientId;

            if (accountProviderType != AccountProviderType.Adal)
            {
                Scopes = OneDriveHelper.TransformScopes(scopes);
            }

            IsInitialized        = true;
            _accountProviderType = accountProviderType;
            return(true);
        }
コード例 #3
0
 /// <summary>
 /// Initialize OneDrive Service only for OnlineId Provider
 /// </summary>
 /// <param name="scopes">Scopes represent various permission levels that an app can request from a user</param>
 /// <param name="onlineIdPromptType">Specify whether to prompt for credentials. Set to DoNotPrompt if calling from a background task.</param>
 /// <returns>Success or failure</returns>
 public bool Initialize(OneDriveScopes scopes = OneDriveScopes.ReadWrite | OneDriveScopes.OfflineAccess, OnlineIdAuthenticationProvider.PromptType onlineIdPromptType = OnlineIdAuthenticationProvider.PromptType.PromptIfNeeded)
 {
     _onlineIdPromptType = onlineIdPromptType;
     return(Initialize(null, AccountProviderType.OnlineId, scopes, _onlineIdPromptType));
 }