Syntax
REST API Endpoint:
https://SharePointSiteURL/_api/web?$select=AllowRssFeeds
REST API endpoint to use in Add_ins:
<appweburl>/_api/SP.AppContextSite(@target)/web?$select=AllowRssFeeds&@target=<hostweburl>
Embed Code Snippet:
The following code snippet can be embedded in SharePoint page or in content editor web part as a script. This exampleis used to get the allowed rss feed's property of a SharePoint website.
- <script type="text/javascript" src="/SiteAssets/Scripts/jquery.min.js"></script>
-
- <script type="text/javascript">
- $.ajax({
- url: _spPageContextInfo.webAbsoluteUrl+"/_api/web?$select=allowrssfeeds",
- method: "GET",
- headers: { "Accept": "application/json; odata=verbose" },
- success: function (data) {
-
- console.log(data.d.AllowRssFeeds)
- if(data.d.AllowRssFeeds)
- alert('Rss feeds enabled on this site.');
- else
- alert('Rss feeds disabled on this site.');
- }
- });
- </script>
Add-in Code Snippet:
The following code snippet is used in SharePoint Add-in to get the allow rss feed property of a SharePoint web.
-
- $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest);
-
-
-
- function execCrossDomainRequest() {
-
-
- var executor = new SP.RequestExecutor(appweburl);
-
-
-
-
-
- executor.executeAsync(
- {
- url: appweburl + "/_api/SP.AppContextSite(@target)/web?$select=AllowRssFeeds&@target='" + hostweburl + "'",
- method: "GET",
- headers: {
- "Accept": "application/json; odata=verbose"
- },
- success: successHandler,
- error: errorHandler
- }
- );
- }
-
-
-
- function successHandler(data) {
- var jsonObject = JSON.parse(data.body)
-
- console.log('Rss feeeds Enabled on this site: ' + jsonObject.d.AllowRssFeeds);
- if(jsonObject.d.AllowRssFeeds)
- $('#message').html('Rss feeds enabled on this site.');
- else
- $('#message').html('Rss feeds disabled on this site.');
-
- }
-
- function errorHandler(data, errorCode, errorMessage) {
- console.log("Could not complete cross-domain call: " + errorMessage);
- }