Showing posts with label Sharepoint. Show all posts
Showing posts with label Sharepoint. Show all posts

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!!

Friday, 7 December 2012

Javascript or Css disappears in Content Editor Webpart - CEWP

Problem:

Recenlty I faced a problem that I was writing some html along with javascript tag with some code in the CONTENT EDITOR WEBPART (CEWP). As soon as I save the page, all the tags of javascript disppeared or removed from CEWP. I googled, but did not find any solution.

Solution:

What I did, encapsulated the script and html within "CDATA" section, actually sharepoint 2010, it was removing all such script tags from the CEWP becasuse of secrutiy purpose, it removes all the script which could threaten or inject. Thus CDATA solved my problem.

Updated (Feb 18 2013) :
On my friend's request FAZ, am including an example to explain it littile bit more on this topic.

Sometimes you edit a page in sharepoint designer, and add javascript snippet in the page, on saving the page it prompt you a message that "unsafe code will removed...", and when the page is saved you will notice that the javascript snippet you just added is removed.
For Example:
1. Edit a page and add some javascript code snippet in the Content Editor Webpart and save.
 (Content Editor webpart is inserted using "Insert" tab in the SharePoint Designer, and then "Webpart" menu, and then select "Content Editor")
2. When you will save , it will prompt a message just shown in the figure below:

3. When you will click "Yes", you will notice that the javascript snipped you just added have been removed from the page.
So for that we have to keep our javsacirpt / CSS snippet in CDATA wrapping as shown below:


<script type="text/javascript"><![CDATA[
function Test()
{
alert("tested!");
}
]] </script>

Then it will not remove your snipped from the page.

Hope this help!!

Tuesday, 17 January 2012

External List not showing columns - Sharepoint 2010

Problem
I recently faced a problem, when I created new External List in SharePoint , but some columns does not appeared, like my primary key column, foreign key column, was totally confused.

Solution
But after some googling :) , I found that External List has some unsupported data types , which it could not map like int64 ( bigint in SQL server), object type, URL type.
And same was the issue in my case, I changed datatypes from bigint to int, and it worked for me :) :)

Thanks for your time.

Test Email without sending Email to User - C# / C-Sharp - DotNet

Sometimes we may want to test email functionality without sending email to actual user. Email will be saved locally so that we can verify ...