  The reaction $^{17}$O$(p,\gamma)^{18}$F influences hydrogen-burning
nucleosynthesis in several stellar sites, such as red giants, asymptotic giant
branch (AGB) stars, massive stars and classical novae. In the relevant
temperature range for these environments ($T_{9}=0.01-0.4), the main
contributions to the rate of this reaction are the direct capture process, two
low lying narrow resonances ($E_{r}=65.1$ and 183 keV) and the low-energy tails
of two broad resonances ($E_{r}=557$ and 677 keV). Previous measurements and
calculations give contradictory results for the direct capture contribution
which in turn increases the uncertainty of the reaction rate. In addition, very
few published cross section data exist for the high energy region that might
affect the interpretation of the direct capture and the contributions of the
broad resonances in the lower energy range. This work aims to address these
issues. The reaction cross section was measured in a wide proton energy range
($E_{c.m.}=345$ - 1700 keV) and at several angles
($\theta_{lab}=0^{\circ},45^{\circ},90^{\circ},135^{\circ}$). The observed
primary $\gamma$-transitions were used as input in an $R$-matrix code in order
to obtain the contribution of the direct capture and the two broad resonances
to the low-energy region. The extrapolated S-factor from the present data is in
good agreement with the existing literature data in the low-energy region. A
new reaction rate was calculated from the combined results of this work and
literature S-factor determinations. Resonance strengths and branchings are
reported for several $^{18}$F states. We were able to extrapolate the
astrophysical S-factor of the reaction $^{17}$O$(p,\gamma)^{18}$F at low
energies from cross section data taken at higher energies. No significant
changes in the nucleosynthesis are expected from the newly calculated reaction
rate.
