1

I am trying to figure out how to get a count of the users that have signed up for alerts on a 2013 Blog site. The issue is that I do not have access to the server to run PowerShell and do not have a user/pw to run SQL queries against the database.

Does anyone know of a programmatic way using JavaScript or jQuery to access the list provided at _layouts/15/sitesubs.aspx and then step through the list to get a count? It needs to be similar to a hit counter. (In fact will be shown underneath a hit counter for the page as a # of Subscriptions.)

I have tried looking for anything I could for over 2 days of solid research and nothing I have tried has worked at all.

Thanks!

1 Answer 1

0

I have found the answer to my question after much searching and doing some development.

First you have to build an iframe to the /_layouts/15/sitesubs.aspx page. Then you need to write a javascript to call the iframe's id and the id of the specific "select" function id. (Code sample below)

Thanks for looking. Also, please note, only those who have admin access will be able to view the results so I have added an additional if statement to clear out the div from view if the user cannot view the sitesubs page.

<style> #iframe1 { width: 200px; height: 200px; overflow: scroll; display: none; }

#iframeCountDisplay { margin-top: 2px; margin-bottom: 6px; background-color: #B0E2FF; } </style>

<iframe src="https://URL/SiteCollection/SiteName/_layouts/15/sitesubs.aspx" id="iframe1" name="iframe1"> </iframe>

<div id="iframeCountDisplay" style="width: 45%; color: gray;">Checking Permissions...</div>

<script type="text/javascript" language="javascript"> setTimeout(function() { if (document.getElementById('iframe1').contentDocument.getElementById('ctl00_PlaceHolderMain_DdlUserName')) { document.getElementById('iframeCountDisplay').innerHTML = "Loading..."; var subCount = "Subscriber Count:" var howMany = document.getElementById('iframe1').contentDocument.getElementById('ctl00_PlaceHolderMain_DdlUserName').length -1; document.getElementById('iframeCountDisplay').style.width = "41%"; document.getElementById('iframeCountDisplay').style.color = "black"; document.getElementById('iframeCountDisplay').innerHTML = subCount + " " + howMany; } if (document.getElementById('iframe1').contentDocument.getElementById('ms-error-body')) { document.getElementById('iframeCountDisplay').style.display = "none"; } }, 2000); </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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