Creating Custom Root folders in all the mailboxes in office365
Download and install Exchange Web services 2.2 from the machine you are going to execute it.(Am doing it from my windows 8 desktop)
http://www.microsoft.com/en-in/download/confirmation.aspx?id=42951
Open Powershell in your Local machine (Run as administrator)
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Now verified am into Office365 powershell successfully.
Add impersonation permission for the user who is going to execute it –
New-managementroleassignment –Role “ApplicationImpersonation” –user sathesh@careexchange.onmicrosoft.com
Close and Reopen Powershell and connect back to office365 powershell
So that permission gets refreshed.
=================
Download Script –
=================
Do the Edits Required in the Script –
****
msgfolderroot denotes the Root of the Mailbox , If you specify inbox for example it creates the folder below the inbox
****
Change your
User name – Password in the script
****
$a = get-mailbox
denotes all the mailbox
To Run for a single mailbox (use the alias)
$a = get-mailbox “User1”
Save it a Notepad and Rename it to .ps1 file
Locate the script. being in the office 365 powershell session
.\create.ps1 for example
Great !!
You learnt how to create Custom root folders for all the mailboxes in Office365
Download Script –
HiSatheshwaran,
Thanks for the script. I have a question for you. I am currently running Office 365.
Your script has Exchange2010_sp1 as its version. Since Office 365 is using Exchange 2013 at the backend, should it be changed?
$ExchVer = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_sp1
After running the script, I received the following error. Do you have any suggestions? Thanks
PS C:\powershell> .\CreateRootFolder.ps1
Exception calling “AutodiscoverUrl” with “2” argument(s): “The Autodiscover
service couldn’t be located.”
At C:\powershell\CreateRootFolder.ps1:56 char:9
+ $service.AutodiscoverUrl($WindowsEmailAddress,$TestUrlCallbac …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : AutodiscoverLocalException
Creating Folder for Mailbox Name: ***@***onmicrosoft.com
Exception calling “Save” with “1” argument(s): “The request failed. The remote
server returned an error: (401) Unauthorized.”
At C:\powershell\CreateRootFolder.ps1:20 char:5
+ $oFolder.Save([Microsoft.Exchange.WebServices.Data.WellKnownFolde …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ServiceRequestException
Folder Created for ****@****.onmicrosoft.com
Hello, please assist:
Creating Folder for Mailbox Name: xxxx@codac.org
Exception calling “Save” with “1” argument(s): “The request failed. The underlying connection was closed: Could not est
ablish trust relationship for the SSL/TLS secure channel.”
At C:\users\me\desktop\CustomRootFolder.ps1:20 char:18
+ $oFolder.Save <<<< ([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::msgfolderroot)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Folder Created for xxxx@codac.org
Exception calling "AutodiscoverUrl" with "1" argument(s): "The Autodiscover service couldn't be located."
At C:\users\me\desktop\CustomRootFolder.ps1:50 char:33
+ $service.AutodiscoverUrl <<<< ($WindowsEmailAddress)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException