¿Cómo listar las alertas de usuario en una lista en SharePoint con c#?

El objetivo es lista para una lista específica las alertas de diferentes usuarios.

En este ejemplo, a modo de prueba, he configurado una alerta sobre la lista Hitos:
El siguiente código permite listar los usuarios con alertas sobre Hitos:
        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;
        }
El resultado:

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *