Tag: web part

Office 365 Advent Calendar – 21 Get all Instances of a Web Part in a SharePoint Online Site



Sometimes you may need to figure out where a specific type of web part has been used. Today, I’ll show you how you can check all pages in your Site Pages library for a specific web part.

I’ve had this code for a while as I was looking for some specific web parts (Content Editor) before. Yesterday, I briefly saw a blog post on dev.office.com announcing the deprecation of the Visio Web Access web part on SharePoint Online (as Visio Online is coming!), though that blog post has disappeared again (I suspect we’ll see it again soon). So I decided to modify it slightly to look for all instances of Visio Web Access web parts and save the results to a CSV file.


The following code checks all pages in the given site’s Site Pages library for instance of the ‘Visio Web Access’ web part. You could easily modify it to loop through all sites in a site collection, or even all sites within your whole tenant.

$cred = Get-Credential
Connect-PnPOnline -Url https://mytenant.sharepoint.com/sites/pagestest -Credentials $cred

$visioWebParts = @()

$ctx = Get-PnPContext
$lists = (Get-PnPWeb).Lists
#Note: I'm not accessing the Site Pages library by URL or title, as I had sites in different languages
$sitePages = $lists.EnsureSitePagesLibrary()

$pages = Get-PnPListItem -List $sitePages[0].Id
foreach($page in $pages) {
	$webparts = Get-PnPWebPart -ServerRelativePageUrl $page.File.ServerRelativeUrl
	foreach($webpart in $webparts) {
		$wpxml = Get-PnPWebPartXml -ServerRelativePageUrl $page.File.ServerRelativeUrl -Identity $webpart.Id
		# The Visio Web Access part is referenced in the XML definition of the web part
		# with type Microsoft.Office.Visio.Server.WebControls.VisioWebAccess. Change this for
		# any other types of web parts you want to find 
		if($wpxml -Match '<type name="Microsoft.Office.Visio.Server.WebControls.VisioWebAccess,') {
			$visioWebParts += New-Object PSObject -Property @{
				'PageUrl' = $page.File.ServerRelativeUrl
				'WebPartTitle' = $webpart.WebPart.Title

$visioWebParts | select PageUrl, WebPartTitle | Export-Csv C:\visio.csv

Updated Release: RSS Feed Web Part for Office 365

Update: SharePoint Online RSS Viewer now supports external feeds


A long overdue update for my RSS Feed Web Part for Office 365. New to the web part? Have a look at the release history:
August 2011
March 2012

What has been changed?

The first change was in the JavaScript code. There were some issues when you were using this web part on a secure site (with SSL), as the call to the Google API was done through a non-secured regular http session instead of https, so that some users got a browser warning. The code now checks if you’re using https (as the E Plans do, for example), and then calls the Google API accordingly:


Secondly, I added some support for debugging (thanks to Peter Reid for this), in case you want to use the source code and modify it yourself:


The third and last change is the addition of an additional stylesheet, that can be used for the Custom CSS Link property of the web part:

To use this stylesheet, modify your target web part’s properties, and change the Custom CSS Link property to <SiteCollectionPath>/Office365RSSWebPartClientSide/WhiteBlue.css (replace <SiteCollectionPath> with the correct URL of your site collection where you deployed the web part to, e.g. /sites/finance ; for the root site collection, simply use /Office365RSSWebPartClientSide/WhiteBlue.css;).


Download the Web Part

Web Part: Office365_RSS_Web_Part.wsp (1091)
Source Code: Office365 RSS Web Part.zip (453)



Updated RSS Feed Web Part for Office 365

Update: SharePoint Online RSS Viewer now supports external feeds


[warning_box]A newer version of the web part is available at Updated Release: RSS Feed Web Part for Office 365[/warning_box]

Back in August, I released a RSS Feed Web Part for Office 365, as the SharePoint RSS feed web part doesn’t work in SharePoint Online. Today I’m releasing a better updated version. Why? What has changed? Where can you get it and how do you install and use it? Read below

Which known errors existed?

People reported that they weren’t able to use the web part with SharePoint Online internal feeds, e.g. the RSS feed of a document library. After I got all the details needed to reproduce that error, I found the source of it quite quickly:

In my web part, I’m using the free jQuery library zRSSFeed, which itself is providing its functionality through using the Google Feed API. It calls this API to receive the feed data in JSON format, which it then parses and outputs. For SharePoint Online RSS feeds this fails, as the Google Feed API naturally can’t accessed secured content. Thus, only public feeds could be used with this first version of the web part!

What has changed in the new version?

Most importantly (the reason for this fix), you can now use SharePoint Online RSS feeds as well! For this to work, I had to modify the zRSSFeed library slightly. If a feed originates from SharePoint Online (identified through the same domain as the one the script is run on, as well as _layouts/listfeed.aspx in the URL), then some custom code is run instead of the zRSSFeed default code that calls the Google Feed API. I simple fetch the RSS data, parse it into a jQuery object, and do the (more or less) same output as the default behaviour.

In addition to that, I added some cleanup code. Whenever the feature is deactivated, the support libraries that are installed as part of this solution are removed. Thus, do not reference these files anywhere else if you aren’t absolutely sure that you won’t deactivate the solution!

Where can I download it?

Get the latest version at Updated Release: RSS Feed Web Part for Office 365

How do I install it?

You can follow the same instruction as in the previous posting. If you have the previous version installed, simply deactivate it first, upload the newer version of the solution, and activate it again.

Is anything else planned?

There’s a good chance I’ll release another update in the coming weeks. I’ve received some feedback regarding some design improvements, if time permits I’ll start working on them soon.


I’ve got some ideas how to improve the web part

As the source is available, feel free to make your own customisations. Alternatively, contact me with any suggestions that you have