Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Identify RSS Feed is Enabled for the SharePoint site using REST API
WhatsApp
Shantha Kumar T
8y
6.2
k
0
0
25
Blog
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"
,
//THE ENDPOINT
method:
"GET"
,
headers: {
"Accept"
:
"application/json; odata=verbose"
},
success:
function
(data) {
//RESULTS HERE!!
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.
// Load the js files and continue to the successHandler
$.getScript(scriptbase +
"SP.RequestExecutor.js"
, execCrossDomainRequest);
// Function to prepare and issue the request to get
// SharePoint data
function
execCrossDomainRequest() {
// Initialize the RequestExecutor with the add-in web URL.
var
executor =
new
SP.RequestExecutor(appweburl);
// Issue the call against the add-in web.
// To get the AllowRssFeeds property using REST we can hit the endpoint:
// appweburl/_api/web?select=AllowRssFeeds&@target=hostweburl
// The response formats the data in the JSON format.
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 to handle the success event.
// Prints the host web's title to the page.
function
successHandler(data) {
var
jsonObject = JSON.parse(data.body)
//jsonObject.d.AllowRssFeeds returns true if enabled otherwise it returns false
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);
}
REST API
RSS Feed
SharePoint
Up Next
Identify QuickLaunch is Enabled for SharePoint Site Using REST API
Ebook Download
View all
Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS
Read by 4.9k people
Download Now!
Learn
View all
Membership not found