SharePoint 2013 Overlay Events to be Opened on Popup


 Yesterday we got a customer request that asked us to make all events on SharePoint calendar list to be opened on popup instead of open it on a new page

 We simply go to list setting and change dialog setting from list’s advanced settings. However this is doesn’t work for overlay events and continued to open it on a new tab Continue reading

Show SharePoint User Profile Image Without My-site Login


 Assume that you have a team site in the following URL and you have my-site web application at the following URL

 When you open your team site at without login to my-site, all users’ profile images will be shown as a cracked images until you logged into my-site web application or the windows authentication will be requested twice for the same reason. Continue reading

Use Signalr with SharePoint Webparts


Update 1: Download sample source code at!Ao7Q-78sQy60gcdrmHFyndmR_HWEMQ

Last month I got a task to make Signalr working on SharePoint environment. As all developers used to do on starting new tasks, I started my task with a search on Google to know how people made this task. I have found a lot of blogs speaks about that , however I didn’t get my answer as all people use SharePoint App-part in doing such scenario but no one made it on SharePoint web-part

It is totally different scenarios to use Signalr in app-part and web-part. App part simply is a separated ASP.NET and you can easily configure it away from SharePoint environment. To use Signalr in web-part or SharePoint user control you have to make extra configurations for Signalr and OWIN that are configured by default on ASP.NET web application. This made me deep dive into Signalr and OWIN architecture and make it work on SharePoint

Continue reading

Necessary of SharePoint Specific Antivirus Product


To ensure your website is secure from viruses and other malicious files, you must install an effective antivirus product. Malicious files could be uploaded via any missing validation on upload file controls or any other Vulnerability.

All antivirus monitor the hard disk and scan files periodically for any changes then alert you about these viruses. This is a good idea to make your website files safe, but what if your website saves the uploaded files into database? The answer is antivirus has no control on these files and you can’t detect you have a malicious files on you website

SharePoint saves contents including files into content database so you need to install SharePoint specific antivirus product that scan the files before saving it into the content database. Microsoft Forefront has such plugin that protect your SharePoint farm against malicious files. Continue reading

Add New SharePoint Rich Content Editor Styles


All of us as a developers face a problem of misuse of the rich content editor that makes SharePoint site content looks very bad.

We always blame SharePoint power users (Content Editors) because we think that they must add a new content in a right way that make their content fits well with the whole site look and feel. On the other hand power users is not a web developer they don’t know about HTML and how to use it.

To eliminate this gab between developers and power users, it is good idea to provide them with a predefined custom styles to be used in editing content. To do this follow the following steps:

  1. Add a new CSS file or use any one referenced by that site
  2. Add new CSS class with the same conventions of the SharePoint Content Editor
  3. Save your file and open the SharePoint Content Editor to make sure your new style is their

Continue reading

Service Locator Pattern In C#


Have you ever use ASP.NET membership provider? All ASP.NET developers know what is the membership and what is the membership provider. They can easily use one of the providers shipped with .NET framework, they can use a provider shipped with a certain product or they can build their own provider. The behind scene for this functionality is a design pattern called Service Locator. Service Locator Design Pattern is a very useful design pattern to make your software extensible and maintainable. Actually  there are many benefits push you to use this approach especially on the big systems as you can separate any part (Service) of your system and test it, re-implement it and deploy it without affect other running parts of the system because of the loosely-coupled relationship between Application and Service Implementation. We can summarize some its benefits as following:

  1. Perform unit-test in a easier way even on the production servers
  2. Make your Application extensible by a third parties
  3. Maintain your Application in a easier way
  4. Provide your customer by updates and hot-fixes that can be deployed without a complete new build

Continue reading

SharePoint Logging Mechanism


 Logging useful information, Events and Exception is a core value for all software applications. Imagine that on a real world there are one organization used to log every information within a defined business process for reporting and another one leverage ad-hoc process which allow employees to deal with situations without any defined procedures for reporting to higher management. In the first style, management can monitor and improve its weaknesses by defining their weaknesses and failure points flagged by continuous monitoring  and back to the causes of these weaknesses. On the other side the second style, management never improve its weaknesses simply because they never know what are their weaknesses, when one weakness eventually is raised they couldn’t treat it although it might cost organization lot of money and loose customer trust.

 Software Applications are similar to organizations no one can know what happen inside it unless there is a rich dashboard to monitor its performance. In a software application system administrators are the top management of the product and the dashboard is the tools that help them to  monitor and define weaknesses and failure points.

 SharePoint has a very efficient technique to provide system administrator with the required information to monitor the system and provide developers with tracing information to use in solving issues. Developers also can use the SharePoint Logging System in their own customized  solution to provide system administrators a greet vision of monitoring and tracing. In this post we will speak on a brief about structure and how to use SharePoint logging System. Continue reading

Compare Content Types in SharePoint List


Did you try to get a content type attached to list by its Id? for example you need to add a condition if a list item is Folder content type

I tried, it was simple but tricky because it seems to have a new ID inherited from the original content type so you must get the item content type first then compare its Parent with the Content type you need.

Here is an example to know if the current item is Folder content type or not (Folder content type has Id = 0x0120) :

If you use the following code it will give false although the content type is folder type

item.ContentType.Id == new SPContentTypeId(“0x0120”)

you have to use the following code to make it work

item.ContentType.Id.Parent == new SPContentTypeId(“0x0120”)

Create People Search Page on Your SharePoint Web


SharePoint 2010 provide a people search as an out of box feature but you will not find a people search result page on your created site. You must create a new site collection based on Search Center template to find this page.

My problem was I need  people search results page on my current site to avoid redirect the user  to another site collection

The solution was so simple:

1 – Activate the ShrarePoint Server Enterprise Site Collection feature found on the site features

2 – Add People Search Core Results Web Part found in search category

3- Add a text box and button to redirect to this page with query string “k” which take the value of the your search ex(?k=Mohamed)

Get a Localized String From SharePoint Application Resources


At the begging of any SharePoint I used to configure our project to deploy a resources files to APP_GlobalResources folder of our application virtual directory used by IIS.

You can’t simply do this using visual studio. You can do a lot of workarounds to make this work for you because visual studio don’t allow you to deploy resources files directly to APP_GlobalResources, it allows you only to deploy these files to application resources which found on 14 hive\Resources.

There is no problem where to deploy it but I have to add it to APP_GlobalResources to use it like the same way I use it in ASP.NET

Today I discover there is a smiple solution, I can use it directly from the 14 hive based on a SharePoint utility method called SPUtility.GetLocalizedString(), so I implement a method as following to do this:

public static string GetResource(string key, string resourceFileName)
return SPUtility.GetLocalizedString(“$Resources:”+key,resourceFileName,(uint)System.Threading.Thread.CurrentThread.CurrentUICulture.LCID);