Uploading User Photos over 10KB to Office 365

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.
 

 
And voila!

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.

 

Cheers!

 

 

 

 

14 thoughts on “Uploading User Photos over 10KB to Office 365

  1. Jukka

    Hi again!

    The commands are correct in your post.
    It did not work with Windows 8.1 though. I typed the given commands I still got the error with hundreds of lines of red text like in the beginning of your post.

    But with server 2008 R2 it works OK, also with bigger photos.
    I Don’t know the reason though

    Reply
    1. John Post author

      Excellent. I am glad it worked with server 2008 r2. I was using windows 7, so it makes sense that 2008 would work. I have not yet tested on 2012

      John

      Reply
  2. ZakArt

    I am SO glad i found this post. I had no problem running it on windows 8.1 PS.
    Thank you very much for sharing…

    Now I just need to figure out for-each script for this

    Reply
  3. Philippe

    Hi
    If I don’t use the proxy, remove-userphoto work but the command set-userphoto reject my 26ko photos, too large …
    If I use the “/?proxyMethod=RPS” with the commands set-userphoto or remove-userphoto it doesn’t work :c/
    I have an error with html code saying … that it can’t give me information on the error !
    Someone has already had this problem ?

    Reply
  4. Mikhail Ionas

    Hi there. You mentioned the $for-each script to do it for all? Could you post the script or e-mail it top me? I am not so good with powershell.

    Thanks

    Reply
  5. Robert

    Just a quick message to say thanks for the post! All documentation points towards using Set-UserPhoto against the file directly (without reading it into an object first) and being able to upload any size.

    The proxy parameter and object method worked brilliantly and I intend on rolling this through the tenant. Cheers.

    Reply
  6. Mariusz

    Good evening,

    I just wanted to express my gratitude for this article. I just ran the command with the modifications made using this article and I was able to successfully upload a photo which gave me the 1000 error line code. Thank you.

    Reply
  7. Steward Thorne

    Wow, you really put a lot of effort into this, thanks!
    I must tell you that there is a simpler method this freeware can upload, update and export user photos in bulk. It even resizes them if necessary.

    Reply
  8. Pascal

    Thank you so much for this post, it saved me a lot of time. Not surprising that the Microsoft online support could not help you with this – i feel like they do not have a lot of knowledge themselves…

    Reply
  9. free ip proxy

    Hi,I check your blog named “Uploading User Photos over 10KB to Office 365 | 404john” regularly.Your humoristic style is awesome, keep doing what you’re doing! And you can look our website about free ip proxy.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>