Skip to content

Instantly share code, notes, and snippets.

View devangbhavsar89's full-sized avatar
🎯
If you want to shine like the sun, first burn like the sun.

Devang Bhavsar devangbhavsar89

🎯
If you want to shine like the sun, first burn like the sun.
  • Helsinki, Finland
View GitHub Profile
@devangbhavsar89
devangbhavsar89 / rss-reader-web-part-using-rss-parser.js
Created March 28, 2019 14:57
Extending RssReaderWebPart SPFx web part to use 'rss-parser' module to render RSS feeds.
// Step-1: Add 'rss-parser' module as a dependency to package.json and import it inside RssReaderWebPart.ts file
import Parser from 'rss-parser';
export default class RssReaderWebPart extends BaseClientSideWebPart<IRssReaderWebPartProps> {
// Step-2: Add a new private loadRSSFeedAsync() method inside RssReaderWebPart class of RssReaderWebPart.ts file
private loadRSSFeedAsync(): void {
(async (properties, domElement) => {
const parser = new Parser();
// Note: some RSS feeds can't be loaded in the browser due to CORS security.
// To get around this, you can use a proxy.
# Configuration Parameters (TODO: replace <token> placeholders with actual values before executing...)
$siteUrl = "https://<contoso>.sharepoint.com/sites/<contoso-electronics>"
$userName = "<adm-devang.bhavsar>@<contoso>.onmicrosoft.com"
$password = "<MySecretPassw0rd!>"
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName, $securePassword
# Establish connection with -ReturnConnection parameter
$connection = Connect-PnPOnline -Url $siteUrl -Credential $credentials -ReturnConnection