The episode in which Jim and Pam get married is titled “Niagara.” It is a two-part episode from Season 6 of The Office, covering the couple's wedding weekend at Niagara Falls.
“Niagara” originally aired on October 8, 2009, and is listed as the fourth and fifth episodes of the sixth season. Jim and Pam's families and the Dunder Mifflin staff travel to the falls for the ceremony, but the weekend quickly becomes chaotic. Jim accidentally reveals Pam's pregnancy, and Andy injures himself while dancing at the hotel.
The church ceremony is interrupted when the guests recreate the viral JK Wedding Entrance Dance. Jim and Pam ultimately reveal that they had already married privately aboard the Maid of the Mist ferry, making their marriage official before the larger ceremony begins.
Viewers sometimes confuse “Niagara” with “The Wedding,” but “The Wedding” is not the episode's title. “Casino Night” is a major earlier Jim-and-Pam milestone involving their first kiss, while “A.A.R.M.” belongs to the show's ninth season and centers on Dwight and Angela's relationship.