Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Import multiple appointments into O365 calendar

Posted on 2015-02-22
18
Medium Priority
?
830 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:Filip Heens
  • 10
  • 7
18 Comments
 
LVL 99

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:Filip Heens
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 44

Assisted Solution

by:Vasil Michev (MVP)
Vasil Michev (MVP) earned 2000 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
Ready for your healthcare security check-up?

In the past few years, healthcare organizations have become a prime target for advanced attacks. Does your organization have what it needs to defend itself? Schedule your healthcare security check-up today and download our free Healthcare Security Resource Kit today!

 
LVL 2

Author Comment

by:Filip Heens
ID: 40625205
Hi Vasil,

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

Expert Comment

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

Author Comment

by:Filip Heens
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 44

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:Filip Heens
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 44

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:Filip Heens
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 44

Assisted Solution

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

Author Comment

by:Filip Heens
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 44

Assisted Solution

by:Vasil Michev (MVP)
Vasil Michev (MVP) earned 2000 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:Filip Heens
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:Filip Heens
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:Filip Heens
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 44

Accepted Solution

by:
Vasil Michev (MVP) earned 2000 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:Filip Heens
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

971 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