protected override void ExecuteCmdlet()
        {
            ProfileLoader profileLoader = ProfileLoader.GetProfileLoader(ClientContext);

            profileLoader.CreatePersonalSiteEnqueueBulk(Email);
            ClientContext.ExecuteQueryRetry();
        }
Пример #2
0
        /// <summary>
        /// Sample Member that provisions personal sites leveraging CSOM
        /// You dont want to do provision more than 200 users during a single request. If you have a large amount of users consider
        //  waiting for the last users site to be provisioned. The reason behind this is not to bombard the service with requests.
        /// </summary>
        /// <param name="tenantAdminUrl">The Tenanat Admin URL for your SharePoint Online Subscription</param>
        /// <param name="spoCredentials">The Credentials of the user who has tenant admin permission.</param>
        /// <param name="emailIDs">The email ids for users whos personal site you want to create.</param>
        public static void CreatePersonalSiteUsingCSOM(SharePointOnlineCredentials spoCredentials, string tenantAdminUrl, string[] emailIDs)
        {
            using (ClientContext _context = new ClientContext(tenantAdminUrl))
            {
                try
                {
                    _context.AuthenticationMode = ClientAuthenticationMode.Default;
                    _context.Credentials        = spoCredentials;

                    ProfileLoader _profileLoader = ProfileLoader.GetProfileLoader(_context);
                    _profileLoader.CreatePersonalSiteEnqueueBulk(emailIDs);
                    _profileLoader.Context.ExecuteQuery();
                }
                catch (Exception _ex)
                {
                    Console.WriteLine(string.Format("Opps, something went wrong and we need to work on it. The error message is {0}", _ex.Message));
                }
            }
        }