Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Import multiple appointments into O365 calendar

Posted on 2015-02-22
18
582 Views
Last Modified: 2015-03-09
Hi, does anybody got an idea (and preferably an example as I'm not a real programmer ;-))
On how to import calendar items into O365 mailboxes?

I've found a lot of articles on how to do it on an Exchange sever but as the servers are in the cloud that won't work :( ;-)

Thanks in advance
0
Comment
Question by:heensit
  • 10
  • 7
18 Comments
 
LVL 93

Expert Comment

by:John Hurst
ID: 40624138
Where are you importing from?  If I import calendar entries from more than one PST file, I will get all the calendar entries.
0
 
LVL 2

Author Comment

by:heensit
ID: 40624194
Sorry I seem to have forgotten that I need to import it via powershell...

I need to import in multiple mailboxes (so preferably via powershell) and I didn't know I could import pst's via powershell...
I know I can do it via the import in Outlook, but if you have to do over 50 mailboxes... ;-)
0
 
LVL 40

Assisted Solution

by:Vasil Michev (MVP)
Vasil Michev (MVP) earned 500 total points
ID: 40624631
You cannot import via PowerShell in Exchange Online/Office 365. You will have to either use Outlook, some EWS script, or additional software. The PST capture tool for example: https://technet.microsoft.com/en-us/library/hh781036(v=exchg.141).aspx. Or 3rd party tools, but they come at a price.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 2

Author Comment

by:heensit
ID: 40625205
Hi Vasil,

Do you mean you cannot import PST or, you cannot import at all?
0
 
LVL 40

Expert Comment

by:Vasil Michev (MVP)
ID: 40625214
You can import PSTs, just not with PowerShell.
0
 
LVL 2

Author Comment

by:heensit
ID: 40625220
ok, but if we can do the calendar import via CSV and powershell that would be much easier... isn't that an option? or can't you import CSV into O365 via powershell?
I've looked into this
http://blogs.msdn.com/b/emeamsgdev/archive/2012/02/13/exchange-2007-2010-powershell-import-calendar-items-from-csv-file.aspx
and
http://www.slipstick.com/exchange/cmdlets/use-powershell-import-appointments/
But it wouldn't work (as I said, I'm not a real programmer ;-) )
0
 
LVL 40

Expert Comment

by:Vasil Michev (MVP)
ID: 40625223
That script uses EWS, in order to make it work for Exchange Online you will need to download and install the EWS API, edit the script to use the EO EWS endpoint and either use impersonate or grant yourself full access permissions to all mailboxes. Also, it uses CSV files, not real PSTs. So, possible, but not that easy when you are using those things for the first time. If you only have few users to update just use Outlook to upload the PSTs.
0
 
LVL 2

Author Comment

by:heensit
ID: 40654538
Even with EWS installed it doesn't seem to work :(

Exception calling "Bind" with "2" argument(s): "The request failed. The remote server returned an error: (401) Unauthorized."
At Import-CalendarCSV.ps1:147 char:2
+     $CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($s ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ServiceRequestException

although I have impersonate rights or I try it with a global admin user who has rights to that user...
Maybe it isn't support on O365?
0
 
LVL 40

Expert Comment

by:Vasil Michev (MVP)
ID: 40654582
The script will not work out of the box, as I mentioned above you need to edit the EWS endpoint, i.e. the 'connect' part. Even if you do so, all the script does is to import items based on a CSV file, not PSTs.
0
 
LVL 2

Author Comment

by:heensit
ID: 40654618
I know that it imports from csv, that why I have an csv ;-)
and as for the connect part, this is what I'm using

Get-PSSession | Remove-PSSession
Set-ExecutionPolicy Unrestricted
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session  -AllowClobber
Connect-MsolService -Credential $LiveCred

the EWS is installed

and the string I use is
.\Import-CalendarCSV.ps1 -CSVFileName calendar.csv -EmailAddress user@domain.be -Impersonate $true -EwsUrl https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml
0
 
LVL 40

Assisted Solution

by:Vasil Michev (MVP)
Vasil Michev (MVP) earned 500 total points
ID: 40654638
0
 
LVL 2

Author Comment

by:heensit
ID: 40654657
keep getting the same error with or without the impersonate

Exception calling "Bind" with "2" argument(s): "The request failed. The remote server returned an error: (401
) Unauthorized."
At Import-CalendarCSV.ps1:148 char:2
+     $CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($s ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ServiceRequestException

Now I use the string
.\Import-CalendarCSV.ps1 -CSVFileName calendarOTC.csv -EmailAddress user@domain.be  -EwsUrl https://outlook.office365.com/EWS/Exchange.asmx
0
 
LVL 40

Assisted Solution

by:Vasil Michev (MVP)
Vasil Michev (MVP) earned 500 total points
ID: 40654710
The problem is that you are not providing any sort of credentials. The script is intended to be run from a local connection, where UseDefaultCredentials has a value. In your case, you need to specify the Username and Password for the account with Impersonate or Full Access permissions
0
 
LVL 2

Author Comment

by:heensit
ID: 40654808
Vasil, can I send you the script? then you can look at it, as I AM providing the username and password via the
Get-PSSession | Remove-PSSession
Set-ExecutionPolicy Unrestricted
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session  -AllowClobber
Connect-MsolService -Credential $LiveCred
PS I DO appreciate your help
0
 
LVL 2

Author Comment

by:heensit
ID: 40654809
Wait, I thing I understand what you mean ;-)
(:()
just found this in the script

 if ($Username -and $Password)
 {
     if ($Domain)
     {
         $service.Credentials = New-Object  Microsoft.Exchange.WebServices.Data.WebCredentials($Username,$Password,$Domain);
     } else {
         $service.Credentials = New-Object  Microsoft.Exchange.WebServices.Data.WebCredentials($Username,$Password);
     }
     
} else {
     $service.UseDefaultCredentials = $true;
 }
0
 
LVL 2

Author Comment

by:heensit
ID: 40654876
I'm doing something wrong I guess ;-)
First I'm asking for username and password
$Username = Read-Host -Prompt "Enter username with Impersonate credentials"
$SecurePassword = Read-Host -Prompt "Enter password" -AsSecureString
then I make a O365 connection
$LiveCred = New-Object System.Management.Automation.PSCredential($Username,$SecurePassword)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session  -AllowClobber
Connect-MsolService -Credential $LiveCred

That works fine

and then I try to create the service object
         $service.Credentials = New-Object  Microsoft.Exchange.WebServices.Data.WebCredentials($Username,$SecurePassword);
but that doesn't seem to work as I keep getting
Exception calling "Bind" with "2" argument(s): "The request failed. The remote server returned an error: (401) Unauthorized."
0
 
LVL 40

Accepted Solution

by:
Vasil Michev (MVP) earned 500 total points
ID: 40654985
Just use the relevant script parameters:

.\Import-CalendarCSV.ps1 -EmailAddress user@domain.onmicrosoft.com -CSVFileName 'blabla' -EWSManagedApiPath "blabla" -EwsUrl https://outlook.office365.com/EWS/Exchange.asmx -Username admin@domain.com -Password Password123

Open in new window

0
 
LVL 2

Author Closing Comment

by:heensit
ID: 40655074
First part is working now :D
it's creating all day events though, but that something for another question, I'm also going to try to get it to go through ALL mailboxes ;-)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question