I was recently faced with a very frustrating problem in regards to uploading user photos over 10KB into Office 365. Their online documentation states that “The “native” size of user photos is around 100×100 pixels, with a file size of 10 KB”. First of all, that is an extremely small and grainy photo, and shrinking my original 2 MB photo down to 10 KB left the picture very distorted. Regardless, using the Set-UserPhoto cmdlet, I was only able to upload a 4KB photo at about a 60×60 resolution. Anything over that would give me “The remote server returned an error: (413) Request Entity Too Large…” I opened a ticket with their online support and after weeks of back and forth emails and phone calls, their support technician told me that this was an issue and there was nothing to do about it except wait for Microsoft to release a fix.
I did not want to accept that answer so I opened a support ticket with the Microsoft Partner Network. About 5 days later they gave me the answer I was looking for:
They told me I needed to use a different proxy method when conencting to my O365 server. If you look at the connectionURI you will see /?proxyMethod=RPS . This is the first thing I was doing wrong. The second thing I was doing wrong was following the help page for the Set-UserPhoto cmdlet (lol). In order for it to work correctly, you need to first encode your photo data into a variable, and then use that variable in your Set-UserPhoto cmdlet.
I was able to upload 800x800px photos that were 150 KB in size! A quick For-Each script and I had all of my user’s photos set in about 20 minutes.
I spend days and days searching the internet for an answer and couldn’t fine one. I hope this will be able to help out anyone else with this problem.