SharePoint REST API to get Discussion List Questions and Replies separately

To get the list of questions from a SP 2013+ Distribution list using OOTB REST API:

_api/lists/getByTitle(‘listname‘)/items?$filter=ContentType eq ‘Discussion’


/_api/lists/getByTitle(‘listname‘)/items?$filter=FSObjType eq 1

To get the list of replies from a SP 2013+ Distribution list, using OOTB REST API:

_api/lists/getByTitle(‘listname‘)/items?$filter=ContentType eq ‘Message’


/_api/lists/getByTitle(‘listname‘)/items?$filter=FSObjType eq 0

To get the list of Discussions with the replies count from a SP 2013+ Distribution list, using OOTB REST API:

/_api/lists/getByTitle(‘listname‘)/items?$select=ID,Title,Body,Folder/ItemCount &$expand=Folder/ItemCount &$filter=ContentType eq ‘Discussion’

Microsoft.SharePoint.SPException: Schema version of backup 15.0.xxxx.xxxx does not match current schema version 15.0.yyyy.yyyy

Microsoft.SharePoint.SPException: Schema version of backup 15.0.xxxx.xxxx does not match current schema version 15.0.yyyy.yyyy

A common error that you might face while doing site collection backups and restore is the following error:

Could not deserialize site from E:\SiteCollection1.bak . Microsoft.SharePoint.SPException: Schema version of backup 15.0.4641.1000 does not match current schema version 15.0.4719.1000     at Microsoft.SharePoint.SPSite.Restore(String filename, Boolean isADMode, Boolean& readOnlyMode, Boolean& hadWriteLock)

Note: You can capture this error in your ULS logs or use ULSViewer, when you run the Restore-SPSite command through SharePoint Management Console


#1: CU Update– The best & recommended fix is to ensure that you match the SharePoint Configuration Database versions to match both the environments (Goto Central Admin –> System Settings –> Manage Servers in this Farm)

In the same page, double check that you do not see any “Upgrade Required” mentioned against any of those servers. If it is mentioned there, please ensure that you run the SP Config Wizard before you proceed.

Once things look good, and you have compared the versions, download the latest KB from Microsoft and install them to match the SharePoint Configuration Database Schema versions. Perform all server remediation & CU (Cumulative Updates) installations. Remember to run the Configuration Wizards for each CU.

#2: Using STSADM – This is a pretty interesting workaround. But sometimes I feel “Old is Gold”. Power up your SP Management Console and try to perform the restore operation using the good old STSADM command line. At times, when the new powershell commands fails, stsadm has always worked for me. [[Touchwood]]

stsadm –o restore –url “site url” -filename “backup filename

#3: DB Restore – Content Database Backup and restore. You might want to check in Central Admin (View All Site Collections –> Select the Site Collection and check the Content DB on which it is installed on) about which all site collections will get affected if you restore a particular Content DB.

#4: Editing Backup File – This is one of those quick and untidy fixes you could possibly try. There are few caveats to keep in mind before you try this fix:

  • Ensure that the backup file size is smaller (preferably less than 500MB), else you might need a good editor (Visual Studio 2013 would crash beyond 500MB)
  • Keep note of the version number of the SharePoint Configuration Database Schema of the server to which you wish to restore the backup
  • Ensure that there are no major version differences in between the environment version. You can analyze this by going through the release notes of the higher version and see if there are no DB schema changes. Security updates/minor patches should be fine. But if you see any major DB schema changes in the release notes, please avoid this fix.
  • Success of this approach is not guaranteed. You may or may not crash the site collection that you will be restoring the backup to or may even corrupt the backup
  • Please take a backup of the backup file

The fix is pretty straightforward. You can open the backup file in Visual Studio or any Disassembler softwares and change the version number mentioned in the beginning of the file to that of the SharePoint Configuration Database Schema of your restoring environment. Those who have cracked software’s in the golden days could use one of their handy tools to edit the file as well.

Editing the version number part of the backup file manually.

Save the file and then try out the “Restore-SPSite” command this time. If things look good, you might succeed in restoring the backup without the version mismatch error…:)

Note: If your file size is in the range of GBs, as in case of one of my backups (2GB), try to split the large file into small 100MB files using file splitting tools like  GSplit tool –> Then edit the First split file in Notepad++/Visual Studio –> Change the schema version number –> Reunite the files using combining tools like GUnite (comes with the GSplit tool itself) and then use the reunited backup file in the STSADM restore command. Use this approach only when you are in a state where Desperate times calls for desperate measures…:X

Once again! Use the Fix #4 with caution and only under extreme cases.

Having multiple JSLink based webparts on the same page, overrides all the other templates in SP 2013


Create a dashboard page in SP 2013, displaying just 3 lists in 3 different views using Js Link capability. The 3 lists are:

  1. Accordion: A list containing title and description which will be displayed on the dashboard with an accordion functionality with title being the accordion item heading and description being the accordion item body.
  2. Menu: A list containing entries that can be used to construct a mega menu or a navigation menu.
  3. Alert: A list containing entries whose Body contents are lengthy and hence have to be trimmed down and ellipsis (…) added to the lengthy ones

The dashboard page was created and all the 3 list view webparts were added to it. All of them were given 3 different JsLink with different namespaces and method names. Each js had their template methods that rendered the list in the desired views and functionalities. ex. the accordion template method just returned “<h2>{Title}</h2><p>{Description}</p>” and an OnPostRender jQuery script to toggle them on <h2> click.


Loaded the Alert list first on the fresh page–> No issue; trimming the body content worked perfectly


Loaded the Accordion list next –> No issue; slide up and down of the accordion worked perfectly

Loaded the Menu list next –> Boom! The accordion lost its Js Link functionality and started behaving like the menu displaying items using the template defined for the Menu list.


Attached below are the 3 JsLink files used:

AlertsAccordion | Menu

Feel free to test it out…

If the JS Links had different namespaces & methods, why would it overwrite all the other templates on the same page? Could it be by design? By changing the BaseViewID, i could get the Accordion working but the menu then started taking the accordions template behavior…:(

Finally, I ended up having a single Js Link file (added as JS Link to all the webparts on the page) having the same template method, but internally it loaded different templates for each webpart by doing an <if> condition check for the List Name.
ex. if (ctx.ListName==’Accordion’) return “<h2>{Title}</h2>…”; if (ctx.ListName==’Menu’) return ‘<ul><li>{Tite}</li></ul>’; etc…

But somehow you will feel something is not right when you code it. Having a bulky js method with If-else or switch-cases…:(


Paul Hunt (@Cimares) has the solution for this scenario wonderfully detailed out here.This solution works and you can do an IF condition check to load the templates corresponding to each webpart accordingly.

I still wish if i could use independent JS Link files for all the webparts on the dashboard…:(…But, all in all JSLink is wonderful and I am happy to see MS taking the client side route and would love to support them in this direction…:)

Feel free to post your comments or possible alternatives or solutions.

JSLink SharePoint 2013 troubleshooting

JsLink is a good feature that was introduced in SP 2013 to allow users to bring in more flexibility in Client Side Rendering (CSR). With this you can control how your list data is getting displayed in View, Display, Edit and New forms.

For ex., you can achieve this using JSLink:



You can check the implementation here: JSLink Custom JS Rendering Tutorial


The JS Link was still not working and the list view remained the same.


Check the URL you defined in your JSLink webpart property (under Miscellaneous). You need to define the URL as: ~site/Site Assets/xyz.js” instead of defining the absolute or relative URL of your js file. It should always begin with a given set of URL tokens and then your file path. JsLink URL can begin with either of the following URL tokens: ~site, ~sitecollection, ~layouts, ~sitecollectionlayouts or ~sitelayouts only. Absolute paths will break the JsLink functionality.


MDS (Minimal Download Strategy) strategy having issues. Try using RegisterModuleInit(“{file URL}”, MyJsMethod); to register the JSLink. Check this link.

Also, as a best practice, its recommended to specify the SharePoint CSR filename in the JS Link URL.

ex. The JSLink URL for Tile View in Promoted Links would look like:

sp.ui.tileview.js | ~site/SiteAssets/xyz.js

Display Project Server 2013 Excel Reports in your SharePoint Site

This post is in continuation to my previous post on Building Excel reports from Project Server 2013 OData Services.

Now that you have your Excel Report and started being innovative in building jazzy reports and dashboard, you might want to display it on your homepage so that you could get the snapshot of everything when you login online.

The only requirement for this is to ensure that you have “Excel Web App” installed and the required features enabled.

Step 1: Upload your excel reports to a Document library and open it. This will open up the Excel report in a WOPIFrame page, with the URL as:

Office Subscription Screenshot Excel Web App




Step 2: Copy the above URL to your clipboard.

Step 3: Edit your Project Site, add a Page Viewer webpart and set the type as “WebPage” and “URL” as the one copied from step 1.

Outcome: The outcome will be something like this



Hope this helps!!


Building Excel reports from Project Server 2013 OData Services

This is quick walkthrough to showcase how you could build powerful reports from Project Server data online, in a jiffy.

I am using the Project Online Subscription from Office 365. However, this should work with your on-premise Project Server 2013 setup as well. So no worries…Interestingly this technique can be extended to any other data source…let’s say getting all your bug reports from Team Foundation Server to Excel, getting the Northwind Products table from an OData source online etc.

Without much adieu let me start… just 3 Steps

Step 1: Copy the OData Connection file URL from Project Online, under Data Connections library in the ProjectBICenter. You can find it in the following URL:



Not able to get here?

Navigate to your “pwa” home page (http://servername/sites/pwa) and click on “Reports” in the left navigation. It will take you to the ProjectBICenter site with the URL as (/ProjectBICenter/Pages/Default.aspx). Then click on “Reports” link on the left navigation in the ProjectBICenter site. You should reach the above place.

Step 2: Open new Excel Workbook and select “Existing Connections” from “Data” ribbonClick “Browse for More” button at the bottom left corner paste the above copied URL in the “Filenamesection and press Open.


Step 3: Select “OK” to view the data as a table


Final Outcome: Entire Project Online data is available to you in excel for data crunching. Also, data is constantly in sync with online.


To synchronize data with Project Online: Select “Refresh All” under the “Data” ribbon


Well you got through the hard part now…rest all i probably would leave to a good excel data cruncher to build charts, pivots, power views, KPIs and other dashboards out of this rich data.

If you see any missing columns, that’s probably coz they are not pulled as a part of your OData URL. If that’s the case, go back to Step 1 and then check the OData URL…add the column names you want (use your SharePoint skills to get the exact column name). For further tweaking the OData URL and its query options, you can visit and learn more…

In the upcoming posts, i shall show you how to display this on your Project Site in a webpart.

Feel free to post your comments, if you need any assistance.

Hope this was useful!!