One of the cornerstones of The Office's success was the relationship between Jim Halpert and Pam Beesly. Both characters were so likable that fans had no choice but to cross their fingers that they would end up together.

RELATED: 10 Favorite Storylines In The Office, According To Reddit

Fortunately, fans got their wish, but it was a long road to get there. It didn't always look like Pam would choose Jim, and the viewers felt both characters' pain. When it wasn't Michael making things awkward, it was the violent Roy, but the show did a masterful job of painstakingly building towards their being united.

The Peck: "The Dundies" (Season 2, Episode 1)

The Office Jim and Pam's first kiss at the Dundies

"The Dundies" was really the episode where the audience learned that Roy definitely wasn't the man for Pam. She's having a good time at Dunder Mifflin's disaster of a holiday party and he tries to force her to leave.

Instead, she stays back and drinks. With her is Jim, who is most concerned with her getting home safely. However, before they leave the Chili's, Pam gives Jim a big kiss on the lips. It was the first true sign that the two would end up together.

Jim's Room: "Email Surveillance" (Season 2, Episode 9)

Kevin, Michael, Jim, and Pam sitting at a table in Email Surveillance episode The Office

Jim hosts a party at his house and everyone invited shows up. Furthermore, Michael, who was not invited, also shows up. He was the only one excluded, and at first goes to his improv class (just one of the clubs in The Office that every fan wishes they could join), which he also ruins.

"Email Surveillance" has a couple of important Jim-Pam moments. One is that Pam finds out Angela and Dwight are sleeping together. This is a piece of information that eventually leads to Jim and Pam's further bonding. The other big moment is when Pam spots Jim's high school photo while he shows her around his room. The dorky picture would make a return appearance in one of Jim's more poignant efforts to win her heart.

Shopping: "Michael's Birthday" (Season 2, Episode 19)

Michael in hockey gear at an ice rink in The Office

"Michael's Birthday" is one of the best Michael Scott episodes, beyond a shadow of a doubt. However, it also contains a wonderful bonding moment between Jim and Pam.

RELATED: 5 The Office Characters That Would Make A Good Avatar (& 5 That Would Not)

Kevin Malone is waiting on results from a skin cancer test. Jim, Pam, and the remainder of the office choose to focus on him over Michael's birthday. In particular, Jim and Pam go out to the local pharmacy to pick up Kevin's favorites: M&Ms & American Pie 2. There's also a sweet moment where Pam ribs Jim for buying fabric softener.

The Kiss: "Casino Night" (Season 2, Episode 22)

Jim and Pam kiss in Casino Night episode of The Office

Arguably the most iconic Jim and Pam moment came in the Steve Carell-directed season finale, "Casino Night." Michael has organized a warehouse casino night and invites both Jan Levinson and Carole Stills.

Jim, however, only has eyes for Pam. At the end of Michael's event, he goes so far as to profess this to her directly. They share a passionate kiss, but Pam makes it clear that she's engaged, leaving Jim out of luck on casino night (for now). It's a heartbreaking moment and seals season 2 of The Office as Jim's season.

Providing Assistance: "Back From Vacation" (Season 3, Episode 12)

Dwight consoling Pam in The Office

"Back from Vacation" is the episode with the Bahamas picture where Jan lays on a beach chair topless while Michael has a goofy grin on his face with his thumbs up. Jim and Pam have a laugh about this, but it's Pam's actions that make this a special episode.

Jim and Karen Filippelli are having issues in their relationship. She'd like to live closer to him, while he pushes back on the idea. Pam gets in the middle and convinces Jim to be reasonable. It's a subtle moment that still informs the audience that there's electricity there. Pam is Jim's friend, but there's also more. This is confirmed when Pam is seen crying in the stairwell. This leads to the episode's best moment when it's shown that Dwight can actually be a fairly compassionate human.

Bye Roy: "Cocktails" (Season 3, Episode 18)

Pam fighting with Roy at a bar in The Office

"Cocktails" was the episode where viewers knew they were finally about to get a Roy-free The Office. The warehouse worker was unlikable until his cameos later in the series, and his actions here are the apex of his distastefulness.

RELATED: 10 Times Kevin Malone Made Fans Cringe On The Office

Pam tells Roy about casino night. They're starting to reconnect and she wants to be honest. Roy blows it by causing hundreds of dollars of damage at the bar, screaming at the woman he supposedly loves. Roy would attempt to strike Jim in the next episode, "The Negotiation," but it was here that Pam saw there would never be any hope with him.

It's A Date: "The Job" (Season 3, Episodes 24 & 25)

Jim asks Pam out on The Office

The previous episode, "Beach Games," had Pam do the firewalk then confess to Jim (in front of all of Dunder Mifflin, including Karen) that he was the reason she called off her engagement to Roy.

Season 3's finale, "The Job," follows up on the New York position also established in that episode. Jim, Michael, and Karen are all in the running for it. It looks good for Jim and Karen, but Jim turns it down. Instead, he comes back to Scranton and finally asks Pam out. She says yes, and he says, "Alright. Then, it's a date." The season 3 finale is easily one of The Office's best Jim & Pam episodes.

The B&B: "Money" (Season 4, Episodes 7 & 8)

Jim stands in front of Pam and Dwight working the farm in The Office

The main plot of the episode focuses on Michael and his dire financial straits, mostly courtesy of Jan's voracious spending. It's a strong half of the episode that is still superseded by Jim & Pam's.

The b-plot features the couple going to Dwight's farm, which, for the time being, he's turned into a creepy bed and breakfast. Pam and Jim's relationship doesn't undergo any significant change over this night, but it showed a happy and loving relationship that could withstand even Dwight's midnight moaning.

The Pregnancy: "Company Picnic" (Season 5, Episode 28)

Pam finds out she's pregnant in The Office

Jim and Pam tended to get great finales on The Office and season 5's was no different. While playing volleyball at the company picnic (as well as avoiding the unnecessary scrutiny from Charles Miner), Pam sprains her ankle.

The audience didn't really expect this to be the time of the announcement, but Jim is shown entering the examination room with Pam. He becomes visibly overjoyed, shaking and crying. There doesn't even need to be dialogue for the viewer to know exactly what has happened. Then, Jim tells Dwight to "call in the subs."

The Wedding: "Niagara" (Season 6, Episodes 4 & 5)

Jim and Pam from The Office getting married on a boat on Niagara Falls

This two-parter episode has become a classic for the series, as well as for Pam & Jim enthusiasts. Jim may accidentally spoil Pam's pregnancy to the whole wedding party (including her Meemaw), but it otherwise goes okay.

Pam rips her veil, but then Jim charmingly snips his tie in two. This sweet moment leads to the couple running off and getting married on the Maid of the Mist (the tour boat for Niagara) in order to avoid the stress of clashing families (and Michael Scott).

NEXT: 10 Unpopular Opinions About The Office's Jim & Pam, According To Reddit