Sunday, 10 November 2013

Button not working after first time - Telerik SharePoint

Recently I faced an issue while developing "Export to Excel" functionality for Telerik grid in Webpart for SharePoint 2010. Export to excel was not working once the user has clicked the button. After some googling, I found that by using following JavaScript snippet in the Webpart or Page, this issue can be resolved and it worked for me :

<script type="text/javascript" language="javascript">

    //sharepoint postback to work after clicking on telerik export
    if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' && _spBodyOnLoadFunctionNames != null) {

    function supressSubmitWraper() {
        _spSuppressFormOnSubmitWrapper = true;

Hope it can help someone!!

Wednesday, 24 April 2013

How to setup / configure Microsoft Office Web Apps 2013 with SharePoint 2013

How to setup / configure Microsoft Office Web Apps 2013 with SharePoint 2013

Recently, I was asked by by Team lead to setup Single Server Test Environment for SharePoint 2013 configuration with Microsoft Office Web Apps 2013.

First I thought , I just have download and run setup of Microsoft Office Web Apps 2013 and I am done with it. But when I started the proceedings, I faced some issues which I will be listing down to help someone and save their precious time rather than googling and trying to find the solution of the problems which someone have to face while configuring Microsoft Office Web Apps 2013. There are other blogs which avaialable but those blogs have not yet discussed any of the issues I was facing at the time of configuration.

Microsoft Web Apps : It is used to access and read / edit office documents like Ms-Word, Excel, OneNote and PowerPoint online , or you can say it opens the office documents online in browser rather than opening in Client Application of Office.

By default in SharePoint , excel usually opens without the need of WebApps but documents like Word and PowerPoint are first downloaded and then are opened in Client App.

Now lets start proceedings :
  1. Before you start, let me tell you that  Microsoft Office Web Apps 2013 requires a seperate server: a.) It should be a seperate server than the SharePoint 2013 with Windows Server either Windows Server 2008 R2 or Windows Server  2012.    b.) Microsoft Office must not be installed on the server on which you are going to install Microsoft Office Web Apps 2013.  c.) Server must be on domain. d.) Add the domain user in the Administrator group server on which you are going to install Office Web App 2013. e.) Login / RDC the server on which you are going to install Office WebApp Server 2013 with the (domain + Administrator ) rights user and then start the further proceedings.
  2. First we have to download setup for the Microsoft Office Web Apps 2013, visit the link below and download "wacserver.img". Or you can click download link :
  3.  As you can see file extension is ".img", so its a package which you need to open / extract. You can use "Extract Now", which can be downloaded from the following link:
  4. After "wacserver.img" file has bee downloaded. If you are using Extract Now for extraction , drag and drop the "wacserver.img" file on the white area in the Extract Now and then extract the file where you want to.
  5. Office Web App Server 2013 does not have any pre-requisites installer file, so we have to install all the pre-requisites one by one. Basic pre-requisites are :
  •  Windows PowerShell 3.0
  •  Dot Net Framework 4.5 ( Which is already available in / installed by default in Windows                                                   Server 2012)
  • IIS 7.5 , 4.0 (in Windows Server 2012 its IIS 8 )
  • All the above can be installed from Server Manager :

7. Now, we are ready to run setup for Microsoft Office WebApp 2013, run the setup file in the package you have downloaded.
(If you try to install the Office Web Apps on the same server on which you sharepoint is installed it will not allow you to continue, pluse if you have installed microsoft office , it will not allow you to continue proceedings until you uninstall the Microsoft Office.)

8.Once setup is completed successfully, you need to setup a farm site on the same server on which you have installed the Office Web App Server. So for that you need to execute some commands on Windows Power Shell. (open Windwos Power Shell By Run as Administrator)

9.Execute following command on Windows Power Shell: (this step can be performed before you run setup for the office web app server )
Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,InkandHandwritingServices

10. And then for setting up a single server test enviroment farm for office web apps, execute following command:
New-OfficeWebAppsFarm –InternalURL "http://servername" –AllowHttp -EditingEnabled
(if you are not logged inn as (domain + admin ) rights it will show message of login failure and authentication failure)
11. To check whether the above executed command has setup the Farm for office web apps or not , open the following url in your browser:
and it will return you xml like below screenshot:

12. Now its time to connect / configure your sharepoint server to utilize the office web app server. To do that you need to run a command on your sharepoint server. Now login / RDC your sharepoint server and open Management Shell from 
Programs > SharePoint Products > SharePoint 2013 Management Shell ( Run as Administrator)

13.Execute following command:
New-SPWOPIBinding -ServerName <WacServerName> -AllowHTTP
Where <WacServerName> will be replaced from the name given to your Office Web App Server. As in my case it was "SP-WebApps", so my command was:
New-SPWOPIBinding -ServerName SP-WebApps -AllowHTTP
and press enter. It will create a new binding for the SharePoint with office web app server and will show all bindings like below:
(If your server will not be on the same domain, this command might show an error of unable to contact the server)
14. Now execute following command on the sharepoint server management shell:
It will show the sharepoint webapps zone details, which will be:
internal-https (by default)
To change it to use normal http , execute following command
Set-SPWOPIZone –zone “internal-http”
Now again run Get-SPWOPIZone command for confirmation that it has been set correctly.
For other description explaination and advanced configuration you can visit:
That's all, we are now done with it.!! Open your SharePoint Site and open any document that is uploaded in library, it must now show / open in browser like below:
For the video demo:

Hope that will help someone!!

Thursday, 18 April 2013

Unicode characters being displayed as Boxes and Questions marks

Unicode characters being displayed as Boxes and Questions marks

Recently I faced a problem while development of a multilingual website, which was in English and German language, it was showing some german characters as Box ad Questions marks just like :

(Internet Explorer)

(Google Chrome)


Reason was that, I was using notepad++ and notepad as the developmnet enviromnet as the development platform was PHP, so when I was saving the files it was being saved as ANSI coding and other than UTF-8.


What I did, I re-opened the files having unicode content/characters, in Visual Studio or in Notepad.

Visual Studio
In visual studio, right click on the source page on any white area and take properties, it will show you the coding it is being following, change that to UTF-8 and if it is already selected then just save the file as it is again, and then again check , your issue must have resolved, and it must now show the characters properly in browsers.

In notepad, click File > Save As, and then at the time of saving the file, there must be a coding technique option dropdown, by default there could be ANSI selected. Change that to UTF-8,  and don't forget to change file type to "All files" , other wise it might concate ".txt" (dot text) extension with the file extension, as in my case, file extension was "file_name.tpl" , but it save it as "file_name.tpl.txt".

That was all, hope it could help someone!!!

Thursday, 4 April 2013

How to Register your App with Facebook

How to Register your App / Website with Facebook

Following below steps to register your app / domain to integrate your app / website with facebook :
1. Login with facebook account or Register for new account on facebook.
2. Then go to Settings > Create an App.
3. Then click "Apps" tab.

 4. Then click "Create New App". Type name for your application and then click continue.
(It will check for the name validation, if it will be OK, it will show message "Valid"on the right side of the app name input box.)
 5. Then in the next screen it will ask for the human verifcation code / captcha. type in the code given in the picture and click continue.
6. It wil then take you to the app page, where you will note the "App ID" and "App Secret" key, which will be used by the facebook SDK to authenticate your application with facebook. and also you will provide the app domain / url , of your website, which will then include your website in the white list. Else it will not acknowledge / authenticate the requesting domain, if you will not provide the address. and will give / prompt message of invalid url.
7. After all these steps click "Save".

Hope that helps!!!!

Thursday, 28 February 2013

Unable to generate a temporary class (result=1). error CS0029: Cannot implicitly convert type 'SomeType' to 'SomeType[]'


Recently I faced a problem while accessing a webservice, I added web reference in my Visual Studio project, and created an instance of a class, and it returned me error which was something like :

Unable to generate a temporary class (result=1).
error CS0029: Cannot implicitly convert type 'SomeType' to 'SomeType[]'

-SomeType = any class name available in the Service being consumed


After some efforts and googling, I found that this is one of the known bugs of  .NET. This problem was due to a type which was structured / mapped as dynamic array, like SomeType[][]. and the consumer of such properties data type was expecting a simple SomeType Object. 

What I did, I created a local class strucutre for the WSDL file and added that file in my project. To create a code file / class for the WSDL file , you need to follow these steps:
1. Start Command Prompt of Visual Studio ( try to run as administrator)

2. Type following command :
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>wsdl /o:d:\\referencefile
.cs http://server/ServiceFile.wsdl
3. It will create the dot cs file at the location specified in the above command, copy the file and add it in your project. 
4.Remove the web reference from the project.
5.From the CS file genereated find / search for double square brackets "[][]" for SomeType / Class name for which exception is being thrown, and change it to single square pair "[]". Save and compile.

Now it must now throw exeception. Hope that helps some one. ;-)

Saturday, 23 February 2013

How to get next ID for the table - SQL Server

How to get next ID for the table - SQL Server

Usually we need to show the next ID on the new entry form, like Sale Order , Purchase Order..etc.
There are different methods for achieve this as far as I know: 

1. Create a function or stored procedure to to query the max ID for the table that we want to know the last ID generated and add 1 to the ID.
For example :
Select IsNull(Max(PurchaseOrderId),0) + 1 from PurchaseOrder

But this method will only work only when we have atleast one record in the table, other wise the Max function will return NULL, and it will be converted to zero as we have used ISNULL function and the ID which we will get will be 1, and that could only be correct if you have not inserted any record in the table, otherwise if you have entered a record in the table and deleted that record, its ID will be starting from the last ID generated.

2. Another method, that is usually used is that we check if the query / resultant of the above query is NULL, we reseed the table identity column to 1.
For example:
declare @nextId as int
set @nextId  = (Select Max(PurchaseOrderId) from PurchaseOrder)
IF @nextId IS NULL
     DBCC CHECKIDENT ('PurchaseOrder'RESEED1)
Select IsNull(@nextId,0) +1 as NextIdentity

which seems to be quite better way to achieve the next ID for a table.

But the best way I have found yet is :

3. There is a built-infunction in SQL SERVER 2005 AND LATER, and that is :

IDENT_CURRENT( 'table_name' )

Ident_Current() function gives you the last ID which was generated for the particular table.

For example :
Select IsNull(IDENT_CURRENT( 'PurchaseOrder' ) ,0) + 1 as NextIdentity

Now its upto you that how you use this function, I have created a general stored procedure, which accepts an argument for the table name, and passed that arguemnt /variable to the Ident_Current() function, and now I don't have to create seperate funtion / stored procedure for each table.

CREATE PROCEDURE [dbo].[GetCurrentIdentityForTable]
@TableName varchar(100)

SELECT IsNull(IDENT_CURRENT( @TableName ),0) + 1 as CurrentIdentity

That was all!! If you can suggest more better method to achieve this or any other alternative, please feel free to share that :-)..

Wednesday, 20 February 2013

Little Hacks for SharePoint - 2013 Part 2 ;-)

How enable Sign Inn As a Different User option

In SharePoint - 2013, Sign Inn as as different user is not available by default. To enable this option, follow these steps:
1. On your SharePoint Server, navigate to 15 hive folder.

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES

2. There will be Welcome.ascx, open this file in notepad or any of your favourite editor.
3.Search for:
4. Inside this tag, there will be multiple menu items options, include this snipped inside this tag:

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser" 
Sequence="100"  UseShortId="true" />

5. Save the file.

Now check your sharepoint site again, "Sign inn as different user" option must be available.

Hope that helps!!!

Friday, 15 February 2013

Little Hacks for SharePoint - 2013 Part 1

Enable Breadcrumb for SharePoint - 2013

Breadcrumb in SharePoint - 2013 is not visible by default. To enable breadcrumb for SharePoint - 2013, follow these steps:
1. Open your site in SharePoint Designer.
2. Open the master page being used at your site.
3. Create a copy of your master page.
4. Edit newly created master page.
5. Search for ID "GlobalBreadCrumbNavPopout"
6. In the SharePoint:PopMenu tag, either remove "Visible" attribute or change "Visible" value to true.
7. Then look for class "ms-breadcrumb-dropdownBox", there will be an attribue of display which is set to none by default. Remove this display attribute.
8. Save the master page file.
9.Right click on newly created master page which you just have modified, and click "Set as default master page", and you are done.

Open your sharepoint site, and it should not show "Navigation Up" at your site.

Saturday, 9 February 2013

Importance of Troubleshooting in Desi Style ;-)

Importance of Troubleshooting in Desi Style

I want to share my general experience to show the importance of troubleshooting.
Recently my mother bought some SAMOSA / KACHORI / MIRCHI (Snacks) at home. I first ate a chicken SAMOSA which was quite tasty :-P , then I ate kachori with some sauce / CHATNI, its tasted to me like expired, I threw that away in dust bin, again I tried daal samosa with some sauce / CHATNI, it also tasted like expired :-( and I threw that away in dust bin too. Finally the last item which was left to try was MICRCHI with sauce / CHATNI, it also tasted like expired, then instead of threwing that MIRCHI in dust bin, I ate that MIRCHI without sauce/CHATNI. and finally found that the issue was with the sauce and because of not troubleshooting this earlier :-p , I wasted 3 of food assets. 

So my friends, same is the case in the field of Information Technology, if things are not troubleshoot properly it might cause us waste of valuable time and resources.

Hope you have enjoyed my real life story to understand the importance of Troubleshooting :-D.


Tuesday, 5 February 2013

How to configure SMTP and use in SharePoint

How to configure SMTP for SharePoint

Windows version used in this Post : Windows Server 2008 R2

1. Go to Start > Administrative Tools > Internet Information Services 6

Internet Information Service (IIS) 6.0 Manager

If SMTP server feature is not installed, IIS 6.0 manager screen will look like above. As you can see there is no node under Internet Information Service. So we need to install SMTP feature from Server Manager.
3. To install SMTP feature, go to start and type "Server Manager".
in the search results it should show, Server manager. 

4. Go to "Features" from the left pane, and click "Add feature".

5. Mark "SMTP Server" , it might popup a message asking about the dependency feature to be installed before SMTP , click "Add required feature" from the poped up message. and click next. and in the next screen click Install.

Installation will be started, it will take few minutes to install SMTP:
After SMTP is installed, again open the IIS 6.0 manager. Now it should show an addiotional node with the Machine name, and a virtual SMTP server will be created after SMTP installation.

Now we need to configure SMTP server for mail account and other major configurations.
6. Right click on the Virtual server node and click properties.
7. Go to Access tab, and then click "Authentication", mark only "Anonymous" checkbox and click OK.

8. Then Click Connection in the Access tab, to configure which server or IP can use this SMTP server to send emails. 

Note: This configuration is very important in the configuration of SMTP, specially when your SMTP server machine is hosted a live IP, if any of the spammer or bot will come to know about this SMTP server open to world, it will start to use this server to send emails if it is open to be used by any server.

9. Select "Only the list below", and Add the IP address, you want to grant permissions and click OK.

10. Then Go to "Delivery" tab, and click "Outbound security". Select "Basic Authentication" and provide the user nae and password via which you can to send email, ( create a gmail account and put credentials of that account in here, you have to write user name along with domain , example ).

11. Now in the delivery tab, click "Outbound Connections...", and provide the gmail tcp port number that is "587", by default it will be 25.

12. Then in delivery tab, click "Advanced...", provide the smart host, in my case as I was using gmail account, so I provided

13. Then click OK in the properties windows for the SMTP. and note the Fully-qualified domain name value, because this value will be used in the SharePoint Configuration for SMTP.

Now we have to use this SMTP server in SharePoint. To do that, follow these steps:
1. Go Central Administration > System Settings and click "Configure outgoing email settings" under Email and Text Messages (SMS) heading.

2. Type the Fully qualitfied domain name value in the Outbound SMTP server, which you must have joted down in the prevoius step (Step 12):

3. From Address and reply to address are optional, click OK. and you are done.

Hope that helps!!

Monday, 28 January 2013

Skype Audio Issue when headphones are plugged Inn


Most of the guys with laptop now a days facing a common problem that when headphones are plugged inn and any notification of skype popup either of message / IM or any call alert, it switches on audio device to spearker.


1. In you skype window, click Tools > Options..

2. In the popup winodw, select "Audio" from left pane, 
3. Select "Use selected Speaker" for Rining menu.
4. Uncheck "Automatically adjust speaker settings" .
5. Click "Show advance options".
6. Save and check again. If it is fixed then you are done, else move to point 7.
7. In the advance option window, look for "Speaker" section, a list will be there of all the devices of output. One device will be selected as default, which will be marked with green sign.
8. Select other than the default device and click "Move Up". It will mark the selected device as default and will mark with green sign.
9. Click "Save" and check agian. It must be fixed.

Hope that help!!

Monday, 14 January 2013

HTTP Error 500.0 - Internal Server Error Calling LoadLibraryEx on ISAPI filter "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll" failed


I recently faced a problem in IIS 7, that when I was browsing any of the site hosted in my IIS, it was showing me an error message :

HTTP Error 500.0 - Internal Server Error

Calling LoadLibraryEx on ISAPI filter "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll" failed

I tried several hit and tries like, I changed my application pool, removed my virtual directory and created new. But nothing worked for me.


Then I did some googling and found a post at : of kphani_prasad
Although it was not marked as answer but it solved my problem. 
Steps which solved my problem :
1. Go to IIS.
2. Select your application from left pane, and click "ISAP Filters" from the right pane.

3. Check the path for which IIS is raising error. As in my case it was "v4.0.30319", and when I checked the path it was having an extra "\" (slash) in the path, so it was not able to load the desired dll file. I edited the path and removed extra "\" from the Executable path. 
4. Restarted my IIS application and all was good to go.

Hope this help!