Код ниже работает, если вы знаете семейство сайтов из списка.Если вы этого не знаете, вы можете легко изменить код для зацикливания всего веб-приложения (или даже целой фермы):
using System;
using Microsoft.SharePoint;
namespace FindListByEmail
{
class Program
{
static void Main(string[] args)
{
string siteUrl = "[complete this]";
string email = "[complete this]"; // only the part before the @
using (SPSite site = new SPSite(siteUrl))
{
foreach (SPWeb web in site.AllWebs)
{
try
{
foreach (SPList list in web.Lists)
{
if (list.CanReceiveEmail)
{
if (list.EmailAlias != null && list.EmailAlias.Equals(email, StringComparison.InvariantCultureIgnoreCase))
{
Console.WriteLine("The email belongs to list {0} in web {1}", list.Title, web.Url);
Console.ReadLine();
return;
}
}
}
}
finally
{
if (web != null)
{
web.Dispose();
}
}
}
}
}
}
}