Sharepoint - Error while running Powershell Script in o365
This is because you are referring 2013 Client SDK dll's.. Look the path points to 15
hive
You should install SPO Client SDK and change to 16
hive in Add-Type
https://www.microsoft.com/en-us/download/details.aspx?id=42038
Most likely you are not binding to the right context. If you are working with the UserProfile, you need to bind your context to the My Site host, https://tenant-my.sharepoint.com
.