Monday, April 30, 2012

SharePoint Interview Questions

hi,

Here are a few questions which can be usefull in a interview.
Compiled from various sources on net, I will try to keep it updated ...


What is the relationship between Microsoft SharePoint Portal Server and Microsoft Windows Services?
Microsoft SharePoint Products and Technologies (including SharePoint Portal Server and Windows SharePoint Services) deliver highly scalable collaboration solutions with flexible deployment and management tools. Windows SharePoint Services provides sites for team collaboration, while Share Point Portal Server connects these sites, people, and business processes-facilitating knowledge sharing and smart organizations. SharePoint Portal Server also extends the capabilities of Windows SharePoint Services by providing organizational and management tools for SharePoint sites, and by enabling teams to publish information to the entire organization.

What is a SharePoint Feature? What files are used to define a feature?A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, scope of which are defined as
1. Farm level 2. Web Application level 3. Site level 4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is
Installing, Uninstalling, Activated, or Deactivated.

The element types that can be defined by a feature include
menu commands, link commands, page templates, page instances, list definitions, list instances,
event handlers, and workflows.

The two files that are used to define a feature are the feature.xml and manifest file(elements.xml). The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.


Workflow can be applied to what all elements of SharePoint ?Workflow associations are often created directly on lists and libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list. In short, it can be applied ...
At the level of a list/library
At the level of a content type defined at site scope
At the level of a content type defined at list scope

What are the types of input forms that can be created for a workflow ?You can create four different types of input forms including
1. An association form
2. An initiation form
3. A modification form
4. A task edit form.

Note that these forms are optional when you create a workflow template.

What are ways to create input forms for workflow ?Two
1. You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)
2. Using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

What is the difference between method activity and event activity in WorkFlow ?A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.

What are content types?A content type is a flexible and reusable WSS type definition (or we can a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.
Can a content type have receivers associated with it?Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

What is an ancestral type and what does it have to do with content types?An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

Can a list definition be derived from a custom content type?Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

When creating a list definition, how can you create an instance of the list?You can create a new instance of a list by creating an instance.XML file

What is a Field Control?Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

What base class do custom Field Controls inherit from?This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

Can multiple SharePoint installs point to the same DB?Multiple SharePoint installs can use the same database server. Not literally the same database on that server. That server must be SQL Server 2000 or SQL Server 2005. It cannot be Oracle or another vendor.

How to create links to the mapped network drives?Creating links to mapped drives in WSS v3 or MOSS 2007 can be done via
the new content type for .lnk files.

While creating a Web part, which is the ideal location to Initialize my new controls?
Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.

What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the
SharePoint WebPart Base class
or the
ASP.NET 2.0 WebPart base class.
When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure

What are the differences between the two base classes and what are the inherit benefits of using one over another?The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure
ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

What is the WebPartManager sealed class? What is its purpose?
The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

What does AllowUnsafeUpdates do ?If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property.

What does RunWithElevatedPrivileges do?There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.
What does SPWeb.EnsureUser method do?Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.
e.g SPUser usr = myWeb.EnsureUser("hitenders");

What is a SPSite and SPWeb object, and what is the difference between each of the objects?The SPSite object represents a collection of sites (site collection [a top level site and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

What does a SPWebApplication object represent?The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

How do you return SharePoint List items using SharePoint web services?
In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.
Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

What is CAML, and why would you use it?CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.

What is impersonation, and when would you use impersonation?
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.
Each custom property that you have must have the appropriate get and set accessor methods.

What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:
allows deployment to all WFE’s in a farm
is highly manageable from the interface allowing deployment, retraction, and versioning
Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.
Can provide Code Access Security provisioning to avoid GAC deployments
And much more..

What is a .ddf file and what does it have to do with SharePoint Solution creation?A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?The solution Manifest.XML file.

What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

What are event receivers?
Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

When would you use an event receiver?Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

What base class do event receivers inherit from?Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

If I wanted to not allow people to delete documents from a document library, how would I go about it?You would on the ItemDeleting event set: properties.Cancel= true.

What is the difference between an asynchronous and synchronous event receivers?An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding

Wednesday, April 4, 2012

What came first - the chicken or the egg?

There is an extensive amount of debate on the subject of "What came first? The Chicken or the Egg?" Here are a few alternating views and personal opinions from various Answer.com users: 

The Chicken

  • The answer is the chicken because God created all the animals not all the eggs. It's easy because for those that believe in Him God made animals not eggs.
  • The chicken... it had to be because creatures in the sea evolved and they didn't evolve into eggs now did they?
  • The chicken. The chicken has to be around to lay the egg.
  • Depends on what you believe. I believe the chicken came first. Since DNA can be modified only before birth, a mutation must have taken place at conception or within an egg such that an animal similar to a chicken, but not a chicken, laid the first chicken egg.
  • The chicken came first. How would the egg survive without the chicken? I also believe there is a protein that the egg is made of that the egg can only get from the chicken.
  • Using literature, the chicken comes first.
  • Using grammar, "the chicken" comes first in the sentence (They come before the words, "the egg.")
  • In a dictionary, the word "chicken" comes before "egg."
  • Recent studies now show that the chicken came first, because of the methodology of evolution. An egg cannot occur unless a bird, or in this case a chicken, is able to lay that egg.
  • The answer is the chicken: God created all the animals and not all the eggs. It's easy because for those that believe in Him God made animals not eggs. The chicken because God wouldn't just put a egg on the earth and even if he did nothing would warm the egg for it to hatch.
  • The chicken...it had to be. Creatures in the sea evolved and they didn't evolve into eggs now, did they?
  • The chicken. It has to be around to lay the egg.
  • In the seven days that God created the earth, it makes no mention of animals' eggs. Thus, the chicken came first.
  • I say that the chicken came first because the chicken was made before the egg because God made all the animals first and birds and etc..... so the chicken came first before the egg, the eggs came when a male (rooster) and a female chicken repopulate with each other.
  • The chicken came first because, if the chicken didn't come first, there would be no egg or care for it. So, God had to make the chicken first.
  • If you are an evolutionist, you probably think that the chicken evolved from a dinosaur or something. But the chicken came first; if you think about it, how was the chicken alive before the egg.

The Egg

  • The Answer to this is the egg! the reason for this is that for an animal to change, its genetics would have to change also and this is impossible. Therefore the change would have to take place as an embryo or egg. so the first chicken was most likely spawned in prehistoric times as an embryo/egg. Concluding that the first living organism had to come from the form of an egg or embryo. 
  • The egg would have come first laid from another animal when it was hatched it was that animal but had to move its habitat so it had to adjust and became the chicken.
  • Theoretically, the egg must come first. A chicken is conceived and born in an egg; therefore, without the egg the chicken could not have been either conceived or born, it may be that the egg was the product of two different species accidentally mating to conceive the egg that contained the first, "chicken" as we know it. the egg came first, think about it logically, instead of trying to question it, there is no other logical/practical conclusion.
  • The egg came first. Two animals who really liked each other and were not the same breed, mated and the female laid an egg and it came out a chicken. They didn't know what to call it so they just named it chicken. Therefore the chicken is a crossbreed. I don't know what between though. 
  • The egg came first. Dinosaurs laid eggs for millions of years before chickens were present on Earth.
  • The egg came first because other animals i.e dinosaurs or prehistoric birds (chickens) would've laid the egg that hatched to become classed as the first chicken.
  • What came first, the prehistoric bird or its egg? The egg came first. Definitely.
  • The 'chicken or the egg' dilemma has been frequently asked as "What came first, the chicken or the egg?". This question baffles many people so it proves that the askers: 1. Have never been taught the theory of evolution. 2. Don't believe the theory of evolution. With these parameters, the answer becomes obvious. Birds evolved from reptiles, and reptiles evolved from the dinosaurs, so a dinosaur lays an egg - dinosaurs become extinct - the egg remains - and hatches into a new reptile. The older reptiles lay an egg - they evolve into birds - and a bird comes out. Well if you use common sense the egg came first. It doesn't necessarily have to be a chickens egg. The egg came first. Dinosaurs were laying them before the chicken appeared on Earth.
  • The egg, dinosaurs were laying them far before the chicken's existence.
  • The answer is the egg! For an animal to change, its genetics would have to change also and this is impossible. Therefore the change would have to take place as an embryo or egg. So the first chicken was most likely spawned in prehistoric times as an embryo/egg. Concluding that the first living organism had to come from the form of an egg or embryo.
  • The egg would have come first laid from another animal when it was hatched it was that animal but had to move its habitat so it had to adjust and became the chicken.
  • Theoretically, the egg must come first. A chicken is conceived and born in an egg; therefore, without the egg the chicken could not have been either conceived or born, it may be that the egg was the product of two different species accidentally mating to conceive the egg that contained the first, "chicken" as we know it. the egg came first, think about it logically, instead of trying to question it, there is no other logical/practical conclusion.
  • The egg came first. Two animals who really liked each other and were not the same breed, mated and the female laid an egg and it came out a chicken. They didn't know what to call it so they just named it chicken. Therefore the chicken is a crossbreed. I don't know what between though.
  • The egg came first. Dinosaurs laid eggs for millions of years before chickens were present on Earth.
  • The egg came first because other animals came before the chicken that had eggs of some kind. One kind are the fish in the seas; fish lay eggs. Another are snakes; snakes also lay eggs.
  • A chicken could not have its genetic material altered during life, so the egg must have evolved and been first.
  • If you take into account the doctrine of evolution, the egg's coming first becomes plausible on the cellular level under perfect circumstances (abundant food and resources). There will be an asexual reproduction once the environment becomes unfavorable. The species would then evolve, and a lot of animals have no parental instincts but through evolution some have started to look after their young.
  • An asexual reproduction is reproduction in which there is no fusion of male and female sex cells gametes.
  • The egg came first because the chicken descended from a dinosaur, and it laid an egg that was changed from Darwin's theory.
  • The egg came first because a chicken comes from an egg. At whatever point you decide to call the chicken a true chicken, it must have come from an egg. Because the different species before it must have evolved to make a chicken, the egg came first
  • The egg comes first because a bird a long long time ago evolving into a chicken lays an egg which hatches into a chicken.
  • An egg comes first, because dinosaurs laid eggs, and chickens didnt exist at that time.
  • Simple. The Egg.
  • Egg. I am not trained in philosophy, but my reasoning is simple and seems solid to me. If it was not born from an egg, it would not meet the definition of chicken so it must have come from an egg. A bird that is not a chicken can still lay an egg with a chicken in it if there is a genetic abnormality in the egg being laid. Because chickens were not the first life form on earth, it conforms to our current scientific understanding that the first ever chicken to be born was a genetic abnormality. Because genetic abnormalities that survive are not substantially different from the original, it is very likely that the parent of the chicken was genetically very similar to a chicken and was an egg layer. The first chicken was a genetic abnormality born from an egg that was laid by a similar parent that was not genetically similar enough to meet the definition of 'Chicken'.
  • The egg came first. Darwin's Theory of Evolution infers genetic adaptation. This adaptation occurs when parents' DNA is copied inaccurately throughout a species and the strongest of the adaptations survive. The male and female chickens DNA is copied during the mitosis/meiosis process and form the gametes that go on to form the blastocyte/morula/foetus in the egg - so the egg came first.

Neither 
  • Isn't it both? Because the chicken would have to teach the chick how to do stuff and the egg to reproduce the chickens. 
  • The chickens most recent ancestor laid the egg. Think of it this way: along the slow and steady evolution from single celled organisms to full fledged modern chickens, at some point, if you could observe every animal in that evolutionary line, you would have to say, "well, this one's not a chicken, but the next one is." The line simply must be drawn somewhere. So whatever egg that the first chicken hatched from would have come first!
  • There is no final answer but the most reasonable conclusion is that a certain breed of dinosaur laid an egg, then a period of extremely cold weather preserved the egg. Whilst that occurred the egg genetic form was rearranged into a creature similar to the chicken. At first the animal could have been very different from the chicken we know today but over time it changed into the chicken form we are so familiar with today.
  • The modern chicken was believed to have descended from another closely related species of birds, the red junglefowl, but recently discovered genetic evidence suggests that the modern domestic chicken is a hybrid descendant of both the red junglefowl and the grey junglefowl.
  • There is some disagreement about the pseudo-philosophical question "Which came first, the Chicken or the Egg?" Those of us who believe that the account of creation found in the Book of Genesis is the truth, the whole truth and nothing but the truth believe that, like everything else, chickens were created fully formed, by magic, and therefore tend to claim that the chicken must have come before the egg. Of course the Bible does not spell it out one way or the other, and for all they know, God created the chicken by causing a fertilized chicken egg to manifest first. Those of us who rely on Biblical poetry for our spiritual truth and on science for our understanding of the material world dismiss the question as childish nonsense, but if pressed will more likely claim that the egg must have "come first," having been laid by a bird that was almost, but not exactly, a chicken itself. 
  • It depends on how you see the question. The chicken might come first if "it was the result of years of genetic engineering by mother nature". The egg might have come first if "it was the result of an unexpected mutation inside another animal's (bird) egg". None of them, if "the specie was developed in centuries of slow natural selection process".
  • Let us begin our discussion with the question properly posed: "Which came first, the chicken or the egg?" Now, this is a brain-teaser, a rhetorical form called a paradox, intended to be finally unanswerable. It is not a question about natural history for which a "correct" answer may -or may not- be discovered. Trying to answer it in real-world terms is like trying to design a runcible spoon, or to find meaning in superfragilisticexpialidocious: missing the point and not getting the joke. Still, the complacency of some of the Wikianswers on the subject cannot be allowed to pass without comment, in my opinion. It is incorrect to claim that the chicken came first on Biblical grounds. God created the chicken, along with everything else, as it says in the Bible. But of course, the Bible does not spell out any of the mechanics of God's creation - that's the job of science, after all - and so for all we know from the Biblical account, God created all oviparous creatures egg-first. Clever ol' God, that's just how He would do it.
  • Isn't it both? Because the chicken would have to teach the chick how to do stuff and the egg to reproduce the chickens.
  • The chickens most recent ancestor laid the egg. Think of it this way: along the slow and steady evolution from single celled organisms to full fledged modern chickens, at some point, if you could observe every animal in that evolutionary line, you would have to say, "well, this one's not a chicken, but the next one is." The line simply must be drawn somewhere. So whatever egg that the first chicken hatched from would have come first!
  • There is no final answer but the most reasonable conclusion is that a certain breed of dinosaur laid an egg, then a period of extremely cold weather preserved the egg. Whilst that occurred the egg genetic form was rearranged into a creature similar to the chicken. At first the animal could have been very different from the chicken we know today but over time it changed into the chicken form we are so familiar with today.
  • Neither the chicken, nor the egg came first. It was the rooster that came first.
  • The egg and the chicken came at the same time. The chicken and the egg are just two different names for the same process or being. It's like water on its way to becoming ice is still water, and vice versa.
  • Darwin's theory; the chicken egg came from a different species.
  • There is no answer. Since the question is a paradox, there is no answer. If the chicken came first, it came from the egg. If the egg came first, then it came from a chicken, and so forth.
  • Evolution suggests that both chickens and eggs evolved from creatures and "egg-things" you would not recognize to be part of the lineage. (Similar to how, in the very distant past, some molecule[s] that was [were] not what we would call "life" became "life".) That was the beginning.
  • There is no correct answer that can be proven. It's all theory.
  • This question has been debated about so many times but no-one really knows. It is undecided.
  • I think its both because the chicken wouldn't have been born without a female parent and the female parent would most likely came first in an egg also given birth by the mother.

Additional information:

Without some very serious scientific intervention an egg cannot be produced independently of its parent's body, whether that parent is a chicken, a lizard, or a spider. 

So the chicken had to be there first, for the egg to form. Scientific researchers at the University of Sheffield in England published a report - see link below - in July 2010 confirming this, although their research is more concerned with shells in general: eggs were produced by the earliest egg-producing creatures millennia before chickens evolved. 

The scientists involved in this research weren't interested in solving unsolvable riddles, but in discovering more about how shells are formed. 

The question of whether the chicken or the egg came first can never be answered: it is unanswerable. One can work out which came first, the wheel or the wheeled vehicle, because one caused the invention of the other, but when we look at life-forms we cannot say with any degree of authority whether the grass seed came before the blade of grass, or whether the bird came before the egg, because life simply doesn't work in terms of traceable inventions. 

Today we can taste a delicious new strain of tomato and know the seed that produced that improved tomato was developed from tomato plants considered to be less delicious: this new seed came first, before this new tomato. But it came after the other, less delicious, tomato, and that tomato's seeds came before it, and so on...

Wednesday, March 28, 2012

Deploying a Custom WebPart to Sharepoint

Introduction

In Part 1 of this article, I discussed how to create a custom Webpart which connects to database and pull data.
In this article (Part 2), I will show how to deploy the DatabaseConn Webpart that we have created to Sharepoint site and use it in any of your sites.

Deployment Methods

We can deploy a custom webpart in 2 ways:
  1. Deploying the Assembly (i.e. DatabaseConnWebpart.dll) to GAC
    This requires the assembly to be strong named, a change in manifest etc.
  2. Other simplest way is to deploy assembly to Sharepoint Virtual Directory folder in IIS, i.e. C:\inetpub\wwwroot\wss\VirtualDirectories\80\bin
Note: Sometimes using way 2 may create trust problems, so if you encounter that issue, try copying your DLL to GAC too. It will solve the issue.

Copying Assembly to Sharepoint BIN Folder

Sharepoint Virtual directory can be found at: C:\inetpub\wwwroot\wss\VirtualDirectories\80\bin.
Copy the DLL of DatabaseConnWebPart that we created from your project folder and paste it in the bin folder of portal directory and also GAC, c:\windows\assembly (if you encounter any trust issues).

Adding the Safe Control Entry

Even though the assembly is present in the Portal’s Bin folder, there is another step required to make the Control (Web Part) assembly usable on the Portal Pages.
Since the control will need to render on multiple machines in different browsers with as many user accounts as the organizations have, there is a need to declare the control as “safe”.
To do so, open the web.config file of Sharepoint portal placed under the portal’s directory, and look for <SafeControls> node in web.config and add the following Safe control code:
// Check for this node

<SafeControls>
………..
………....

// Add this line of code which ensures webpart is safe

<SafeControl Assembly="DatabaseConnWebPart " Namespace="DatabaseConnWebPart "
    TypeName="*" Safe="True" />

</SafeControls>
Now that we declared the webpart as safe, our webpart will be deployed to Sharepoint Portal.

Configuring Portal to Use NewWebPart

Open your Sharepoint portal and on your “Home”, click Site Actions -> Site Settings -> Modify all Site Settings as shown in this figure:
SiteSettings_small.jpg
Sharepoint will open the Settings page.
Click “Webparts” under Galleries as shown below:
webparts_small.jpg

Adding Custom Webpart to Webparts Gallery

Click “New” in toolbar to add a new webpart as shown below:
WebPartGallery_small.jpg
Sharepoint will open the webparts gallery, choose your DatabaseConnWebPart from the gallery and check the checkbox to the left of webpart and click Populate Gallery on top as shown below.
Note: You can rename your webpart anyway you want. Use the TextBox provided to the right of your webpart to rename it accordingly.
NewWebPart_small.jpg
Now we have successfully added our new custom web part to Sharepoint portal. We can go ahead and use that webpart in any site that we want.
Note : If you want to make sure whether your webpart is added to gallery or not, check the Webpart Gallery page. It should have your webpart.

Using DatabaseConnWebPart in Site

To use our new deployed webpart in a site, open the site and Click Site Actions -> Edit Page.
This will show the site in edit mode, now click "Add a WebPart" as shown below:
AddwebPart_small.jpg
This will open the Add WebPart dialog box. Choose your webpart (in Miscellaneous section) and check it and click "Add" as shown below:
Add_webparts_-WebPage_Dialog.jpg
This will add the webpart to your home page and now your homepage as shown below:
HomepageWithWP_small.jpg

Conclusion

This is how we can create custom webparts, deploy them to Sharepoint server and use them in our sites.
Happy programming!!!

Accenture Sharepoint Interview Questions Sharepoint 2010/2007

1) Tell me about your sharepoint experiences ?


2) Did you ever worked in Web Services ? How you called Webmethods ?


3) What type of Webparts you are developed in your current project ?


4) How many ways we can deploy the webpart ?    Which is the best method to deploy the Webpart ?


5) What are new features in MOSS 2007 ?


6) What are the permission levels in Sharepoint ?


7) What is Sharepoint Object Model ?


8) What are basic building blocks for Sharepoint ?


9) How many types of Event Handlers in Sharepoint ? where did you use these event handlers in your project ?


10) What are the Security levels in Sharepoint ?


11) What is the default authentication level in Sharepoint ?


12) Can we impliment Forms Authentication in Sharepoint or is there any custom Authentication ?


13) What is meant by SignIn ?


14) What is meant by MetaData Cache ?


15) How can you impliment Data Fragment cache ? What is VaryByParam ?


16) When configuring Enterprise Search 

Wednesday, March 21, 2012

Creating a Search Content Source of type Web using PowerShell


The New-SPEnterpriseSearchCrawlContentSource command in Powershell is used to create a new crawl content source for a SharePoint search application.We can view the whole set of parameters and options in this msdn article.
So , when we need to create a SharePoint Search content source, using Powershell, we use the following commands-
$searchapp = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type SharePoint -name ContentSourceWithTypeSharePoint -StartAddresses http://localhost:6001/

Configuring the User Profile Service in SharePoint 2010


I first introduced Service Applications and User Profile Service Synchronization back when SharePoint 2010 was in beta, and as many of you who would have attempted this feat, would have come to realize that there were a couple of known issues, in particular those around utilizing a least privilege model with service accounts.  I’m confident in stating that these issues have now been resolved with RTM and in today’s article I will share with you my step by step guide in setting up the User Profile Service application, focusing on its configuration and administration and how we can enable the creation of user profiles via an Active Directory import .
SharePoint 2010 introduces the notion of “Service Applications” which build’s upon the “Shared Services Provider (SSP)” which was introduced in SharePoint 2007.  Service Applications are individual services that can be configured independently and can be shared across other sites within your farm with some service applications that can also be configured across farms.
The individual service applications provided with SharePoint 2010 are listed as follows;

  • Access Services
  • Business Data Connectivity
  • Document Conversion
  • Excel Services
  • Managed Metadata Service
  • PerformancePoint
  • Search Service
  • Secure Store
  • State Service
  • Visio Graphics Service
  • User Profile Service
This article will build upon our initial SharePoint 2010 install utilizing the least privilege model which I have documented here, so check it out if you haven’t already done so.
Managed Metadata Service
The User Profile service requires that the Managed Metadata Service is setup and configured first before attempting setting up our first User Profile Service.  The Managed Metadata service allows you to utilize managed metadata and provides you with the ability to share content types across sites.  You can read more about Managed Metadata here.
To setup our Managed Metadata Service, navigate to Central Administration / Application Management / Manage Service Applications.
Click New and select “Managed Metadata Service”
Enter the follow details;
Name: Managed Metadata Service
Database Server: <server_name>
Database Name: Managed Metadata DB

I will utilize the sp_farm account for the Application Pool Identity.
image thumb56 Configuring the User Profile Service in SharePoint 2010

Click Create.
Lastly, navigate to Central Administration / System Settings / Manage services on server and start the Managed Metadata Web Service.
image thumb57 Configuring the User Profile Service in SharePoint 2010

User Profile Service
Now that we have successfully configured our Managed Metadata service we can now focus our attention on the User Profile Service.  The User Profile Service provides our SharePoint farm with all the social networking features that we have come to love in SharePoint 2007, plus more.  It forms the basis of My Site support, User profile pages, Audiences and some of the newer features in SharePoint 2010 social computing such as social tagging.
Before we begin, we need to ensure that our Farm account (DOMAIN\sp_farm) is listed as a member of the Local Administrator’s group where the User Profile Synchronization (UPS) service will be deployed.  Please make a note to remove the DOMAIN\sp_farm account from the Local Administrator’s group after provisioning the User Profile Synchronization service.  Please also note, that if you ever have to re-provision the UPS service at a later date, that you will need to ensure the DOMAIN\sp_farm account is added back to the Local Administrator’s group.
Let’s now navigate to Central Administration / Application Management / Manage Service Applications.
Click New and select “User Profile Service Application”
image thumb58 Configuring the User Profile Service in SharePoint 2010

The “Create New User Profile Service Application” window pops up in which you will enter the following details; (you will obviously enter in the details based on your environment setup)
Name: User Profiles
Create new application pool: SharePoint – User Profiles
image thumb59 Configuring the User Profile Service in SharePoint 2010

Register a new managed account: e.g. DOMAIN\sp_userprofiles (nb: this account will need to be provisioned in Active Directory first)
image thumb60 Configuring the User Profile Service in SharePoint 2010
Enter your Profile Database server details and database authentication.  You will notice that SharePoint 2010 introduces the ability to configure Failover Server which allows you to associate your SharePoint databases with another SQL server for failover purposes utilising SQL Server database mirroring.   We will not specify a Failover Database server for any of our databases at this present time.
image thumb61 Configuring the User Profile Service in SharePoint 2010
Specify your Synchronization Database which is used to store configuration and staging data for synchronization of profile data such as that from Active Directory.
image thumb62 Configuring the User Profile Service in SharePoint 2010
Next, specify your Social Tagging Database which is used to store tags and notes that are created by users.  Social Tagging is a new feature in SharePoint 2010 which is not only displayed against the items that user’s are tagging, but are also displayed in the user’s activity feed.
image thumb63 Configuring the User Profile Service in SharePoint 2010

Next, select your Profile Synchronization Instance Server.
In the proceeding section, we will not create a My Site Host URL and will leave this for part two of this series.
Click Create
image thumb64 Configuring the User Profile Service in SharePoint 2010
You should now have the User Profiles service application listed and  started.
image thumb65 Configuring the User Profile Service in SharePoint 2010

We will now venture back into Central Administration / System Settings / Manage services on server.
Scroll down to the User Profile Service and User Profile Synchronisation Service and start both.  The User Profile Service should start without any further user interaction, however the User Profile Synchronization Service will ask for your SharePoint Farm credentials.
image thumb66 Configuring the User Profile Service in SharePoint 2010

Click Ok.
Both services should now be listed as started.
image thumb67 Configuring the User Profile Service in SharePoint 2010
This in turn, will correctly configure and start our ForeFront Identity Manager Windows Services (FIM).
image thumb68 Configuring the User Profile Service in SharePoint 2010

At this point, it is imperative you run an IIS reset.  Even better, just reboot the machine icon smile Configuring the User Profile Service in SharePoint 2010
We will now configure our User Profile Connection to our Active Directory Domain.
Navigate to Central Administration / Application Management / Manage Service Applications.
Click on User Profiles / Manage.
image thumb69 Configuring the User Profile Service in SharePoint 2010

Click on Configure Synchronizations connections / Create New Connection.
Enter the follow details;
Connection Name:
Type: Active Directory
Auto discover domain controller or specify a domain controller
Authentication Provider Type: Windows Authentication
Account Name / Password:
Port: 389
image thumb70 Configuring the User Profile Service in SharePoint 2010
Click on Populate Containers
image thumb71 Configuring the User Profile Service in SharePoint 2010

Click OK.
Your connection should now be listed as follows upon successful creation
image thumb72 Configuring the User Profile Service in SharePoint 2010
image thumb73 Configuring the User Profile Service in SharePoint 2010
Next we will Configure a Synchronization Timer Job via Central Administration / Application Management / Manage Service Applications / User Profiles.
image thumb74 Configuring the User Profile Service in SharePoint 2010

Click Enable
We will finish off by initiating a full synchronization via Central Administration / Application Management / Manage Service Applications / User Profiles / Start Profile Synchronization.
image thumb75 Configuring the User Profile Service in SharePoint 2010
In order to confirm that the import was a success, the Number of User Profiles should now be set to the number of users in your organization, in my case I have 269 dummy users in my Active Directory domain.  Word of note; this will take some time and is considerably slower than an Active Directory User Profile import in SharePoint 2007.
image thumb76 Configuring the User Profile Service in SharePoint 2010
You can also venture into Manage User Profiles and search for users (please take note that SharePoint 2010 does not display any users by default and that you will have to search for them).
image thumb77 Configuring the User Profile Service in SharePoint 2010
Edit a User Profile to ensure that all the necessary Active Directory attributes were successfully imported.
image thumb78 Configuring the User Profile Service in SharePoint 2010

We have now successfully completed a User Profile Synchronization which will form as a basis for User’s My Sites in my next article.  Until then, happy SharePointing!!
References
User Profile Service administration (SharePoint Server 2010) http://technet.microsoft.com/en-us/library/ee721050.aspx
Configure profile synchronization (SharePoint Server 2010) http://technet.microsoft.com/en-us/library/ee721049.aspx













Installing and Configuring Remote BLOB Storage

I’m sure you realize that nothing is perfect. That includes Microsoft SQL Server, and even if
you believe it’s the best database server in the world, it can still get overloaded and crowded
with data. It also doesn’t deal as well with unstructured binary files as it does with structured
data, and a lot of data is unstructured in binary large object (BLOB) files. If only there were
some way of using an external data store to contain those binary data files for SharePoint.
Now there is.
Installing and configuring Remote BLOB Storage (RBS) lets you store your BLOB data
with an EBS provider so that both your structured and unstructured data is being placed
in, housed in, and retrieved from the optimal storage types for those data forms.
This doesn’t mean that you absolutely must use RBS, and you certainly can store your
unstructured data files in SQL, but it’s not the best solution available, particularly if data
access and retrieval is important, and it almost always is. Although setting up RBS may be
more work, it often is worth the effort. If you choose to employ the RBS option, you face
three basic tasks:
1.
Enabling the FILESTREAM and provisioning the RBS data store
2.
Installing the RBS
3.
RBS is a library application programming interface (API). It’s integrated as an add-on
feature for both Microsoft SQL Server 2008 and Microsoft SQL Server 2008 Express and
is designed to move BLOB data stored on database servers to what is called
storage solutions
provider, which uses the RBS APIs to store BLOBs.
This work is done on Microsoft SQL Server, and as a SharePoint administrator, you may
not have a hand in performing the following tasks. However, since this feature is tied directly
to SharePoint Server 2010, the information is presented, and in a small enough company or in
a large company with limited IT resources, you may need to have these skills.
The following tasks require that you belong to the Administrators group for all the web
servers and application servers in the server farm. You must also belong to the dbcreator
and securityadmin fixed server roles on the computer running SQL Server 2008 or SQL
Server 2008 Express.
Enabling the FILESTREAM and Provisioning the RBS Data Store
The first task you must perform is to enable
FILESTREAM on the SQL Server instance:
1.
appears, click Microsoft SQL Server 2008.
On the computer running SQL Server, click Start All Programs; in the list that
2.
Manager.
In the list that appears, click Configuration Tools and then click SQL Server Configuration
3.
and then click Properties.
4.
the Enable FILESTREAM For Transact-SQL Access check box.
In the SQL Server Properties dialog box, click the FILESTREAM tab and then select
5.
the Windows share in the Windows Share Name field if you want to read and write
FILESTREAM data from Windows.
Click Enable FILESTREAM for file I/O streaming access and then enter the name of
6.
remote clients are required to access FILESTREAM data on the share.
Select Allow Remote Clients To Have Streaming Access To FILESTREAM Data if
7.
Click Apply.
8.
Management Studio.
Click Start All Programs Microsoft SQL Server and then select SQL Server
9.
In SQL Server Management Studio, click New Query to open the Query Editor.
10.
In the Query Editor, enter the following and then click Execute:
EXEC sp_configure filestream_access_level, 2
RECONFIGURE[
Now that FILESTREAM is enabled, you need to provision the BLOB store in SQL Server:
1.
step 8 of the previous task and then expand Databases.
On the SQL Server instance, open the SQL Server Management Studio as shown in
2.
New Query.
Select the content database for which you want to create the BLOB store and then click
3.
you see here. You must replace
replace
In the Query pane, enter and execute each of the following SQL queries in the sequence[WSS_Content] with the actual content database name andc:\BLOBStore with the volume/directory where you want the BLOB store created.
In the SQL Server Configuration Manager, locate the desired SQL Server, right-click it,
Enabling and testing the RBScommodityor third-party RBS storage. RBS comes with the RBS FILESTREAM