Thursday, 23 October 2014

SharePoint 2013:BCS Connect To Oracle DB No Code

There are many posts describes how to connect to Oracle DB database using .NET assembly Type of BCS, it requires writing codes and install the Oracle Client or OLEDB on every App and WFE server.

I was going through the same road when it hits me , I can use Database Link to connect to the remote oracle table by installing OLEDB client on the SQL server only. Afterwards, I can easily create the BCS model by using SharePoint Designer.

  1. After creating the database link create a view to use it when creating the BCS let's name it MyTestView
  2. Open SharePoint Designers and connect to your site collection
  3. Click on create new External content type
  4. Name the external content type and click on the "Click here to discover external data sources and define operations" link
  5. Click on Add connection then Choose SQL server and click ok
  6. Enter the server details and database name
  7. Browse to the views and expand them you will see the view which we created (retrieve records from remote oracle DB)
  8. right click the view and generate both ReadItem and ReadList operations
  9. Make sure to map the identifier in both operations
  10. Save the External Content Type
  11. Create External List

Additional Information: 
In order to impersonate the user identity you need to create a secure store application and update the External Content type External System 

following this blog steps you can connect to remote oracle DB without writing a single line of Code.
Happy SharePointing

Wednesday, 8 October 2014

SharePoint 2013 Managed Properties not automatically created

According to TechNet article at SharePoint 2013 automatically generated crawled and managed properties given that the site column will have information stored and a full crawling has been completed successfully.

However, I encountered a case in which the Search service application failed to managed properties and create a invalid crawled properties. In my custom site columns definition elements.xml file I have a field called HTMLComments and the field schema was as below :

I notice that only crawled property has been created with a name HTMLCommentsOWS which not following the naming convention mentioned in the above link. as the field is HTML Field I expected to have automatically created crawled property named "ows_r_HTML_HTMLComments". I was clueless for a while and then I end up viewing the Schema for an OTB Field PublishingPageContent and it was as below

I notice that the SourceID  attribute is missing from my Field definition,I added the source Id attribute as below:

and run full crawling and I notice that the  crawling properties and managed properties has been created successfully.

Sunday, 7 September 2014

SharePoint On-Premise:Feature Activation fails with timeout error

Did you ever face this problem when your feature activation keeps throwing a timeout error , first I thought it's might occur because of un-optimized code blocks in the feature activated event receiver. I tried to deploy the features many times with no luck.

The interesting bit is, when debugging the feature activation code it fails every time in different step not always failing at the same line of code. Which makes me question the fact that there is something wrong in the code block I wrote. I came to a conclusion that it's a timeout setting for Visual studio feature activation.

According to this MSDN link , there is a Registry Key called ChannelOperationTimeout Which represents the deployment timeout from Visual studio the default value is 120 seconds. Once I increased its value you and restart Visual Studio my problem was solved !

The registry key path HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\SharePointTools

Wednesday, 16 July 2014

The People App- Yet another SharePoint App

Inspired by the Windows  Phone 8 people app Tiles I thought why we don't have a similar SharePoint Hosted app  displays the current user profiles in the same manner.
I googled the JQuery Tile effects until I found the below plugin at the link below :

I chose the fourth example which display 8 different images and keep flipping them in similar manner to Windows Phone People App tiles. The whole app development took around 2 hours or less.

  1. I created a new solution in visual studio called it "People App" Choose SharePoint hosted app and I chose to deploy to my test environment (on Premise) to see how you can configure your own On Premise Environment to develop Apps please follow the guide here
  2. Add new App Part to the newly created app and name it PeopleTile
  3. Copy the metroJS files into Images, Scripts and Content App Folder
  4. Add the references to JS and CSS files to the App Part aspx Page
  5. Create new JS files and name it SearchHost, in this javascript file the app logic will be placed
  6. The app will execute Search queries to the host web and by passing the sourceID=B09A7990-05EA-4AF9-81EF-EDFAB16C4E31 it will limit the search to the People search
  7. Search Sort Expression is set to random value to retrieve random peoples each time the search is executed.
  8. After a successful search query the app will construct the appropriate metrojs markup and place the it in the correct location 
  9. The app will look like below
  10. You can download the app via office Store here
The user profile images will keep flipping ,when the user clicks on a profile image the browser will navigate to the user's mysite Url

App need to be granted single permission so it can execute search on the host web and read from user profile

I will post the full code on MSDN shortly 
Happy SharePointing !

Friday, 11 July 2014

Step by Step: Configure Your on Premise environment to develop SharePoint Apps

In this post I will explain in details how to configure your environment for app development in a standalone server setup. I find this scenario very useful when you want to debug a remote event receiver and you don't have a windows azure subscription or as in my case I wanted to test an app which requires multiple user accounts and I have a single user developer plan account and I don't want to add 10 user subscription just to test my SharePoint App.

First of All you need to add a sub-domain or separate domain to configure the Apps Url

  1. Go to DNS settings 
  2. Inside your DNS Server In my case the server name was SP , expand Forward look-up Zone
  3. Under your main domain ( in my case)add new CNAME
  4. In Alias Name type *.apps and in Full qualified type * in the target host type the full qualified name of your SP Server which acts like DC and DNS as well (Single server environment)
  5. to make sure that your configuration is correct open the command prompt and ping if it resolve to your sharepoint server IP means your DNS configuration is good to go 
  6. Now you need to make sure that the app subscription settings service application is configured and running , by default it's stopped and you need to run power-shell script to do the following

      • Create managed account
      • Create proxy for the service application 
      • Create the service application itself
      • You can follow the MSDN Guide on how to configure the subscription service application here
  7. Open Central administration and click on Apps menu item on the left side menu
  8. Click on Configure App URLs 
  9. Type the subdomain you previously configured in DNS , as an app prefix type app or anything else your want
  10. Click on  Manage application catalog under application management and create an application catalog 
  11. Create a news developer site collection and use it to deploy and test your SharePoint apps.
Now you can use your On-Premise Development server to test your apps 

Monday, 26 May 2014

Elevate your search experience: an Auto-complete search box

In this post I will explain how to elevate the search experience for your intranet or public faced website by replacing the Out of the box search control. 
The main component of the new autocomplete search  control are:  
  1. Search scope definition List: a custom list definition represents the search scope custom definition and a list instance of this list definition. 
  1. Empty element.xml file contains the necessary code to replace the  search delegate control replacement. 
  1. Custom user control holds the search autocomplete  logic , the control utilizes the Search RESTful APIs and execute an XHR calls to the search WCF service. 

The site owner will deploy the solution and will start populate the search definition by adding new items to the search definition list instance , the list definition will contain label (definition Title) and search definition. The search definition in fact is the RESTful call query string parameters. 
First let's create an empty farm solution 

Then add new List definition to the empty solution, name the list Search Definitions
Add new site column element to your empty solution to add your custom columns (Search definition and ScopeOrder)

Add the new field in the custom column elements.xml as below 
    Add the newly created fields to your Custom List definition as below:

after finalizing the custom list definition let's add the second main component which is the empty element file contains the search delegate control replacement.
Then add a new custom user control 

The user control consists of two components  dropdown list and a textbox  when the page loaded for the first time the control loads the predefined search scopes in a dropdown list and as the user start types a JavaScript code utilizing the client object model getting the scope definition and inject the user input string and execute an ajax call to the RESTful api at the end point

The control append the definition (which is the query string parameters ) to the above URL and render the search results
Example of the search definition

as you can see the first search definition search without limiting the results to any scope or content type, however the second one is limiting the results only to people using the SourceID parameter.
The third is trying to find the query only in the pages with type "NewsPage" which is a custom content type I've already created before

here is how the control looks like 

For complete source code please download the code at

Friday, 16 May 2014

Promote your rating actions :Like a Page

In this post I will explain in details how to enable the like functionality for every page in your SharePoint site, and promote the like actions to the PromotedActions Delegate Control. 

In SharePoint 2013 a new DelegateControls are newly introduced like Sitesuitebar and promoted actions for a full list of the newly introduced place holders please check this blog post: 

First I will start with how to enable the ratings settings for your page library 
Navigate to your page library and via the ribbon click on the library settings , under the rating settings click on enable rating and choose likes. 

Now your site pages is available for rating , the out of the box rating actions can be found in the page library default view located in allitems.aspx page in our example we will try to provide an easier way to see the current pages like count and perform like and unlike actions from the page itself 

Create an empty SharePoint 2013 farm solution 

add new elements.xml file to it 

In the newly created elements.xml paste the below code which reference the LikePage user control
LikePage user control,will utilize the JavaScript object model and get he current page like count, also it detects whether the user already liked the page or not and it shows and hide the like actions based on that. 

This is how the control looks like  

 For complete source code please go to