How to find which list an email address is tied to?
-
01-01-2021 - |
Question
I have an email address I want to use to email enable a discussion. SharePoint says the email address is already in use. How do I find what list/document library this email is tied to?
La solution
I cobbled together some javascript using SPServices and JQuery that runs through all sites and subsites in a site collection, listing everything that has an external email. Once you get a list object you're looking for something in property "EmailAlias" - that's the address.
function getAllEmails(url) {
siteList = "<table><tr style='background-color: #78FF78'><td class='fmgTD'><b>Site</b></td><td class='fmgTD'><b>List</b></td><td class='fmgTD'><b>Email Address</b></td></tr>";
getSiteLists(url, "Home");
$().SPServices({
operation: "GetWebCollection",
webURL: url,
async: false,
completefunc: function(xData, status) {
// alert(xData.responseText);
$(xData.responseXML).find("Web").each(function() {
getSiteLists($(this).attr("Url"),$(this).attr("Title"));
url = $(this).attr("Url");
getSubSites(url);
});
}
});
siteList += "</table>";
$('#fmgSites').append(siteList);
}
function getSiteLists(weburl ,webtitle) {
$().SPServices({
operation: "GetListCollection",
webURL: weburl,
async: false,
completefunc: function(xData, status) {
var count = 0;
$(xData.responseXML).find("List").each(function() {
if($(this).attr("EmailAlias") && $(this).attr("EmailAlias").substr(0,13) != 'recordscenter'){
if(count == 0) {
siteList += "<tr><td class='fmgTD'>" + webtitle + "</td>";
} else {
siteList += "<tr><td class='fmgTD'> </td>";
}
count++;
siteList += "<td class='fmgTD'>" + $(this).attr("Title") + "</td><td class='fmgTD'><b>" +$(this).attr("EmailAlias") + "</b>@YOURSITEEMAILADDRESS</td></tr>";
}
});
}
});
}
function getSubSites(weburl) {
$().SPServices({
operation: "GetWebCollection",
webURL: weburl,
async: false,
completefunc: function(xData, status) {
// alert(xData.responseText);
$(xData.responseXML).find("Web").each(function() {
// now get all ists for this web
getSiteLists($(this).attr("Url"),$(this).attr("Title") );
getSubSites($(this).attr("Url"));
});
}
});
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange