Created
September 17, 2015 21:04
-
-
Save sandromello/96e519dd6d92181923fb to your computer and use it in GitHub Desktop.
Create Site OneDrive - Office365
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") | |
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles") | |
#Must be SharePoint Administrator URL | |
$webUrl = "https://domain-admin.sharepoint.com" | |
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl) | |
$web = $ctx.Web | |
$username = "[email protected]" | |
write-host "Digite sua senha" | |
#Cae1ein8 | |
$password = read-host -AsSecureString | |
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password) | |
$ctx.Load($web) | |
$ctx.ExecuteQuery() | |
$loader =[Microsoft.SharePoint.Client.UserProfiles.ProfileLoader]::GetProfileLoader($ctx) | |
#To Get Profile | |
$profile = $loader.GetUserProfile() | |
$ctx.Load($profile) | |
$ctx.ExecuteQuery() | |
$profile | |
#To enqueue Profile | |
$loader.CreatePersonalSiteEnqueueBulk(@("conta@dominio")) | |
$loader.Context.ExecuteQuery() | |
Write-Host "COMPLETED" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment