Loading...

Sharepoint Question of the Week

Here i m going to add questions weekly.. which is based on practical scenarios in sharepoint development..

some more good questions link

Sharepoint 2010 presentations
My Quick learning tips  as follows
1)always go through  the presentations (ppt/pptx) or videos before reading any book or article
2)Prefer reading the articles/books having sufficient number of  Images and Colors for quick learning.
3)Use Different techniques  for reading like Speed reading

*)Whats New In Sharepoint 2010?

1)Why do you know about AllowunsafeUpdates and SPUtility.ValidateFormDigest() ??







2)What is SPSecurity.RunWithElevatedPrivileges?
Its delegate for
Executing code which  requires high level permissions .
protected void Button1_Click(object sender, EventArgs e)
{
   SPSecurity.CodeToRunElevated elevatedGetSitesAndGroups = new SPSecurity.CodeToRunElevated(GetSitesAndGroups);
   SPSecurity.RunWithElevatedPrivileges(elevatedGetSitesAndGroups);
}
SPSecurity.RunWithElevatedPrivileges(delegate()
{
    // implementation details omitted
});

SharePoint 2010 adds a new property that allows us to pick

up the security token of the originating user and make use of it to switch security context
Above code executes with high security authentication but  security context can not  be reverted back


Trace.Write("Updating receiver running as : " + properties.Web.CurrentUser.Name);

using (SPSite site = new SPSite(properties.SiteId, properties.OriginatingUserToken))
{

using (SPWeb web = site.OpenWeb(properties.Web.ID))

{

Trace.Write("originating user was : " + web.CurrentUser.Name);

}

}


Impersonating to Another User
private static void DemonstrateElevation()
{
using (SPSite site = new SPSite(siteUrl))
{
SPWeb web = site.OpenWeb();
Console.WriteLine(web.CurrentUser.Name);
}
Console.Read();
using (SPSite site = new SPSite(siteUrl))
{
using (SPSite otherUserSite =
new SPSite(siteUrl, site.RootWeb.AllUsers["domain\\johndoe"].UserToken))
{
SPWeb web = otherUserSite.OpenWeb();
Console.WriteLine(web.CurrentUser.Name);
}
}
Console.Read();
}

*)What are types of pages in Sharepoint?
  Application Pages 
  Application pages are loaded from file system.

  Site Pages
  Site pages are loaded from  Content Database.

 Different site Pages :Webpat Pages/Standard Pages/

*)What is diffrence in ghosting and ungosting?

How to deploy custom application Page as feature?




Sharepoint Webparts

[type :Best Practice]

How to apply JavaScript to Webparts? 
 
In Sharepoint 2010
public class IndividualAppointment : WebPart
{
protected override void CreateChildControls()
{
this.Controls.Add(
new ScriptLink()
{
ID = "SPScriptLink",
Localizable = false,
LoadAfterUI = true,
Name = "sp.js"
}
);
this.Page.ClientScript.RegisterClientScriptInclude(
"IndividualAppointmentScript",
ResolveClientUrl("/IndividualAppointmentScripts/appointment.js"));
base.CreateChildControls();
}
protected override void RenderContents(HtmlTextWriter writer)
{
writer.WriteLine("

Which OOB javascript is responsible  for loading the Modal Popups?
SP.js

What are the best practices for developing webparts

Introduction
Handle All Exceptions to Prevent Web Part Page Failures
Check Permissions Before Rendering Your Web Part and Customize the User Interface Accordingly
Validate Properties Whenever You Attempt to Save Changes to the Database
Specify Custom Error Messages When Appropriate
Validate All User Input
Register the Client-side Script Shared by Multiple Web Parts to Improve Performance
Specify Whether Web Part Properties Can be Exported
Implement the IDesignTimeHtmlProvider Interface in Your Web Part to Ensure Correct Rendering in FrontPage
Make Properties User-Friendly in the Tool Pane
HTMLEncode All User Input Rendered to the Client
Check Web Part Zone Properties Whenever You Attempt to Save Changes to Your Web Part
Use Simple Types for Custom Properties You Define
Make Properties Independent of Each Other if They both Appear in the Tool Pane
Make Web Parts Easily Searchable in the Galleries
Provide a Preview of Your Web Part for the Web Part Gallery
Techniques to Improve Web Part Performance
Localize Your Custom Property's FriendlyName, Title, and
Videos
http://www.endusersharepoint.com/2009/08/27/live-blogtweetsvideos-from-best-practices-available-as-archive/

[type :common]
When webpart dll is stored in GAC and when i directories bin folder?
A hybrid approach is to deploy the DLL to the web application’s BIN directory, much like you would when using Code Access Security, but you would also set the trust level of that web application to “Full” from the standard “WSS_Minimal.” Changing this trust level is analogous to deploying the code to the GAC whereas the code is fully trusted by the server, but having the DLL in the BIN adds a level of inaccesibility by other web applications. This is my current preferred method for deploying customizations since it gives me more flexibility in properly scoping my solutions and at the same time not as complex as having to implement CAS for everything.


What is webpart ? How does it work in sharepoint?
elements can be configurable or sometimes these events can talk to each other. These elements occupy rectangular areas on a web page.

What are the different namespaces for sharepoint Webpart?
System.Web.UI.WebControls.WebParts.WebPart
Microsoft.SharePoint.WebPartPages(Backward Compatibility with wss2.0)

Sharepoint Page life cycle?Why its required to understand?
http://platinumdogs.wordpress.com/2008/10/14/sharepoint-webpart-lifecycle-events/


Sharepoint How to handle Postbacks in Sharepoint Webpart ?


What is custom editor part ? how it is implemented?

In sharePoint 2010,
Writing a custom editor for a WebPart is rather simple and involves two steps. First, your WebPart has to implement the IWebEditable interface, and second you have to implement a class that inherits from the EditorPart abstract base class.
#region IWebEditable Members
��
EditorPartCollection IWebEditable.CreateEditorParts()
{
List editors = new List();
editors.Add(new OPMLEditor());
return new EditorPartCollection(editors);
}
object IWebEditable.WebBrowsableObject
{
get { return this; }
}
��
#endregion


public override bool ApplyChanges()
{
EnsureChildControls();
//Get the value of Editor part Control And Assign to  Webpart property
}

public override void SyncChanges()
{
EnsureChildControls();
OPMLWebPart part = WebPartToEdit as OPMLWebPart;
if (part != null)
{
//retrieve webpart property and assign to Editor part Control
}






Explain button click event in webpart?

[type:Tricky]
What is webpart verbs?how to customize it?
Those are Action Items for selected webpart,

Customize using WebPartVerbCollection and Event Handler

public override WebPartVerbCollection Verbs
{
get
{
WebPartVerb customVerb = new WebPartVerb("Manager_Filter_Verb",
new WebPartEventHandler( ));

customVerb.Text = verbText;
// Replaced: Hard-coded description with localized string.
customVerb.Description = HttpContext.GetGlobalResourceObject("Resource1", "String4").ToString();
WebPartVerb[] newVerbs = new WebPartVerb[] { customVerb };

return new WebPartVerbCollection(base.Verbs, newVerbs);
}
}

protected void CustomVerbEventHandler(object sender, WebPartEventArgs args)
{
int titleColumn = 2;

foreach (DataGridItem item in grid.Items)
{
if (item.Cells[titleColumn].Text != "Manager")
{
if (item.Visible == true)
{
item.Visible = false;
}
else
{
item.Visible = true;
}
}

}
// if (verbText == "Show Managers Only")
if (verbText == HttpContext.GetGlobalResourceObject("Resource1", "String5").ToString())
{
// verbText = "Show All Employees";
verbText = HttpContext.GetGlobalResourceObject("Resource1", "String5").ToString();
}
else
{
// verbText = "Show Managers Only";
verbText = HttpContext.GetGlobalResourceObject("Resource1", "String3").ToString();
}
}

[type:General ]
What are the Connected Webparts?How it is implemented?

1)Implement Interface which is inherited by Both Consumer webpart which receives the properties value, defined in interface
and Provider Webpart which assigns value to the property of interface
public interface IRSSFeedContract
{
String RSSUrl { get; set; }
}

Consumer Webpart
[ToolboxItemAttribute(false)]
public class RSSWebPart : WebPart, IRSSFeedContract
{
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.Shared)]
public string RSSUrl { get; set; }
protected override void RenderContents(HtmlTextWriter writer)
{
RSSFeed feed = new RSSFeed(RSSUrl);
HyperLink newLink = new HyperLink();
foreach (RSSItem singleRssItem in feed)
{
newLink.Text = singleRssItem.Title;
newLink.NavigateUrl = singleRssItem.Href;
newLink.Target = "rssSite";
newLink.RenderControl(writer);
writer.WriteBreak();
}
base.RenderContents(writer);
}
[ConnectionProvider("Rss service Provider")]
public IRSSFeedContract GetRssCommunicationPoint()
{
return this as IRSSFeedContract;
}
}


Provider Webpart
[ToolboxItemAttribute(false)]
public class RSSWebPart : WebPart, IRSSFeedContract
{
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.Shared)]
public string RSSUrl { get; set; }
protected override void RenderContents(HtmlTextWriter writer)
{
RSSFeed feed = new RSSFeed(RSSUrl);
HyperLink newLink = new HyperLink();
foreach (RSSItem singleRssItem in feed)
{
newLink.Text = singleRssItem.Title;
newLink.NavigateUrl = singleRssItem.Href;
newLink.Target = "rssSite";
newLink.RenderControl(writer);
writer.WriteBreak();
}
base.RenderContents(writer);
}
[ConnectionProvider("Rss service Provider")]
public IRSSFeedContract GetRssCommunicationPoint()
{
return this as IRSSFeedContract;
}
}




[type:Deployment]
what is webpart.xml and how it is loaded to sharepoint site at different scope (site feature and site collection feature:difference)

.WebPart file is an XML file that provides an initial configuration to the
WebPart. For instance, if you were creating a WebPart to display an RSS feed that had an RSSURL as a
public property, you could specify an initial RSSURL property to point to a blog of your choice when the
WebPart is first dropped on the page and is yet unconfigured.
The .WebPart file also has sufficient information to tell SharePoint where to find the class library for
the WebPart. In doing so, if you open the .WebPart file, you will also see strings such as SharePoint that
are automatically replaced to actual names.








how to deploy Out of box webparts like Content query webparts?

How to Upgrade Webparts , maintaining their previous version also, in SharePoint2010?

In feature receiver class, hook is the "FeatureUpgrading" event. This is
called right before the upgrade on the feature occurs.The declarative way of describing feature upgrade actions is the section at the beginning or end of the feature.xml file.

Download Presentation
-------------------------------------------------------------------------------------------------------------

Content types
[type:(Common)]

What is Content types?And What are Site Columns?
Content types (content type: A reusable group of settings for a category of content. Use content types to manage the metadata, templates, and behaviors of items and documents consistently. Content types are defined at the site level and used on lists and libraries.) enable organizations to organize, manage, and handle content in a consistent way across a site collection (site collection: A set of Web sites on a virtual server that have the same owner and share administration settings. Each site collection contains a top-level Web site and can contain one or more subsites.). By defining content types for specific kinds of documents or information products, an organization can ensure that content is managed in a consistent way. Content types can be seen as templates that you apply to a list or library and you can apply multiple templates to a list or library so that they can contain multiple item or document types.

What are Different Content Types?

Site content types Content types are first defined for a site in the Site Content Type Gallery. Content types that are defined at the site level are called site content types. Site content types are available for use in any subsites of the site for which they have been defined. For example, if a site content type is defined for the top-level site in a site collection, it becomes available for use in lists and libraries across all sites in that site collection.


List content types Site content types can be added individually to lists or libraries and customized for use in those lists or libraries. When a site content type is added to a list or library, it is called a list content type. List content types are children of the site content types from which they are created. List content types can make your document libraries and lists more flexible, because a single list or library can contain multiple item types or document types, each of which can have unique metadata, policies, or behaviors. In order for a list or library to contain multiple item or document types, you must configure the list or library to allow multiple content types. The New command in that list or library then lists the types available for that list or library.

 
Document Content Types


Folder Content Type

Group Work content Types

ListContent Type

Unknown Content Type

What are new Content types introduced in SP2010?

What is List Defintion and List Instance?

List Definition














The value of the Name attribute in the list definition's Elements.xml must match the folder name of the list definition project item
Explain each ListTemplate attribute?

List Instance




Msdn Ref

What is the difference in FeatureName.feature and  FeatureName.Template.xml file (In SP2010)?
-------------------------------------------------------------------
EventReceivers

[type Common question]

1)What is the event receiver?
Event Receivers represent a developer-extensibility mechanism that can be used to add behaviors to various elements such as lists and list items. An event receiver is a class that contains one or more methods known as event handlers that are executed automatically by WSS in response to events such as a user adding a column to a list or a user deleting a list item. The event handlers are typically written to perform data validation, to ensure data integrity, or to kick off custom business processing.

Which new event receiver classes were introduced in SP2010?

SPWorkflowEventReceiver


The SPWorkflowEventReceiver class is a new addition in SharePoint 2010. In previous
versions, it was not possible to create event receivers to handle workflow events such as
Starting or Completed. This presented a problem when further validation of processing
was required before a workflow could be started. With SharePoint 2010, four new workflow
events have been added: WorkflowCompleted, WorkflowPostponed, WorkflowStarted, and
WorkflowStarting.
When event receivers are called, generally speaking, they run in the security context of the

user who initiated the changes that caused the event to be fired. If the events have been
raised as the result of changes made by a workflow process, the events run in the context of
the user who either started the workflow or made the change that caused the workflow to
be started automatically. This behavior differs from previous versions of SharePoint, in
which events that were initiated by workflow changes always executed under the
SharePoint\System security context.

What are different  Event Properties?
These base classes are SPItemEventProperties, SPListEventProperties, SPWebEventProperties, and

SPWorkflowEventProperties.
SPItemEventProperties
The SPItemEventProperties
class is used to communicate details of the item on which an
event was raised to the appropriate event receiver. Two important properties of the class that
warrant further explanation are AfterProperties and BeforeProperties. Earlier we looked at
synchronous events and asynchronous events, and we discovered that in SharePoint 2010, it
is possible to specify that events that would normally occur asynchronously can instead be
called synchronously. For the sake of clarity, let’s consider events that are synchronous by
default as before events, and events that are asynchronous by default as after events.
When a before event is raised, AfterProperties contains the item properties that will
be stored in the content database if the event is processed successfully. BeforeProperties
contains the item properties that are currently stored in the content database.
When an after event is raised, either synchronously or asynchronously, BeforeProperties

contains the values that were previously stored in the content database, whereas

AfterProperties contains the values that are currently stored in the content database.

CAUTION BeforeProperties works only for document items. For all other items, BeforeProperties will

always be null.

SPListEventProperties

The SPListEventProperties class is used to communicate the details of the list or field on

which an event was raised to the appropriate event receiver.

SPWebEventProperties

The SPWebEventProperties class is used to communicate the details of the web or site on

which an event was raised to the appropriate event receiver. The SPWebEventProperties

class contains both a ServerRelativeUrl and a NewServerRelativeUrl property. When the

event being handled is a before event (as defined above), the ServerRelativeUrl property

will contain the current URL of a site or web, and the NewServerRelativeUrl will contain

the URL that the site or web will have if the event is processed successfully.

When the event being handled is an after event, the ServerRelativeUrl property will

contain the previous URL of the site or web, whereas the NewServerRelativeUrl will contain

the current URL.

If the event is a Delete or Deleting event, the NewServerRelativeUrl will throw an

InvalidOperationException.

SPWorkflowEventProperties

The SPWorkflowEventProperties class is used to communicate the details of the workflow

instance on which an event was raised to the appropriate event receiver.

Shared Properties

The base SPEventPropertiesBase class defines a few interesting properties that are

inherited by all event properties classes.

First, the Status property allows code within an event receiver to specify the outcome of

an event. Possible outcomes are defined by the SPEventReceiverStatus enumeration and

include the following:

• Continue All is well; carry on as normal.

• CancelNoError Cancel the request but don’t present a notification to the caller.

• CancelWithError Cancel the request and raise an error message as specified by

the ErrorMessage property.

• CancelWithRedirectUrl Cancel the request and redirect the caller to the URL

specified in the RedirectUrl property.




How event receiver are binded to Lists or Items with features?
TemplatID for surveylist

ItemAdded
ItemAdded
$SharePoint.Project.AssemblyFullName$
NameSpace.ClassName
10000


Additional Attributes in Sharepoint2010

• Scope = Web, or Site: Allows you to restrict the event receiver to the whole site collection or
just an individual SPWeb.
• RootWebOnly: Allows you to specify that this event receiver is attached to lists with
matching template IDs only on the root web of the site collection.
• ListUrl: Allows you to attach this event receiver to a specific list, which is what we would
like to do. Also, because you are being so specific about the specific list you wish to attach
this event receiver to, you will also need to delete the ListTemplateID attribute. Thus, go
ahead and modify the Receivers element ,as shown following:

What is ListTemplate and ListInstance ?How Lists are deployed
http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL2_Manual_CS.pdf

How event receiver are binded to Content Types ?
http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL4_Manual_CS.pdf

What is Schema.xml?How it is associated with elments.xml                                                                                                                                  
Schema.xml describes the metadata for List like Content type associated with list,Fields associated in list, Views in List And forms associated .




















---------------------------------------------------------------------------------------------------------------
Error Handling
[type(Common)]
How  to  Write the  logs to   SharePoint Unified Logging Service (ULS) logs?

In catch blog  create the object  SPDiagnosticsCategory

SPDiagnosticsCategory myCat=new SPDiagnosticsCategory("A new category",


TraceSeverity.Monitorable,

EventSeverity.Error);

SPDiagnosticsService.Local.WriteEvent(1, myCat,

EventSeverity.Error,

"My custom message",

ex.StackTrace);

[type(Geeky)]
What is the tool  avaible to view and query the ULS Logs?
http://code.msdn.microsoft.com/ULSViewer/Release/ProjectReleases.aspx?ReleaseId=3308

 
How  to enable Developer's  Dashboard In Sharepoint 2010 site?How it works?
Execute the  following powershell command
 
 
$dash = [Microsoft.SharePoint.Administration.􀁊


SPWebService]::ContentService.DeveloperDashboardSettings;

$dash.DisplayLevel = 'OnDemand';

$dash.TraceEnabled = $true;

$dash.Update()




[type(Tricky)]

How to  view the Schema.xml of  any Lists  and How to Associate Content Type With schema.xml?

What is FldType.xml?When it Comes into Picture?
This file is used during list creation to render the fields in different views


what is difference in Synchronus and Asynchronus events

Synchronous events:
· Occur before the event.
· Block the flow of code execution until your event handler completes.
· Provide you with the ability to cancel the events resulting in no after event (“...ed") being fired.


Asynchronous events:
· Occur after the event.
· Do not block the flow of code execution in SharePoint

Synchronous events have to wait until your code completes before returning the page, whereas Asynchronous events show the page immediately.


[type:Geeky]
What are various tools to attach Event handler?
Event Manager

----------------------------------------------------------------------
Authentication and authorisation in sharepoint
[type :Common question]
What is claimed based authentication?Explain FBA in authentication

When using FBA in SharePoint 2010, you should keep the following in mind:
• FBA identities are now claims based identity instead of generic ASP.NET identities.
• It is the STS that calls the membership provider to validate users and issues claims
tokens. This is done using standard hooks in the windows identity framework.
• ValidateUser() must be implemented in the membership providers.
• Roles are also converted to claims and can be used as SPUsers inside SharePoint.
• All SPPrincipals are available in all zones.
What is permission levels in sharepoint?

what are users and groups?

Forms authentication in sharepoint?
Forms Authentication with WSS 3.0 is to use the AspNetSqlMembershipProvider class that comes as a standard component of ASP.NET 2.0. To get up add the proper configuration data to the machine.config file and/or various web.config files on each front-end Web server.
The standard web.config file for WSS Web applications has the following entry:


By setting the impersonate attribute to true, WSS instructs the ASP.NET runtime to process all requests under the Windows security context of the current user. When you write code for a Web Part or application page that attempts to access an external resource, such as a file system resource, database call, or Web service call, it runs under the impersonated Windows identity. This enables the Windows authorization subsystem (local or remote) to determine whether it should grant or deny access.

Understanding the Windows security context is fairly straightforward when you are using the default Windows Authentication provider because its identity is synchronized to the same user account as the identity of the WSS security context. However, things aren’t so obvious when you are using forms authentication. Because forms authentication doesn’t involve authenticating against a Windows account, the Windows security content takes on the identity of the IUSR_MACHINENAME account, or the account specified in the Authentication Methods dialog box of IIS (the same dialog box that enables IIS anonymous access).

Feature and Element.xml
[type Common questions]
What is feature in sharepoint and different scopes?
Features allow you to add new functionality to SharePoint or make simple site customizations in an easy and consistent way. Features can be scoped to the Farm, Web Application, Site, and Web level depending on the purpose of the feature. The basis of a feature is implemented using a feature.xml file, but may also contain other supporting files. More information on Features can be found on the Microsoft MSDN

[type deploy]
What is feature stappling?Feature dependancy activation?
feature stappling is stappling feature to site definition
in element.xml you need to specify the template name and feature ID





Feature

[type deploy Tricky ]

----------------------------------------------------------

CAML Queries
[type Common ]


What are the different roles of CAML query in Sharepoint?

qry.ViewAttributes = "Scope='Recursive'";
If you work with GetListItems method of the Lists.asmx SharePoint web service, you have to define an extra node with the QueryOptions element:

XmlNode queryOptionsNode = camlDocument.CreateElement("QueryOptions");
queryOptionsNode.InnerXml = "";If you want to query a specific sub folder using the SPQuery object, you have to set the Folder property:

qry.Folder = list.ParentWeb.GetFolder("Folders DocLib/2008");When working with the web services you have to do the following:

XmlNode queryOptionsNode = camlDocument.CreateElement("QueryOptions");queryOptionsNode.InnerXml = "Folders DocLib/2008";
What is ListView By Query control In Sharepoint?How it works with SPQuery       
    http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL3_Manual_CS.pdf
What is SPsiteDataquery?

SPSiteDataQuery query = new SPSiteDataQuery();
query.Lists = @"";
query.ViewFields = @"";
query.Webs = "";

string queryText =
@"




";

query.Query = queryText;

DataTable table = site.GetSiteData(query);

foreach (DataRow row in table.Rows) {
Console.WriteLine(row["Title"].ToString());
}

private static void JoinUsingLINQ()
{
Trace("LINQ Query with a Join", true);
using (
LinqDataContext context = new LinqDataContext(siteUrl))
{
var songs = from song in context.Songs
where song.Artist.Title.Contains("Michael")
select song;
// context.Log = Console.Out;   ---> This Line gives the CAML Query
foreach (var song in songs)
{
Trace(song.Title);
}
}
}

 http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL4_Manual_CS.pdf

What are the advantages and  Disadvantages of Linq over CAML Query?       Linq
code is much easier to read and deal with than the CAML code. It is strongly typed, thus my errors are caught during compile time and not at runtime, and I can code more effectively using intellisense.

Disadvantage: after your data context has been generated, changing the
schema of the target site can potentially invalidate this generated data context. 


Never use the IQueryable.Where extension method when querying ListItem objects. The reason is that the client object model first evaluates the result of the CAML query, retrieves the results, and then filters the resulting collection using LINQ. If you filter a very large list using LINQ instead of CAML, the client object model attempts to retrieve all items in the list before filtering with LINQ and either issues queries that require too much system resources, or the query fails. The reason is not clear unless you know how the client object model works internally. You must use CAML when querying list items.

                                                                                                       
  What are the additional properties of CAML query in  SP2010?            
 element in CAML and the SPQuery.Joins property
element in CAML and the SPQuery.ProjectedFields property


What is SPMetal.exe?
SPMetal  generates some entity classes. At the time of writing, SPMetal is implemented as a command line only tool.It’s installed by default at %SPROOT%\Bin\SPMetal.exe and can be called using the
command line arguments.


How  to Pass the Parameters to SPMEtal.exe?

How to enforce referenc
 ----------------------------------------------------------------------------------------------
Sharepoint 2010 Client Object Model
[type(Common)]
What is the concept of  Client Object Model   and why it is introduced?

Sharepoint object model  is server based to communicate with the client based technologies like ajax and silverlight .
Download  Presentation

How to Use Linq to Sharepoint to Query Sharepoint Data?(SP2010)?
1)add  reference of  Microsoft.SharePoint.Linq.dll from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
2)  Generate the datacontext "%14%\bin\spmetal" /web:http://sp2010/sampledata /code:LinqDataContext.cs     3)  Performing joins on songs and Artist List







What  namespaces are referenced for implementing Client Object Model .Specify example?

Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll

Example

http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL5_Manual_CS.pdf 

What is the difference in  Sharepoint Object model and Client Object model?
Client Object model dont provide access scope  higher than SPsite of  cant perform any administrative tasks with code.

How memory  management is done for SPWeb and SPsite Object?Why?
1)Using Delegate
2)Calling finally and Idisposable  Interface
these objects hold a reference to an SPRequest object, which in turn holds a
reference to a COM component. The SharePoint platform uses the COM component to
communicate with SQL Server. By implementing IDisposable, these objects can explicitly
close the connection to the database and properly clean up the COM component when the
.NET Framework objects are no longer required.

What  is the performance iszsue  with following code?
SPList masterPages = root.Lists.TryGetList("Master Page Gallery");


if (masterPages != null)

{

SPListItemCollection items = masterPages.Items;

foreach (SPListItem fileItem in masterPages.Items) --Each time call  is made to db  instead use above  code  line 
{

SPFile file = fileItem.File;

Console.WriteLine(file.Name);

}

}

What are different ways of  fetching list data using Client Object Model?
1)accessing  and retrieving  the list data using the SharePoint ADO.NET List Data Service.
http://server/_vti_bin/ListData.svc   and Generating Datacontext

2)Genrating ClientContext and executing query
ClientContext clientContext = new ClientContext(siteUrl);

Site siteCollection = clientContext.Site;
Web site = clientContext.Web;

var query=from list in Clientcontext.web.Lists
                 select list;
var lists=Clientcontext.LoadQuery(query);
ClientContext.ExecuteQuery();


http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL10_Manual_CS.pdf

What is difference in Item.update and Item.Systemupdate where Item is SPListItem?








How to enforce referential integrity?







-------------------------------------------------------------------------------------------
Sharepoint Workflow
[type(Common)]


 What the namespaces for creating the Custom  workflow activities?
Microsoft.SharePoint.WorkflowActions.dll
Microsoft.SharePoint.Workflow;


What is  the ActivityName.actions file ?
,
Refer this



.Action  file is the xml  configuration file  which defines the code behind for activity  and the parameters
these parameters are defined as the properties as follows

public static DependencyProperty DocLibNameProperty = DependencyProperty.Register("DocLibName", typeof(string), typeof(CreateDocumentLibrary), new PropertyMetadata(""));
[DescriptionAttribute("Used as doc lib name")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[ValidationOption(ValidationOption.Optional)]
public string DocLibName
{
get
{
return ((string)(base.GetValue(CreateDocumentLibrary.DocLibNameProperty)));
}
set
{
base.SetValue(CreateDocumentLibrary.DocLibNameProperty, value);
}
}

What Methods are overriden to Implement  Activity?

   Execute method is implemented  which  returns value of type  activityexecution statusWhat are the out of box workflows provided by   Sharepoint 2010
And What are the advantage over sharepoint2007
Workflows
 disposition approval,Three state, Collect signatures,Collect Feedback,Approval
Advantage over Sharepoinr2007
Workflow can be associated at Itemlevel ,Site Level  and List Level

What are the type of forms associated with workflow?When it comes into picture?

How workflow is associated with the Content Types?


How workflow can be initiated at Item level?


 
List Items in progress can be kept as  draft items in SP2010

What is the reusable workflows?How it is created ?
Workflows which can be exported to  solution pakage and can be modified

What is the difference in Package designer and Feature Designer in sharepoint in SP2010?

What are the different forms used in Workflow?How they are associated with Workflow?

--------------------------------------------------------------------------------------------------------------------------
Sharepoint Solutions (Sp2010)
[type (Common)]
What is the difference in Sandbox solution and farm solution?How to identify which solution to use?
1)Sandbox solution is the restricted, well monitored and secured code  and can be deployed by site collection administrator.
2)Anything that is deployed  to file system will not work as   sandboxed solutionj
3)The assemblyinfo.cs has  attribute  AllowPartialyTrusted Caller which is removed when  Project Properties-->Sandbox solution is set to false
4)when sandbox wsp is deployed , it can not create mapped folder in 14 hive.
5)Sandboxed code runs  in  SPUCHostService.exe also known as sandboxed code service
Turn on the sand box code service in Central admin.

We dont have to recycle application pools when sandboxed code is redeployed as Sandbox solutions. We need to attach the debugger to  SPUCWorkerProcess.exe

6)Sandbox solution  can be validated with Solution validator  Class which is inherited from  SPsolutionValidator and Overriding ValidateSolution and ValidateAssembly Methods
and this class is  deployed as feature
7)Sandbox solution whose execution needs full trust  , implemented as class which Inherits from  Microsoft.Sharepoint.UserCode.SPProxyOperations and  Override the  execute method.
8)msdn ref
public class FileCreateOperation : SPProxyOperation


{

public override object Execute(SPProxyOperationArgs args)

{

if (args != null)

{

FileArgs fileArgs = args as FileArgs;

FileStream fStream =

new FileStream(@"C:\inetpub\wwwroot\wss\VirtualDirectories\80\SampleFile.txt",

FileMode.CreateNew);

fStream.Write(

System.Text.ASCIIEncoding.ASCII.GetBytes(fileArgs.FileContents), 0,

fileArgs.FileContents.Length);

fStream.Flush();

fStream.Close() ;

return fileArgs.FileContents;

}

else return null;

}

}
 
 
 
To Pass Parameters  Implement SPProxyOperationArgs
 
[Serializable]


public class FileArgs : SPProxyOperationArgs

{

public string FileContents { get; set; }

public FileArgs(string fileContents)

{

this.FileContents = fileContents;

}

}

And execute following  code in webpart

results.Text =


SPUtility.ExecuteRegisteredProxyOperation(

"SandBoxWebPartWithProxy, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=64b818b3ff69ccfa",

"SandBoxWebPartWithProxy.ProxyCode.FileCreateOperation",

new ProxyCode.FileArgs(fileContents.Text)).ToString();

for more  on  Sandbox
http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL9_Manual_CS.pdf

----------------------------------------------------------------------------------------------------
[type (Common)]
What is Delegate Control?
How to add external scripts to AdditionalPagehead delegate control?

Control to override the existing control




How to add customize the Ribbon in SP2010  site? 

http://documents.sukul.org/sharepoint2010/Microsoft/HOL/HOL10_Manual_CS.pdf
 



What are the key elements of  Ribbon?

Xml which defines ribbon is present at 
%SPROOT%\TEMPLATE\GLOBAL\XML\CMDUI.XML. An examination of the configuration

file reveals the key elements that make up the ribbon:

Tabs


The ribbon uses tabs to show or hide groups of controls. Tabs generally refer to a particular
functional area, and their visibility can be programmatically toggled so as to reduce the
number of irrelevant options presented to users. Visibility can only be toggled for tabs;
you can’t hide an individual control or group of controls within a tab. This is a key design
element of the ribbon because it helps to reduce user confusion by ensuring that the same

controls always appear in the same place.

Groups

Each tab can contain many controls. So that these controls can be further grouped into
logical categories, individual controls must exist within a group.
Templates
Groups make use of templates to determine the placement of individual controls within a
group. These templates can be shared between groups and assist in providing a consistent
user experience.

Controls

Controls are the lowest level of user interface element that can be added to the ribbon. The
types of controls are well-defined and cannot be extended; this ensures consistency of user
experience. Some of the most commonly used controls include buttons, checkboxes, and
drop-downs. A few task-specific controls include a color picker and an insert table control
that displays a grid that can be used to specify the dimensions of a table.

Contextual Tabs

In addition to the preceding components that are the basis of the ribbon user interface,
you’ll also see contextual elements such as ContextualTabs and ContextualGroup. As
mentioned, tabs can be hidden when not required. However, one of the design principles
behind the ribbon is that commands should be easily discoverable

-----------------------------------------------------------------------------------------------------------------------
Web Content Management
[type(common)]
What is Web Content Management?



What is the managed metadata?


Tagging the documents

what is the document sets?why its required?

what is DocumentIds?

-----------------------------------------------------------------------------------------------------------------------

MasterPage and Layouts Branding
[type(Common)]



What are different master pages in 2007/2010?






Within SharePoint 2010 are two main master pages: v4.master, which is used by most

of the pages generated by SharePoint and is found at %SPRoot%/Template/Global, and

Simplev4.master, which is used as a failsafe for a few pages such as Login.aspx, Error.aspx,

and AccessDenied.aspx. As you can imagine, given the extensive functionality of the

platform, v4.master contains many placeholders. Along with these main master pages are

also a few others such as Applicationv4.master, mwsdefault4.master, and dialog.master,

which are used to support specific aspects of functionality.




MasterPage token?




By default, both of these tokens refer to /_catalogs/masterpage/default.master. Their

values can be changed programmatically using the SPWeb object or by using SharePoint

Designer as follows:

1. In the Site Object pane, select Master Pages.

2. Right-click the master page to be used, and then select Set As Default Master Page

or Set As Custom Master Page.

In addition to the dynamic tokens ~masterurl/default.master and ~masterurl/custom.

master, SharePoint also provides two static tokens, ~site/ and

~sitecollection/. These tokens refer to the master page gallery

at the site level and site collection level, respectively.




What are different components of v4.master page?



How delegate control can be deployed as feature?












ControlClass="My.Control.Class"


ControlAssembly="My.Assembly, Version=…, Culture=neutral, PublicKeyToken=…">


foo


bar












What is sequence number ?What it specifies






The delegate with the lowest number will be displayed.














What are themes and CssLink ,CSSRegistration Control in SP2007/2010?














how theming engine works in SP2010?




---------------------------------------------------------------------------------------------------------------------
Custom Fields

[type(common)]
What   are custom fields?

What are different Sharepoint classes associated  with Custom field development?



msdn Ref 1
msdn Ref 2

using System.Web.UI.WebControls;

using Microsoft.SharePoint.WebControls;
namespace CustomField

{

class AddressField : BaseFieldControl

{
//code to intialize controls
//override  createchildcontrol
//override value property
public override object Value


{

get

{

EnsureChildControls();

SPAddressValue field = new SPAddressValue();

field.StreetAddress = _address.Text;

field.ApartmentNumber = _apartmentNumber.Text;

field.City = _city.Text;

field.State = _state.Text;

field.Zip = _zip.Text;

return field;

}

set

{

if (value != null && !string.IsNullOrEmpty(value.ToString()))

{

SPAddressValue field = new SPAddressValue(value.ToString());

_address.Text = field.StreetAddress;

_apartmentNumber.Text = field.ApartmentNumber;

_city.Text = field.City;

_state.Text = field.State;

_zip.Text = field.Zip;

            }

        }

     }

}

}

 
 
To hook up our custom BaseFieldControl to our SPField implementation, add the


following code to the SPFieldAddress.cs class:

public override BaseFieldControl FieldRenderingControl

{

get

{

BaseFieldControl control = new AddressField();

control.FieldName = this.InternalName;

return control;

}

}
 How Custom fields are  deployed?
Map Template\Xml and then create a new XML file in the mapped folder named

fldtypes_customfieldName.xml. When creating field definition files, it is important that
they be named appropriately. SharePoint loads files with names in the format
fldtypes_.xml
this xml file contains  FieldNames and RenderPattern in Edit and Display mode


using Microsoft.SharePoint;

namespace CustomField
{
public class SPAddressValue : SPFieldMultiColumnValue
{
public SPAddressValue() : base(5) { }
public SPAddressValue(string value) : base(value) { }
public string StreetAddress
{
get { return this[0];}
set { this[0] = value;}
}

public string ApartmentNumber
{
get { return this[1];}

}

public string City
{
get { return this[2];}
set { this[2] = value;}
}
public string State

{
get { return this[3];}
set { this[3] = value;}
}

public string Zip

{

get { return this[4];}

set { this[4] = value;}

}

}
}


What are visual webparts in SP2010?


-------------------------------------------------------------------------------------------------------------
Busienss  Connectivity Services(SP2010)/Business Data Connectivity(SP2007)
[Type(Common)]
Explain  BCS architecture and its advantages  over BDC

 Blog Link 1

 Blog Link 2

 msdn Ref

--------------------------------------------------------------------------------------------------------
Enterprise Search Architecture(2010/2007)

[Type(Common]
Explain enterprise search architecture for 2010 and advantages over search arctitecture of 2007?

What are the Sharepoint 2010 fast search features

What is Content Sources?
Search Connector Framework can be used to crawl and index

content from a wide variety of sources. Each source is defined as a separate entity within
SharePoint known as a content source.

What is Crawl Rules?
crawl rules. You can use crawl rules to exclude certain

files or folders, or to specify that particular credentials should be used when accessing
particular files or folders. An important new feature in SharePoint 2010 is the ability to
use regular expressions when defining crawl rules.
What  is Maneged Properties and Crawl properties?

What are different databases associated with Sharepoint 2010/2007

What is Query Object Model in SP2010? 


Enterprise search in SharePoint 2010 provides a Query Object Model that allows developers

to use the capabilities of search programmatically within custom applications. The core class
of the Query Object Model is the Query abstract class, which has two concrete implementations:
the FullTextSqlQuery class, which can be used to issue full-text SQL syntax queries to the
search provider, and the KeywordQuery class, which can be used to issue keyword syntax
queries.

What are  different  Search Webparts?



• CoreResultsWebPart Used to render results of type RelevantResults.
• FederatedResultsWebPart Used to render results of type RelevantResults. The
key difference between the FederatedResultsWebPart and the CoreResultsWebPart
is that results in the latter can be paged by including a SearchPagingWebPart on
the page. Also, the FederatedResultsWebPart requires that a location is specified,
whereas, to provide backward compatibility, the CoreResultsWebPart automatically
uses the default search provider defined by the Search Service Application.
• PeopleCoreResultsWebPart Used to render the results of people searches. Derived
from the CoreResultsWebPart, results are displayed in a specific format and have
different sort options more appropriate to a people search.
• TopFederatedResultsWebPart Returns an aggregated set of top results from a
number of federated locations.
• VisualBestBetWebPart Displays results of type VisualBestBets. As described
earlier, Visual Best Bets are a feature of FAST Search, and although this web
part can be added to sites without FAST Search enabled, no results will be
displayed.
• HighConfidenceWebPart Displays results of type HighConfidenceResults as well
as SpecialTermResults.
• SearchStatsWebPart Displays information about the last query executed in the
CoreResultsWebPart.
• SearchSummaryWebPart Includes a summary of the search query. In effect this
implements “Did you mean” functionality, whereby if you start entering a keyword,
suggested keywords will be shown that will generate more results.
• SearchPagingWebPart Supports paging of the results displayed in a
CoreResultsWebPart.

What are the  namespaces  for  using Search Object Model?
 Microsoft.Office.Server.Search.Query;

 Microsoft.Office.Server.Search.WebControls;



What is User Profile Service?What are the advancements over SP2007 User Profile Service?
 Download Presentation (Sharepoint Conference 2009)



----------------------------------------------------------------------
Sharepoint 2010/2007
Packaging and Deployment

[type(Common)]
What does the .WSP file contain?

What are different feature activation dependancy rules?

what is the difference in elements.xml and elementmanifest.xml?

whats new in feature framework in sharepoint 2010
Download presentation

How to Pass the parameters to feature receiver in Sharepoint 2010?

----------------------------------------------------------------------
Site Definitions
[type(Common)]
Explain different parts of the onet.xml?


---------------------------------------------------------------------------