Wilbert Cheng, student video producer/director, left, and Mamadou Ndiaye, UC Irvine's 7-foot-6 center, filmed the recorded invitation asking President Obama to speak at the June 14 commencement ceremony. (Sherry L. K. Main, UC Irvine / March 21, 2014)

University of California schools are two for two in convincing the first couple to speak at graduations.

As his wife did several years ago, President Obama agreed Thursday to give the commencement speech at a UC campus, officials announced. He will deliver the address at Irvine's 50th anniversary ceremony in June. The first lady was the first full graduation speaker at UC Merced in 2009.

Both schools had put on a full-court press to attract the Obamas, sending thousands of postcards, posting videos to YouTube and, in the case of Michelle Obama, mailing valentines.

The news was announced at the UC regents meeting in San Francisco, where officials and the audience gave UC Irvine Chancellor Michael V. Drake a round of applause.

"We just tried to make a compelling case for why this was the place for him to be this year," Drake said.

UC system President Janet Napolitano, who previously served in the Obama administration as secretary of Homeland Security, spoke with Obama about the invitation, according to Drake. Napolitano declined to discuss that contact Thursday, but issued a statement congratulating UCI.

UCI will hold a large ceremony at Angel Stadium in Anaheim on June 14 for all graduating students, but each of the 12 undergraduate and graduate schools also will have its own ceremonies.

The schools' faculty and students generally pick their own commencement speakers, who have included Orange County Sheriff Sandra Hutchens and Olympic diving champion Greg Louganis, but UCI officials decided last year they wanted to host Obama to mark the campus' 50th anniversary.

President Lyndon B. Johnson had attended the university's dedication and officials thought having Obama would be a way to close the circle, according to school administrators.

So far, Obama is not scheduled to speak at any other colleges or universities this year, the White House said, although presidents often speak at three, including a military institution and a public and private campus.

UCI administrators sent an invitation to the White House last spring and then began asking alumni and students for help recruiting the president by signing postcards and participating in videos. In one, 7-foot-6 freshman center Mamadou Ndiaye looks directly into the camera while towering over a cardboard cutout of Obama and says: "Mr. President, we should play ball together."

Administrators mailed the cards to UC offices in Washington, D.C. A school administrator then took the cards, which filled two bins, on a visit to White House officials to pitch UCI as a potential destination for Obama earlier this month.

UCI officials have spent about $1.2 million for the ceremony at Angel Stadium but said that money already had been earmarked for the school's 50th anniversary celebration. The cost will rise because of extra security and other measures for Obama, but officials have estimated that the total cost will be less than $2 million.

Students said they are excited to hear Obama speak.

"I feel it to be a once-in-a-lifetime opportunity," said Alex Liao, an international studies major who is scheduled to graduate.

Liao had been worried that there would only be one large ceremony that would deprive students of the chance to walk across the stage and receive their diploma, but having Obama and smaller ceremonies was the "optimal solution," he said.

"Politics aside, how often do you get to be in the presence of the president of the United States, much less hear a speech from the president in person?" Liao asked.

Song and Gordon write for the Los Angeles Times and can be reached at jason.song@latimes.com and larry.gordon@latimes.com.