Video on how to Display Comments and Likes in a News Web Part

So there has been questions and problems on how to setup and configure the Content Query Web Part so that it shows news with rollup images, likes and comments. Therefore I decided to make a video and show all the steps. You also find the file package up in the menu, there is a link called “NewsWebPart”.

If you like my videos, please subscribe to my YouTube channel, there will be more videos soon!
Thanks for watching 🙂

Share this blog post:

Custom Display Template for Content Search

I am using the web part “Content Search” to display the news. But I would like to make some modifications to the Display template “Large” that I am using. First, I would like to change the arrows that is used for the paging control. Then the images should be wider and I want another managed property to be displayed in the rollup. To do this, I have to create a copy of the display templates and modify it in an HTML editor.

There are two types of display templates. One that is prefixed with “Control” that controls the layout of the entire web part, like paging controls and such. The other one is prefixed with “Item” and is used to control the items that are rolled up in the web part. These display templates are independent of each other, but since I want to change both the layout of the entire control and each item, then I need to make a copy of these both html files.
Map the following URL to a network drive: http://yourSPserver/_catalogs/masterpage

Then open folder Display Templates > Content Web Parts

Note: Only copy the Control and Item html files,  the .js files are created automatically!

I copied the control file Control_ListWithPaging.html and named it Custom_Control_ListPaging. And then I copied the item Item_LargePicture.html and named it Custom_Item_LargePicture.
Note: Refresh the folder and note that the .js files are created:

Modify the Custom_Control_ListPaging.html
Give the file a proper Title, in this case “Custom List with Paging”:

It will be displayed with that Title in the web part drop down under Display Templates in the web part:

I want to change the Paging icons, because they don’t look very nice:

The css classes needs to be changed inside the Control template, and modify the classes as you wish and refer to it from the new Control template. Might not be the most sexy buttons, but at least they look a bit more like my color theme on the site:

Modify the Custom_Item_LargePicture.html
I want to make images wider and add another third line in the web part so that I can display another field and that has to be done in the Item files. Open the Custom_Item_LargePicture.html and make the following changes:

Change the Title tag to something useful, so that it is displayed correctly in the dropdown list in the web part (same as above with the Control).

In the head, modify the mso:ManagedPropertyMapping: copy this code:

“‘Line 2′{Line 2}:’Description'”

Change it to the below code, you can refer to any managed property you like (in this case Description) but it does not really matter since you can change it in the web part anyway:

“‘Line 3‘{Line 3}:’Description'”

This will add another line in the Property Mappings so that you can display a third line with a managed property in the web part (see “Line 3” below):

Then scroll down to the remarked js code and add a new variable after “Line 2” and name it to “Line3”. That is in the following places in the code::

Then change the markup also, add a new div:

I had to modify the css classes (by adding them to my own css stylesheet so they override the default ones) too to make the rows more aligned, since I added a third line. The result is:

Share this blog post:

Upgrade part 6: Upgrade MySites to SP2013

This is how I upgraded our SP 2010 mysite site collections to SP 2013

Restored a copy of the 2010 database for MySites to my test server
Removed the content db in CA
Detached the db in SQL
Attached the restored copy in SQL
Added the content db in CA

Do an iisreset

Now ready for some test runs…

Test-SPContentDatabase -name MySites -webapplication https://server:3334 | out-file e:upgradeupgrade.txt -width 500

Got some errors about missing webparts or customizations which is fine, I don’t want to use them anymore anyway. Most errors are regarding the office web apps though but none of them is blocking upgrade so I will go ahead:

Category        : MissingFeature
Error           : True
UpgradeBlocking : False
Message         : Database [MySites] has reference(s) to a missing feature: Id = [893627d9-b5ef-482d-a3bf-2a605175ac36], Name = [PowerPoint Mobile Viewer], Description = [Enables viewing of PowerPoint presentations in the mobile web browser], Install Location = [MobilePowerPointViewer].
Remedy          : The feature with Id 893627d9-b5ef-482d-a3bf-2a605175ac36 is referenced in the database [MySites], but is not installed on the current farm. The missing feature may cause upgrade to fail. Please install any solution which contains the feature and restart upgrade if necessary.
When this was done, I just detached the db from SQL, copied it to my new SP2013 server and then it is ready to be migrated.

Did the same on the SP2013, that is remove the content db from the MySites web app. Attach it on the SQL and then in CA again:

But then you cannot add the content db directly from CA, you need to mount it:

Mount-SPContentDatabase “MyDatabase” -DatabaseServer “MyServer” -WebApplication http://server:5230

After mounting I got this message

Yeah I have a look later, I think I know what the error messages is. I had a customized template for the MySites on my 2010 server and that is not included in this upgrade. Will just skip it and proceed.

Made an iisreset

Got access denied when trying to access MySite (the old classic Access Denied message from 2010) as my self:


Signed in as the administrator and that MySite which I could access (so only Admin could access MySites right now)

Got the message about upgrading the site collection so I did that by clicking “Start now” up in ribbon:


After that, I visited my own site again and got the “new” access denied message:

That means that no users can access their MySites. So I decided to upgrade my site collection to see if that fixed the issue. You can run “get-SPSite” in powershell to see a list of what versions the site collection are. All our mysites were in 14, they need to be converted to 15. Run the Upgrade-SPSite command in powershell (of course this must be scripted for all users…):

Upgrade-SPSite http://server:5230/personal/lr00554 -VersionUpgrade

Tried to access my personal MySite again, but still access denied “Site has not been shared with you”

I looked at the Authentication Provider for my MySite web app and that said “Claims based authentication” but maybe all site collections are not included? My last test was to upgrade the authentication for entire web application including all migrated mysite site collections.

In Powershell:
Convert-SpWebApplication -Identity “http://server:5230” -To Claims -RetainPermissions [-Force] 

And TADA, the new MySite is up and accessible!

Share this blog post:

My experience of using Replication

I have used replication between 8 SharePoint server farms for almost a year now. I am usually a very nice and patient person, but now the patience is running out and I feel frustrated and need to write about this so maybe it can help others who are considering replication. And I am being brutally honest (sorry to all you nice people at Metalogix), but I have had it and I want to share my experience!
I used to have a nice job as the only SharePoint employee (a new role for me who always worked as a consultant) in the company, maintaining and developing our intranet in a small server farm. The company I work for is in the seismic industry and we have a fleet where the vessels have a limited amount of bandwidth. They use satellites for bandwidth, and currently they only have a 1 Mb connection. Which is a big challenge for SharePoint, as it is not supported over WAN. Our fleet users of course found our SharePoint intranet very slow (connecting to our server in Dubai), which is understandable on such a low bandwidth. So to solve this, I started to evaluate some replication products, since Microsoft does not have a product or a solution for this. And hey Microsoft, I know the cloud is the new thing ánd that is cool when you have a lot of Mb’s, but what about your users that has limited low bandwidths and MUST have data available if they become offline (which happens quite often at sea)?
Anyhow, I chose Metalogix Replicator because they have been in the business for quite a while, they have similar clients and also their product is built into the CA so we did not need another client to monitor the replication. It seemed to fulfill all our needs also, and with that I mean that we have a very “out of the box” intranet so it should not be complicated to replicate the functionality.
Could have been a success story for us. But the truth is, almost a year later, I barely have any time over to do my regular job because of all the replication issues and we still are not replicating all functionality! My job has become a nightmare, where I have to fix things that the replication has messed up or monitor the package queues to see what has run into “error” or “conflicts”. It was a long time ago I could sit down and have a look at new development projects on the intranet. So why is it like this? Well first the obvious reason, and which is not due to the product (it would be the same with any replication product), is that I now have 8 instead of 1 SharePoint servers (and SQLs) to maintain. I have 8 instead of 1 intranet sites to monitor and all the work that comes with that. But that was expected and OK. I expected that to take maybe 40-50% of my time which should have been fine.
What I did not expect was the constant (I mean almost 100%) need of my time to monitor what the replication has done since I left it. That is, fearing that permissions has been removed or not replicated at all or replicated incorrectly so that sensitive information became visible (luckily I managed to restore permissions FAST before too many users discovered it), site collection features that got deactivated and ruined data from third party products we had installed (and that are critical for the safety on board) which led to a complete RESTORE of a site which took almost 2 days to get back (and unavailable to users of course), all the countless hours of troubleshooting errors and phone meetings with technical support! And also the lack of product support in replicating InfoPath forms. Which is still not solved, although stated to be solved in the last version. The product does not deliver what it promises!
Our intranet is very “out of the box” although it does not look like it, I can do magic without code J So it does not contain any custom code, I have branded it using our own css file, added some jquery stuff, and InfoPath or modified xsl. And also, we have used proper third party web parts that we have bought and used no “homemade” stuff. So I would expect that our functions should be easy and able to replicate. But I was wrong.

I have provided Metalogix with detailed descriptions of the errors both in replication of permissions, workflows and InfoPath replication. Their product manager have interviewed me to hear my opinion on the UI and I had a lot of improvement suggestions after having using it for half a year. But despite that, our problems are still there and I have been very patient but I can feel it running out now and it is getting really annoying instead. It is taking TOO much of my daily work and the users are annoyed that they STILL need to surf into our local office server to be able to fill in their Reimbursement forms etc (not to mention the confusion as they have to surf into ANOTHER url to do some stuff). I had hoped all this could be available on board when the replication was installed, which is almost a year ago now. I do understand that our third party web parts cannot be replicated, that is fine but COME ON! – forms using Data Connections which is by design in InfoPath? Lists with customized forms are not replicated in full (the ifs files are missing)? Permissions with only SP groups and AD groups in them? Workflow that sends repeated mails from the same form to users so they are SPAMMED and mail me in desperation to stop the replication, because it loops the packages and constantly “updates” the list items (when they are in fact NOT updated, just sent back and forth between the servers) but makes the workflow engine think they are updated items? List/document items with versioning enabled generates so many packages that I need to disable the replicator and it takes forever to clear the queues?

What I wonder is: where are all the other replication customers and their demands/problems? They must have the same issues as us? I seriously doubt that we are alone in this. And I can’t help but feel that I am contributing to the development of their product and usually I love to contribute with that to a company that listens, but this feels like BASIC product functionality that is already promised to be there. And it has cost us a LOT of troubleshooting and valuable time and dissatisfied users.

And not only the time at work… all my sleepless nights when I worry about this shit, afraid that users can see what they shouldn’t and the weekends I have had to spend solving things in panic or with a restore, instead of relaxing. All the hours where I have had to add back lost functionality, over and over!

Yes, there are good sides of Replicator also of course. It works really well for simple lists, pages, images and documents, (unless you use versioning, which can lead into endless loops where the package queues are so huge that you have to disable replication to be able to delete the hundreds or thousands packages that a FEW changes made in a list!), and it transfers the packages fast and at its smallest amount of data. Also I like the simple UI, and that it is integrated into CA.

And the people working at Metalogix are great and tries to help in all way, and I feel that they really take our problems seriously. But that does not help my frustration unfortunately, and they don’t seem to test real life scenarios since they obviously not had tested an InfoPath form that has Data Connections, and that is often the reason why you use IP in the first place, otherwise you could just use the simple lists.

So to conclude – using Replicator for simple, not customized, things works absolutely fine and it is indeed instant! But if you have an intranet with InfoPath forms using DC’s, unique permissions, workflows, versioning etc then you might run into the same problems as we have and I would not recommend replication until all these issues are solved. We are using version 6 which is the latest version.
I hope with this article that I might find someone out there who is also using Replication (any products). Because when you google stuff about replication, you rarely find anything useful. It would be great to get some feedback and stories from others about this!
Share this blog post:

Upgrade to SP2013, part 5: Setup the User Profile Service Application

One thing that is introduced (or has come back actually) in SP2013 is: AD import. The big benefit of using ADI is that it is fast and easy to setup. Also, the filters are ready so you can just check a box to filter out disabled accounts!! Great! Not much can go wrong there.

But, if you want to fully use the UPS and maybe import extra attributes from the AD like user profile pictures, employee information etc then you must setup the User Profile Synchronization import. And I want to do that, especially import the photos, since I have a profile picture of the user up in the right corner of our intranet. This means a bit more work, but it is still quite easy to configure and setup:

Start with creating the User Profile Service Application in “Manage service applications” and map it to a new application pool (which I add the farm account to). You need to have that user in the local admin group on your server also. And yes, you will have a message about this in the Health Analyzer but just ignore that.

When that is done, go to the Services on Server and launch the two services “User Profile Service” and “User Profile Synchronization Service”. Enter the farm admin password on the page where you launch the second service. Now the last one will take some time to start, just leave it for 5-10 minutes and it will be started. One important thing I learned at the SPEVO13 conference, at a session by Spencer Harbar, was that the field where you enter the farm account password is actually not validated so if you enter an incorrect password there you might run into the famous “hang” when starting this service. So be sure you enter the correct password! I tried it and it does hang AND it did lockout my account until it finally stopped trying (new account policy for some admin accounts at my company) but it really does not tell you that the password is incorrect when you press OK on this page. Bad!!

Anyway, when you have the services started like this you can make an IISRESET:

I always do that, because I know this can give you errors or trouble otherwise when you want to create the AD connection and I am always better safe than sorry.

Now, go back to your User Profile service application and make sure the “Configure synchronization settings” are set to “Use SharePoint Profile Synchronization” and (optional) deselect the “Include existing BCS Connections for synchronization” for now since we don’t use that yet.

To setup the connection to your AD, go to “Configure synchronization connections”. When that is done, we need to setup the connection filters, in the most complicated and non logical way you can think of… to filter out the disabled accounts. Do this:
On your new AD connection, hover it and select “Connection filters”:

Make sure you have the “All apply (AND)” checked
Select “userAccountControl” in the list and wait for it to update the page!
Select operator “Bit on equals” and set the Filter to “2”
Click on “Add”:

If this is enough filters, just click OK to apply.

Now go back to your User Profile Service Application using the breadcrumb…. Hahaha NOT. Spencer made that joke at the SPEVO conference, not sure how many got that… I was laughing anyway!

So go all the way back to your UPS and start the synchronization, and yes it has to be a Full the first time.

Optional: before you start the import you can import some extra attributes from the AD. I want to add the user profile pictures:

Go to the “Manage User properties” and find the one called Picture. Change the settings to “Do not allow users to edit” if you don’t want your users to upload their own pictures (can result in everything from pics of cats, beers, strange positions etc if you allow this!) and then select the “thumbnailPhoto” from the attributes list. “Direction” should be “import” and click on Add:


Now start the full import and the time it takes to import of course depends on how many users you import and how many extra attributes. For me it took about 7 minutes to import 1700 users.

One last thing I do, is to select the User Profiles service app (go to “Manage service applications” view), select the UPS and click on “Administrators”. I add the Search account and set it to “Retrieve People Data for Search Crawlers” so I know that the People search will work also.

Share this blog post:

An error occurred while verifying virtual directories on target

This is not an error in the Replication tool, but it caused the replication to stop working.

One day the replication on one of our servers stopped working. Inbound packages were just stuck in the queue, and when I tested the replication connection I got this message:

“An error occurred while verifying virtual directories on target”:

So I looked in the log files for the replication tool and found this error:

This started a journey of troubleshooting. First I did the standard things:
– ping all possible connections that I could think of that the server would take
– restarted the replication services
– iisreset
– disabled and enabled the replication on the web application
– restarted services again
– rebooted the server to make sure that no stupid updates or anything had made some changes
– checked the proxy settings (there had been a proxy change on all servers) and they were fine
– ran the replication configuration wizard (several times)
– ran the SharePoint configuration wizard (in case some update had made changes, farsighted but you are getting desperate…)

Everything looked just fine but still nothing was working.

When none of these steps work, that is always an indicator that something serious is going on.
I ended up re installing the replication software. But no luck.

The vendor had a look at this, my infrastructure collegues checked that all connections between the servers were working and nothing was blocking anything.

Turns out that there was a setting in registry that pointed to the old proxy IP and it was the farm account that had that setting in the browser. So when that was removed, it all started working again!
So a manual proxy configuration, pointing to an old IP address was the root cause to all this. As soon as that was removed, replication was running fine again.

Share this blog post:

SQL disks running out of space due to Recovery model set to Full

Since we started using the Replication software our SQL disks has filled up quite quickly. Of course we usually have alert systems warning us for disks running out of space but due to new system that had not yet been setup. So one day I could not get replication to work on one of our servers, all packages ran into Error and I could not change anything on the site without getting strange error messages. Looked in the Health Analyzer in Central Administration and found this error:

“Drives used for SQL databases are running out of free space”

And the disk space on that SQL server was of course full, so we had to first expand the disk with an extra 100 GB so that everything started working again. But that is only temporary panic solution 🙂 We also got these messages from the backup:

“Database XXX is configured to maintain transaction logs. Transaction log backups are not being performed. This will result in the log growing to fill all available disk space. Regular log backups should be scheduled or the database should be changed to the simple recovery mode.”

So I changed the Recovery model on the SQL db’s that were listed in that mail, from Full to Simple.


We run daily SQL backups so I believe that Simple recovery model is enough. If I need to restore a site (which is the most common restore scenario, since the Recycle bin was introduced in MOSS I have never had to make a restore for a single document). But I have at least a restore from one day back in history and that has never been a problem for us in restore scenarios. The difference between Full and Simple: to be able to go back to a specific time of failure, which can be done in Full mode.

Recommendation on Technet after switching to Simple recovery model:

Discontinue any scheduled jobs for backing up the transaction log.
Ensure periodic database backups are scheduled. Backing up your database is essential both to protect your data and to truncate the inactive portion of the transaction log.

I found a good explanation of Simple Recovery Model on MSSQL site:

The “Simple” recovery model is the most basic recovery model for SQL Server. Every transaction is still written to the transaction log, but once the transaction is complete and the data has been written to the data file the space that was used in the transaction log file is now re-usable by new transactions. Since this space is reused there is not the ability to do a point in time recovery, therefore the most recent restore point will either be the complete backup or the latest differential backup that was completed. Also, since the space in the transaction log can be reused, the transaction log will not grow forever as was mentioned in the “Full” recovery model.

NOTE: The recommended model would of course be to have a Full recovery model, since you can go back to the single point of failure time, but for us the Simple mode has been enough.

I look forward to hear what others think of this recovery model and if you have other recommended settings that helps running out of disk space đź™‚

Share this blog post:

MOSS MA not found

I got this error when I clicked on “Create new connection” in the User Profile Services App, to setup a new connection to the AD. If you get it, just restart the User Profile Synchronization Services under “Services on Server” in CA.

Share this blog post:

Customize the workflow mail

I have a workflow that sends a mail to the users when ever a list item is edited and a specific field is updated. I don’t want the users to access the list, so I built a simple workflow to send a mail to them instead.
The challenge is to make the mail look like it does in the list item and with some extra branding added. To make this happen you need to add the HTML code in a very specific way, otherwise it will look like crap and the HTML code will be visible in the mail.

Add the “Send an email” action in the workflow
Click on “Advanced properties” in the ribbon, or hover the action and click on “Properties”:

In there, click on the .. button on the Body row:

Now comes the important part: if you want to add your own css classes in a style tag, you need to remove ALL space in that style tag, otherwise they will be displayed in the mail and css is not incorporated. Like this:

You can have a space before the next .class, that works, but all other spaces needs to be removed.
Then just copy and paste the rest of the HTML code into the body and it should work fine.

Share this blog post: