Tuesday, 28 October 2014

SharePoint - Unable to create New WebApplication

Problem

I recently faced a problem with SharePoint, that I created new Web Application and it was showing a popup of "It shouldn't take long", then after some time it showed a Connection failure page. I browsed to the virtual directory folder for the new web application and found that the folder was totally empty.

Solution
Then what I did to solve this problem:


1. Open IIS
2. Go to Applicatin Pools
 3. Select Central Admin application pool and right click and select "Advance Settings".
4. There was a property named "Shutdown Time Limit", it was set to "90" by default.
    I changed it to 400 and clicked OK.
 
It restarted the applicaition pool automatically. Then again I created new web application from central admin and it worked for me.

Saturday, 20 September 2014

Item Created time zone displays wrong programatically - SharePoint List

Problem:
Recently I faced an issue, that I was having a Log field with Version enabled list. Time was being displayed correctly in the SharePoint list but while retrieving CREATED field time programactially for all versions of item, it was displaying wrong time.

I was using below statement to retrieve time for CREATED date:
version.Created.ToString("dd/MM/yyyy hh:mm tt")
My timezone was though set to +3 Region, but it was showing GMT time with +0 Regional time settings.

Solution:
Then I change the above line to:

System.TimeZone.CurrentTimeZone.ToLocalTime(version.Created).ToString("dd/MM/yyyy hh:mm tt")
This done the trick for me.

Hope this helps someone!

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) {
        _spBodyOnLoadFunctionNames.push("supressSubmitWraper");
    }

    function supressSubmitWraper() {
        _spSuppressFormOnSubmitWrapper = true;
    }
  
</script>

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 http://www.microsoft.com/en-us/download/details.aspx?id=35489 and download "wacserver.img". Or you can click download link : http://www.microsoft.com/en-us/download/confirmation.aspx?id=35489
  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:http://www.softpedia.com/get/Compression-tools/ExtractNow.shtml
  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 , Asp.net 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:
http://servername/hosting/discovery
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:
Get-SPWOPIZone
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:http://technet.microsoft.com/en-us/library/ff431687.aspx
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

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.

Solution

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.

Notepad
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[]'

Problem

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

Solution

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. ;-)