In my 2013 sharepoint I have incorporated a blog where interested workers can subscribe to alerts to receive notifications for new posts.
My question is how to know which users have subscribed to that alert.
Thank you.
In my 2013 sharepoint I have incorporated a blog where interested workers can subscribe to alerts to receive notifications for new posts.
My question is how to know which users have subscribed to that alert.
Thank you.
Try this code:
public static string listarAlertasLista(SPWeb web, string listaInternalName)
{
string alerts = "";
string listUrl = web.ServerRelativeUrl + "/Lists/" + listaInternalName;
listUrl = listUrl.Replace("//", "/");
SPList list = web.GetList(listUrl);
SPAlertCollection alertsColl = web.Alerts;
alerts += "<span style='color: blue'>Alertas de la lista " + listaInternalName + "</span><br>";
foreach (SPAlert alert in alertsColl)
{
if (alert.ListID == list.ID)
{
alerts += "Usuario: " + alert.User.LoginName + "<br>";
alerts += "Tipo: " + alert.AlertType + "<br>";
alerts += "Canales: " + alert.DeliveryChannels.ToString() + "<br>";
}
}
return alerts;
}