Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Monday, March 12, 2012

How to write custom Error Log File Code:

A common headache for all developers is how to handle errors? Sometimes it's very difficult to find where the errors comes. So, Better solution is write custom log files. Here I am sharing my custom handling techniques.

My custom log files highlights are: 
  • It stores all our logs in the specified folder with the log file name? We just have to give the log file path in the web.config file 
  • Will get the classname, methodname, logged username and exception name for each generated log file. 
  • Log files are stored with log file generated date/time. Here is my custom log file code:

Thursday, March 8, 2012

Custom GlobalNavigation in SharePoint

It’s a very common requirement to apply nested nodes to the top level global navigations for most of the SharePoint developers. But, by default SharePoint limits up to one level only. Don’t worry I have done it. You can implement the nested nodes to the top navigation by following the below steps.

Step1: Create a sitemap file and place that file in “app_bin” folder.

Note:
·         <siteMapNode title="Home" url="/site/subsite/default.aspx" target="_new" />
·         To customize menu items to new popup window as target than default “_top” window.

The file _app_bin/Web.sitemap required by XmlSiteMapProvider does not exist

Even I also got this exception; I have checked the sitemap file that I am using exists in “80/app_bin” folder or not? Yes it is available then why I am getting this error? I don’t have any idea on it so I thought it’s better to search in Google. I understood why it is happing by referring the below post.

 
Let me briefly explain what the post says, the users should have permissions to access if you place the sitemap files in web applications “app_bin” folder. By default, SharePoint administrators have permissions to access it. I then added read permissions to domain users group on file Web.sitemap to access domain users also. Then - problem disappeared! :=) 

Now, I got one more question? If you want to use the same sitemap file in multiple web applications, then what will we do? Is this better approach to give permissions to the sitemap file explicitly for each deployment?

Tuesday, March 6, 2012

Client Object Model:SharePoint 2010

The Client Object Model is a new object model introduced in SharePoint 2010 which is aimed at making things easier for the developer when developing client-side applications for SharePoint 2010. Client Object Model can run on the client machines (Where SharePoint is not installed) and communicate with the SharePoint server remotely.

In my previous post, i already shared all types of client object model examples.

Sunday, March 4, 2012

where/When/Why FormDigest Control: SharePoint

FormDigest Control:
Every SharePoint developer should know about the “FormDigest” control. Especially who are developing master pages, site pages and application pages?

I am going to cover in which areas FormDigest control use:
  1. What is FormDigest Control?
  2. Why every master page should have “FormDigest” control and what is the need?
  3. The security validation for this page is invalid?
  4. When/where/why use "AllowUnsafeUpdates" in SharePoint?
  5. How to do manipulation to the SharePoint data programmatically?

What is FormDigest control?

A FormDigest control has to be included to create a digest for security validations when performing some modifications to SharePoint data. It adds a security token inside your page based on user, site and time. Once the page is posted back the security token is validated. Once the security token is generated it’s valid for a configurable amount of time. 

The security validation for this page is invalid: SharePoint

Scenario:
You have created a new ASPX page and trying to run it under SharePoint context. If the page Post back you get the following error “The security validation for this page is invalid.”
Reason: SharePoint uses Form validation digest to stop attacks.

Where the SharePoint team used/placed the “FormDigest” control? 

By default, default.master [v4.master in SharePoint 2010] has a “FormDigest” control. Need of it is to prevent pages from the cross-site scripting attacks. Refer to get more details here.

The Reason is we can’t do manipulations directly to the SharePoint data because of security validation in SharePoint.

When/where/why use "AllowUnsafeUpdates" in SharePoint?


As per msdn articleAllowUnsafeUpdates is set to true when you are trying to update the database as a result of the GET request”. 

E.g. Say you have a list and you want to update something to the SharePoint data [content DB], then you need to set AllowUnsafeUpdates = true for the web and after you have done you need to set it back to false. 

What will happen if you set as AllowUnsafeUpdates to false? And what is preventing it from cross site scripting attacks?  Yes, the FormDigest control is taking care of all about it. I have already explained about “FormDigest’ control in previous post. Please go through to get more on it here. 

To GET the content from the content DB, we need to set the AllowUnsafeUpdates = true. 
To POST the content to the content DB, not require to set the AllowUnsafeUpdates = true. why means because of "FormDigest" control placed in every master page.