The photograph above is the first surviving photo of a sitting president. James K. Polk, the 11th President of the United States, was photographed while in office on February 14, 1849. The daguerreotype was taken by famous photographer Matthew Brady in New York City. Polk was also the first president to be extensively photographed during his presidency.
Clarification: It has been stated that William Henry Harrison, the ninth President of the United States, was the first president to be photographed while in office. According to some sources, after delivering his 1841 inaugural speech, President Harrison posed for a daguerreotype. Harrison died after only 31 days into his term. That photograph has since been lost leaving Polk’s 1849 photograph as the first (surviving) photograph of a sitting president.