Wednesday, July 24, 2013

AD and SharePoint users sync

Lot of times we encountered the problem where for testing we add users in AD and they do not get access to site the same time and even after doing User Profile Synchronization job run, we could not solve the problem.

Turns out the below blog helped.

http://blog.randomdust.com/index.php/2013/06/sharepoint-2013-claim-expiration-and-ad-sync/

Wednesday, June 19, 2013

Page cannot be displayed error while creating Web application

While creating a new web application, a 404 'Page not found' error is displayed and the web application is only provisioned on the local server

After a number of web applications have been created in the SharePoint 2010 farm, further attempts to create a new web application through Central Administration result in the following:

The creation process results in a 'Page cannot be displayed' message.

The web application is only provisioned on the Central Administration server.

But if you try to create a site collection on this newly created web app, it fails. Reason is it is not completely done.

After struggling this for a while I found you can resolve by increasing the Shutdown time limit in IIS to a greater value.

Steps

  1. Go to application pool of Central Administration.
  2. Right click on it and go to Advanced Settings
  3. In the Process Model section, increase the shutdown time limit to 200 for example.
  4. It is a good idea to restart IIS now.
  5. After searching on net for a while I found that the reason is during the web application creation process IIS is reset and by default. It allows the "Shutdown time limit" which by default is 90 seconds. Sometimes this might not be enough. And hence it forcibly shuts down in 90 seconds.

Saturday, June 1, 2013

Server Error in ‘/’ Application. Runtime Error in SharePoint

Open web.config file


1. C:\inetpub\wwwroot\wss\virtualdirectories\” modify the web.config file

a. In customErrors tag set mode="Off" to "On
b. In SafeMode tag set CallStack="true" to false
c. In Compilation tag Debug="false" to true

2.If still you are facing default error page then follow below change
In the layouts directory underneath the SharePoint root directory or 14 hive – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS

a. In customErrors tag set mode="Off" to "On
b. In SafeMode tag set CallStack="true" to false
c. In Compilation tag Debug="false" to true

Wednesday, July 18, 2012

Turning off custom errors in for debugging in SharePoint 2010



As a developer, one of the first things I do after I have setup a web application & site collection is:
Open the web.config (“C:\inetpub\wwwroot\wss\VirtualDirectories\(port)”) and set:

1.change batch and debug to true - (compilation batch="true" debug="true" )
2.change CallStack=”true” in safe Mode tag - (SafeMode CallStack="true")
3.Change CustomErrors=”Off”
However when I ran into exception, instead of getting the detailed message I was expecting, I ended up getting the infamous message telling me to change the customerrors setting in the web.config so that I can see the details:

Server Error in '/' Application.

After embarassingly long time I figured out there is another web.config in _layouts directory - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14

Custom errors need to be turned off here too.

Friday, June 3, 2011

MVC vs MVP

Last month I happened to stumble on this question from different people as to what is the difference between MVC and MVP. Representing here diagrammatically for a quick look

MVC PATTERN



MVP PATTERN

Friday, February 4, 2011

Writing an Extender Control

To write your own Extender Control, I am using Microsoft Ajax Library.
This location below has a powerpoint presentation and a zip with a demo code.
The power point presentation talks some basics about Microsoft Ajax Library key components and the demo shows how to make an extender control.

Please remember to select extender control template while creating extender control in Visual studio. It will save you lot of configuration lines that you might have to write otherwise.

https://docs.google.com/leaf?id=0B_ZpzrhCCVOoNTE0N2ZkMDktNWQ5Yy00ZTIwLTg4ZTAtY2Y5YjE0ODEyYTYy&hl=en&authkey=CIqq8CQ

Tuesday, December 28, 2010

Ajax Library – Event Handling

System.ComponentModel.EventHandlerList - to add custom events to an object


To add custom events to an object, you add an instance of Sys.EventHandlerList into another object and expose public methods off that object that manipulate the instance. (Table 2.5 details the methods we use to manipulate the Sys.EventHandlerList type.)

How to add a custom event.

For instance I have an array notes[]. When I add a note I want to add an event, that shows an alert. To do this
1. Create an instance of Sys.Event.HandlerList. This instance holds list of handlers with their associated events.

_events=new Sys.EventHandlerList();

_events.addHandler("noteadded", functionName);


addHandler method adds the event name and function name to be executed on raise of that event.


How to raise this custom event


For this whenever a note is added following code needs to be written


var handler= _events.getHandler("notedded");

If(handler!=null)

handler(this,Sys.EventArgs.Empty)


2. To pass arguments of your own you need to create a class and inherit from Sys.EventArgs
Example
NotebookNamespace.NoOfNotesEventArgs=function(numOfNotes)
{

This._noOfNotes=numOfNotes;
}
NotebookNamespace.NoOfNotesEventArgs.prototype= {

Get_noOfNotes : function()

{

return this.noOfNotes;

}
}
NotebookNamespace.NoOfNotesEventArgs.registerClass("NotebookNamespace.NoOfNotesEventArgs", Sys.EventArgs)

Another this worth mentioning here is Sys.UI.DomEvent.
The Sys.UI.DomEvent class provides cross-browser access to DOM element event properties and methods to work with DOM element events
Some familiar methods of this class are $addHandlers, clearHandlers, preventDefault etc

Example

Var btn=$get("button1");

$addHandler(btn,{"click":button1_clickHandler});

However this has a problem of maintaining scope. The example below will tell you what I mean.

<html>
<body>
<form id="form1" runat="server">
<input type="button" value="btnTest" id="test" />
<asp:ScriptManager ID="scrptMgr" runat="server" />
</form>
<script type="text/javascript">
MyObject = function() {
this._name = "Deepa";
};
MyObject.prototype = {
clickEventHandler: function(e) {
alert (this._name);
}
};
var myObject = new MyObject();
$addHandler($get("btnTest"), "click", myObject.clickEventHandler);
</script>
</body>
</html>

The code looks like it will alert "Deepa". But it alerts "undefined"

That is because when event handler clickEventHandler executes, this points to the testButton and not the class MyObject.
To correct this we use Delegate provided by Microsoft Ajax Library

To create the delegate, we use the Function.createDelegate method, as
follows:
var del = Function.createDelegate(<instance>, <methodName>);

In the evenHandler i.e. <methodName> here, this will refer to <instance>

Hence with below code, "Deepa" will be alerted when clickEventHandler is executed

var myObject = new MyObject();
var dele =Function.createDelegate(myObject, myObject.clickEventHandler);
$addHandler($get("btnTest"), "click", dele);