Really looking forward in attending ExpertsLive Europe by the end of this month and I was looking at the sessions and was wondering how to send them to my agenda.
Since typing is no option I decided to use PowerShell to automate this process 🙂
For the script and ICS file to directly import – https://gallery.technet.microsoft.com/scriptcenter/Retrieve-session-3f43ec1f
The Idea
Read the session information from the experstlive site using PowerShell.
Gather the session information and create appointments in my agenda.
Solution
The steps sounds pretty easy but as always when time goes along it is not that easy 😉
First I needed to query the data from the website.
I tried using the invoke-webrequest.
First you need to tell PowerShell to use TLS 1.2 (by default it uses 1.0 which fails)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
After trying many options I couldn’t retrieve the information I wanted. So I started to look at other options.
The option which worked for me was starting IE and gather the information from there:
$global:ie=new-object -com "internetexplorer.application"
$ie.visible=$true
$ie.navigate("https://www.expertslive.eu/sessions--call-for-speakers.html")
This part opens IE and navigates to the correct website.
After opening the website we need to make sure the website is fully loaded:
while ($ie.readystate -lt 4){start-sleep -milliseconds 200}
When the website is fully loaded we can retrieve the sessions:
$Sessions = $ie.Document.getElementsByTagName("li") |Where-Object {$_.className -eq "sz-session sz-session--full"}
When we look at our array we can see the information is in there.
Next I gathered the information and alter to remove the trailing spaces, hard enters etc.
After this I created an ICS file and imported the information.
This caused some time to find the correct format. Also I needed to change the times to the correct format and set them back to UTC. Otherwise the import would edit the times again…
Although I would have loved to simply automatically import the ICS into my outlook agenda….this failed.
Reason is this is not possible…or it will add an extra agenda…
Only option is to manually import the ICS file:
Import/Export
When selecting the file it will prompt you to import in default agenda or creating a new agenda.
After importing in my default agenda:
Ony thing left is removing the sessions you will not attend or leave it as is