Thursday, October 29, 2009

MOSS Interview Questions

1. 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.

C#:
using(SPSite mySite = new SPSite("yourserver"))
{
using(SPWeb myWeb = mySite.OpenWeb())
{
myWeb.AllowUnsafeUpdates = true;
SPList interviewList = myWeb.Lists["listtoinsert"];
SPListItem newItem = interviewList.Items.Add();

newItem["interview"] = "interview";
newItem.Update();
}
}

2. What does RunWithElevatedPrivileges do?
Assume that you have a Web Part in which you want to display information obtained through the Windows SharePoint Services object model, such as the name of the current site collection owner, usage statistics, or auditing information. These are examples of calls into the object model that require site-administration privileges. Your Web Part experiences an access-denied error if it attempts to obtain this information when the current user is not a site administrator. The request is initiated by a nonprivileged user. you can still successfully make these calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.
C#:
SPSite siteColl = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate() {
using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID)) {
using (SPWeb ElevatedSite = ElevatedsiteColl.OpenWeb(site.ID)) {
string SiteCollectionOwner = ElevatedsiteColl.Owner.Name;
string Visits = ElevatedsiteColl.Usage.Visits.ToString();
string RootAuditEntries =
ElevatedSite.RootFolder.Audit.GetEntries().Count.ToString();
}
}
});

3.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, such as at the farm, site collection, web, etc. 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.


4. What are content types ?
A content type is a flexible and reusable WSS type definition 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 customer presentation document with a unique set of columns, an event handler, and its own document template. You can create a second content type for a customer proposal document with a different set of columns, a workflow, and a different document template.

5. Workflow can be applied to what all elements of SharePoint ?
While workflow associations are often created directly on lists and document 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 (or document library)
At the level of a content type defined at site scope
At the level of a content type defined at list scope

6. What are the ways to initiate the workflow ?
1. Automatic
2. Manual (standard WSS UI interface)
3. Manual (Custom UI Interface)

7. What are the types of input forms that can be created for a workflow ?
You can create four different types of input forms including an association form, an initiation form, a modification form, and a task edit form. Note that these forms are optional when you create a workflow template.

8. What are ways to create input forms for workflow ?
Two different approaches can be used to develop custom input forms for a WSS workflow template.
a. 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)
b. using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

9. What is the difference between method activity and event activity in WF ?
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.

10. 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("mmangaldas");

11. While creating a Webpart, which is the ideal location to Initialize my new controls ?
Override the CreateChildControls method to include your new controls. To make sure that the new controls are initialized.. call 'EnsureChildControls' in the webparts Render method. You can control the exact Rendering of your controls by calling the .Render method in the webparts Render method.

12. How to query from multiple lists ?
Use SPSiteDataQuery to fetch data from multiple lists. more details..

13.How Does SharePoint work?
The browser sends a DAV packet to IIS asking to perform a document check in. PKMDASL.DLL, an ISAPI DLL, parses the packet and sees that it has the proprietary INVOKE command. Because of the existence of this command, the packet is passed off to msdmserv.exe, who in turn processes the packet and uses EXOLEDB to access the WSS, perform the operation and send the results back to the user in the form of XML.

13. What is the difference between Syncronous & Asyncronous events?
Syncronous calls ending with 'ing'
E.g. ItemDeleting
Event Handler code execute BEFORE action is committed
WSS waits for code to return
Option to cancel and return error code

Asyncronous calls ending with 'ed'
E.g. ItemDeleted
Event Handler code executes AFTER action is committed
WSS does not wait for code to return
Executed in its own Worker thread.


14. What is ServerUpdate() ?
Any changes in the list, i.e. new addition or modification of an item.. the operation is complete by calling the Update method.

But if a List is set to maintain versions .. and you are editing an item, but don't want to save it as a new version, then use the SystemUpdate method instead and pass in 'false' as the parameter.


15. What is query.ViewAttributes OR How can you force SPQuery to return results from all the folders of the list?

If you use SPQuery on any SPlist .. it will bring back results from the current folder only.
If you want to get results from all the folders in the list.. then you need to specify the scope of the query by the use of ViewAttributes..
e.g. query.ViewAttributes = "Scope=\"Recursive\"";

How Branding can be achieved by Master Pages? What are the advantages or disadvantages of Master Pages?
Does sharepoint provide any way to grant read-only access to all the users of the company on the portal?
What are the steps to create a web-part?
What does the webpart .cab file include?
What are the benefits of using Infopath?
What are the different namespaces per Sharepoint Object Model?
What are the different Back-up and Restore methodologies?
What are the steps in running a custom WebService under the context of SharePoint?
How can you display content from one site in another under the same site collection ?
How to Create a custom list form?

Wednesday, October 28, 2009

Ways of Appreciation

Any form of appreciation makes a person happy and valued. It gives the impression that the employee is efficient and thus deserves some form of acknowledgement. Appreciation does not wait for time or occasion. Whenever the employee delivers commendable work, a small act of appreciation can be a great boost to their morale.

The most common form of appreciation is through gifts or increments. Gifts like chocolates or something that interests the particular employee can be bequeathed. Cash prizes or coupons can be awarded so that the employee gets some extra income. No matter how small the gift is, it can be the biggest motivating factor.

An appreciation letter can be an asset for any employee. It leverages the career prospects of the employee. It portrays that the employee was very good at his/her task and thus can be regarded as a worthy employee.

A simplistic way of appreciating is saying thank you or praising their efforts. As the employee has contributed whole heartedly for the organization, expressing gratitude for the same makes the employee keep up the good work. Also their names can be displayed on notice boards as performers of the month or week.

If a team effort needs to be appreciated, the whole team can be taken out for a pleasure trip or a small feast. Acknowledging them with claps in front of the whole workforce reinforces their spirit. It also instigates others to perform and receive the same commendation.

An efficacious employee longs to receive opportunities to flourish in his/her trade. Training such employees to be better will guarantee fruition to both the company and the employee.

Every employee requires to be appreciated and the medium of appreciation can vary or can be developed. What is important is that the employees receive his/her due as it can make them feel esteemed and execute quality work.

~ Gangadhar Kotu

Saturday, October 17, 2009

Trip to Kurnool flood victims

Today morning, I had booked the tickets to Kurnool and return too. My bus would start by 9PM from Majestic, Bangalore. We had already purchased the items to be distributed to flood victims near by Kurnool.

** I had spent my Diwali time with flood victims in Kurnool areas by distributing some of the needy items. **

17-Oct-2009 7:15 PM Started from my home to Majestic, the bus took more than an hour. At the end the bus was not moving from Majestic theatre. So took a chance to walk down to Majestic bus stand.
17-Oct-2009 8:35 PM I had met the friends Kumar (Actually Kumar is started a new trust called 'SahayamIndia' to service the public, where ever he can) and Mohan there. So the trip started with the efforts of Kumar only. God bless you Kumar.
17-Oct-2009 9:10 PM Actual Journey has been started and probably by 11PM, the bus has been stopped for dinner and had hot hot Roti and Veg curry at Chikka Ballapur area.
18-Oct 2009 6:00 AM got down at Kurnool and doesn't feel like some flood came there and went to Hotel S.V.Regency (for fresh up). While going to hotel through Auto, we were noticed the mud marks on the walls. We were inquired Auto driver (didn't ask his name) about the situation. He was explaining us like "there are areas where the water has come till mid of third floor". We met Mr. Mallikarjun (NGO, from SERUDS, Kurnool) at Hotel and asked us to get ready by 8:00 AM - 8:30 AM. Other friend (Murali) also joined us by 7:15 AM.
18-Oct 2009 8:50 AM, Had a good and nice break fast at Hotel Amaravathi deluxe, which quite opposite to Hotel S.V.Regency.

Post break-fast, we were going by Auto to SERUDS office and kind of struck in traffic jam (also traffic police was present). The traffic jam was because of about more than 50 tractors (>50) were lined up at Agricultural Market Committee Yard. I had inquire with Auto driver (Mr. Reddy) and got to know that they are clearing up all the mud piled up in the yard up to 2 feet.

Yes, we had reached SERUDS office (Location Budhavara Peta)
SERUDS and below is the team namely Kumar Mukkala (Founder of Sahayam India), Gangadhar Kotu, Mohan Vayyala, Muralidhar Reddy. The house almost dried up but no roofAlso checked the stock of items (200kgs of Rice, 100 kgs of Dal, 100 litres of Refined Sunflower Oil, 200 bath soaps, 200 washing soaps).

After 15-20 mins, we wore masks as going to all flood effected areas as a precaution. We have started the camp from here. The following is the map of what areas we had visited.
******* Map image
a. Have been to Mala giri and met the people there. Understood that they have lost everything and some of the houses are not in a position to enter in. Power was still an issue in the houses here. They are getting power only during the day time and no power during night times as the house walls are still wet.
NGO explaining the situation to our Team


b. Have been to Madhiga giri and met the people there. Here there is no big loss to the houses as almost all are buildings.
The house almost dried up but no roof
The areas a &b got flooded with water almost 35-40 feets height and people used small boats to go to the better places. In both the areas the people are daily wages couple of days back. But now, they are workless, homeless, foodless and even hopeless for some days as no one are visiting them and giving a hope. No govt officials are visiting them.
c. Have been to One town and people are still showing the flood marking points.
The house almost dried up but no roof
d. Have been to Kummara veedhi and observed that the Muncipal employees are now trying to clear off the mud from the places. In some of the streets, water was still there which was not even floating. We were observed that they are still cleaning up the bowls (which still had mud...). The area got flooded with water almost 20-25 feets height.
Mud in the placesStill water in the roadsCleaning up the bowls
e. While going towards to Jammi Chettu centre, we have observed that the school was complely with the mud and no one is clearing them. A small picture was taken there and also can be observed the car, books (including Khuran) left unattended.
Muslim SchoolThe house almost dried up but no roofMuslim booksCar in the mud
We just move forward to see how the Tungabadra and Handri rivers were sweeped off the areas. While on the way, my god, it was horrible, we were seeing in TV channels only but upfront here. There was a lorry of goods to be distributed and people are rounded around the lorry and rised up their hands to catch which ever can hold. And the people in the lorry are throwing items (rice, dal, water, ashirwad atta,....) over the air. Somebody are getting them because they are jump and catch them. Some of the goods are ground touched and there are people to even get them.
The house almost dried up but no roofThe house almost dried up but no roof
The following click would give you a real-time feel, who is even trying to get those ground touched food grains.
The house almost dried up but no roof
There was some worse here, somebody scolding her not to pick that grains. But how does the others knows what kind of hungry they are in. Heart touching .. huh?
The following picture shows you what was the level of flood in the river area. You can observe the dry rice leaves (వరి చెత్త) are hanging to the power lines (main grid lines).
The house almost dried up but no roof
You can also observe there are lots of rice bags (wet in flood water) which got wasted during the time.
The house almost dried up but no roof
The following is the cinema hall in that area.
The house almost dried up but no roof
While moving towards Adarsh Nagar/ near by Chanakya puri, I felt like more thirsty and drunk water. We went to Adarsh Nagar (earlier it was posh area) and understood that almost all the houses are getting vacated and moved to other areas even though less affected with the flood (kind of 8feets height). Luckily because of Dasara holidays, the Montissori School was closed otherwise there would have been a big issue to almost 3000 students.

By now, almost the visiting camp was done and back to SERUDS office. We were started packing the items to be distributed. I felt here like the items would not be sufficient for the people. But we were tried our best to serve atleast to some of the people.

We were actually planned to help 100 people and also distributed the tokens to the people. And were involved in packing the items to each. The items in each packet are 2kg of Rice, 1kg of Dal, 1litre of Refined Sunflower Oil, 2 bath soaps and 2 washing soaps.
The house almost dried up but no roof
Once the packing was done, we all went to Hotel Meenakshi and had nice lunch there.
By the time, we were back to office, there are almost 35-40 people are waiting for us in the sunny area. We just took rest for a minute or two and started distributed the packets. Going on fine.. Rajesh is clicking us here..
The house almost dried up but no roof
One woman came who doesn't have a token (means, she is not from the selected area but affected one), so had asked her to wait for sometime by saying "we would give you if anything left". She was scolding, cursing like why don't you select us (people living after the graveyard area; seems to be no one is going that area) also as we also lost everything. Kind of telugu version of the cursings [అయ్యా, మేము సమాధుల అవతల ఉంటాము. మమ్మల్ని ఒక్కడన్నా పట్టించుకోని చావడం లేదు. కనీసం మీరైనా పట్టించుకోండి. ఏఁ మీరైనా పట్టించుకోని చావచ్చు కదా! మాకు ఇవ్వకుండా మీరేమి బాగు పడతారులే? ]
People are coming.. and collecting, ....... coming.. coming & collecting .... ....

In between, there were other 5 women (inlcuding old aged [75-80] beggar) of same kind who doesn't have tokens. We sent 2 of them returned to get the tokens. We were sure that we could really give them but like to wait till all the token holders are collected. But they were not even ready to wait till that time. I personally convinced them to wait for sometime, ofcourse the other woman was waiting since 90 mins to 120 mins time, she had rised up like anything.. you will be destroyed, not get anything... OH MY GOD.. lots of cursings even for the good work (మీరు బాగుపడరు, మీరు నాశనమై పోతారు, ...). We understood her angryness, hunger feel and not to consider her cursings but helped our best with other victims.
4:30 PM, There was no point of waiting for other token holders and given 4 packets to these non-token holders. Still 4 more packets are pending for distribution. We had asked Akshay (attender) to distribute them to other token holders.
4:40 PM, Left from office to Konda Reddy Buruju (the fort from '' movie), Right behind, there was a Police Parade ground (below picture), which was completely gone with the flood.
Police Parade grounds, SP Office
5:10 PM, Went to Tungabadra river. The house almost dried up but no roofThe house almost dried up but no roofCross by, we also a look at ex MLA 'T.G.Venkatesh' house. It was not a house but a modernized fort. It was just on the bank of the river. Even his whole house was filled with flood water. If you see the area outside his house, all are occupied with thick mud of almost 3/4 feet height, which was still unattended and disgusting smell.

I was always being involved in a Public Relation matters (not only here, I did the same when I went to Kakinada fisher men place to distribute general medicine to them in Mar'2005). I was more happy to directly meet the victims and help them with my hands.
I am also in the plans of starting a charitable trust (the name would be "Sanjit Ram Kotu Charitable Trust") to help the poor people, old age people, ....

Happy Service. Serve the needy people. !!

~ Gangadhar Kotu