vendredi 15 octobre 2010

Sharepoint – Obtenir le SMTP Host de la config en code-behind

Pour obtenir le SMTP Host configuré dans notre ferme :

if (SPContext.Current.Site.WebApplication.OutboundMailServiceInstance != null)
{
//Obtient le SMTP host de "Outgoing e-mail settings"
smtp.Host = SPContext.Current.Site.WebApplication.OutboundMailServiceInstance.Parent.Name;
}

Aucun commentaire:

Enregistrer un commentaire