3

SP2013, I would like to be able to export a list of everyone who has set an alert on a specific list or library. I can see how to edit specific user's alerts, but I'd like to have the full list of users exported.

1

Try this:

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;
}
  • This doesn't answer the question. The OP asked for all user alerts on a list, not all alerts for a single user. – Paul Lucas Mar 25 '16 at 22:59
  • Paul is correct-this answer is not what I needed. It's pretty easy to manage the alert set by a single user using the Site Settings-User Alerts. But I need to know the names of about 800-1000 people that were supposed set an alert on a specific list. I'm using the alert feature as a required communication, thus I need to know who the alert is being sent to. – Bankerbob Mar 27 '16 at 14:40
  • I modified my answer based on the comments. Hope this can help you. If you need help tell me – Juan Pablo Pussacq Laborde Mar 28 '16 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.