Share via


SP.Web.allowRssFeeds Property

Applies to: SharePoint Foundation 2010

Gets a value that specifies whether the site allows RSS feeds.

var value = SP.Web.get_allowRssFeeds(); 

Property Value

Type: Boolean

Applies To

SP.Web Class

Example

The following example creates an input button on an application page that displays a syndication audit results log.

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

    var webCollection;

    function runCode() {
        var clientContext = new SP.ClientContext.get_current();
        if (clientContext != undefined && clientContext != null) {
            var web = clientContext.get_web();
            this.webCollection = web.get_webs();
            clientContext.load(this.webCollection);
            clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
        }
    }

    function onQuerySucceeded() {
        var doc = new ActiveXObject('Msxml2.DOMDocument.3.0');
        var root = doc.appendChild(doc.createElement('SyndicationAuditResults'));
        var webEnumerator = this.webCollection.getEnumerator();
        while (webEnumerator.moveNext()) {
            var subWeb = webEnumerator.get_current();

            var siteName = root.appendChild(doc.createElement('site'));
            siteName.setAttribute('title', subWeb.get_title());

            // Set any other SP.Web properties, such as the title, as attributes of the element.
            //siteName.setAttribute('url', webEnumerator.get_title());   

            var syndicationAudit = siteName.appendChild(doc.createElement('SyndicationResults'));

            var compileSyndicationStatus = '';

            // Use the allowRssFeeds property to determine whether the site allows RSS feeds.
            if (subWeb.get_allowRssFeeds()) {
                compileSyndicationStatus += "RSS Feeds Allowed! | ";
            }
            else {
                compileSyndicationStatus += "RSS Feeds Not Allowed! | ";
            }

            // Use the syndicationEnabled property to test whether the RSS feeds enabled on the site.
            if (subWeb.get_syndicationEnabled()) {
                compileSyndicationStatus += "RSS Syndication Is Enabled!";
            }
            else {
                compileSyndicationStatus += " RSS Syndication Is Not Enabled!";
            }
            syndicationAudit.setAttribute('result', compileSyndicationStatus);
        }
        var str = doc.xml;
        alert('Syndication audit results log: \n\n' + str);
    }

    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    }

</script>

    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />

</asp:Content>

See Also

Reference

SP.Web Methods

SP.Web Properties

SP Namespace