Monday 28 July 2014

Hiding the left nav:

<script type="text/javascript"> 
 $(document).ready(function(){
    $("#s4-leftpanel").addClass("hide");
    $("#MSO_ContentTable").css("margin-left", "-10px");  //adjust for the margin
 });
</script>

The css:
.hide{
 display:none;
}

Create-an-Accordion-Navigation-for-SharePoint-2010-using-jQuery

All the Quick link menu provided by sharepoint out of Box has a fixed format and altering its CSS alters is branding.
However we can achieve collapsing and expanding functionality using jQuery provided by Google’s API.
if you want the accordion-style menu for all pages, you should work it into the default.master. For now, i have carried by adding a Content Editor Web Part (CEWP) to the page. Add the code below to the web part’s Content Editor (source).

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script><script type="text/javascript">

jQuery(function($) {
//Hide all
$('.s4-ql li ul').hide();
//Set the Images up
var Collapse = "http://POLA:33/sites/SHIVAPRASAD/Pic%20Lib/minus_square_black.png";
var Expand = "http://POLA:33/sites/SHIVAPRASAD/Pic%20Lib/plus_square_black.png";
//Find each top level UI and add reletive buttons & children numbers
$('.s4-ql ul li').find('ul').each(function(index) {
var $this = $(this);
$this.parent().find('a:first .menu-item-text').parent().parent().parent().prepend(['<a class=\'min\' style=\'float:right; margin-left:5px;margin-top:6px;margin-right:5px;\'><img src=\'http://geoshieldsp2:1001/sites/RaviTestingSite/Pic%20Lib/plus_square_black.png\'/></a>'].join(''));
});
//Setup Click Hanlder
$('.min').click(function() {
//Get Reference to img
var img = $(this).children();
//Traverse the DOM to find the child UL node
var subList = $(this).siblings('ul');
//Check the visibility of the item and set the image
var Visibility = subList.is(":visible")? img.attr('src',Expand) : img.attr('src',Collapse);;
//Toggle the UL
subList.slideToggle();
});
});

</script>

The result (closed):












The result (opened):

















Result selected:
















Hope it will help you out.
Cheers SharePoint

Monday 7 July 2014

Capsule to clear sharePoint interview

1.  Client Object Model vs Server Object Model in SharePoint 2010?
2.    Difference between Session and Cache?
3.    What is the relationship between Microsoft SharePoint Portal Server and Microsoft Windows Services?
4.    What is a SharePoint Feature? What files are used to define a feature?
5.    Workflow can be applied to what all elements of SharePoint ?
6.    What are the types of input forms that can be created for a workflow?
7.     what are ways to create input forms for workflow?
8.    What is the difference between method activity and event activity in WorkFlow ?
9.    What are content types?
10.  Can a content type have receivers associated with it?
11. what two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?
12. what is an ancestral type and what does it have to do with content types?
13.  Can a list definition be derived from a custom content type?
14.  When creating a list definition, how can you create an instance of the list?
15. what is a Field Control?
16.  What base class do custom Field Controls inherit from?
17. Can multiple SharePoint installs point to the same DB?
18. How to create links to the mapped network drives?
19.  While creating a Web part, which is the ideal location to Initialize my new controls?
20.  What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?
21.  What are the differences between the two base classes and what are the inherit benefits of using one over another?
22.  what is the WebPartManager sealed class? What is its purpose?
23.  What does AllowUnsafeUpdates do ?
24. What does RunWithElevatedPrivileges do?
25.  What does SPWeb.EnsureUser method do?
26.  What is a SPSite and SPWeb object, and what is the difference between each of the objects?
27. what does a SPWebApplication object represent?
28.  would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
29.  How do you return SharePoint List items using SharePoint web services?
30.  When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?
31.  What is CAML, and why would you use it?
32.  what is impersonation, and when would you use impersonation?
33.  What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
34.  Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?
35.  What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?
36.  What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?
37. What is a .ddf file and what does it have to do with SharePoint Solution creation?
38. What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?
39.  What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
40.  What are event receivers?
41.  When would you use an event receiver?
42. What base class do event receivers inherit from?
43.  If I wanted to not allow people to delete documents from a document library, how would I go about it?
44.  What is the difference between an asynchronous and synchronous event receivers?
45. How is security managed in SharePoint?
46. What is a site definition?
47. What is a DWP?
48. What is the GAC?
49. What are the differences between web part page gallery, site gallery, Virtual server gallery and online gallery?
50. What security levels are assigned to users?
51. Can SharePoint be linked to an external data source?
52.  Can SharePoint be linked to a SQL database?
53.  Does SharePoint work with NFS? Yes and no.
54. What do you know about SharePoint Object Model?
55.  Can you develop webparts and other SharePoint solutions at your local machine?
56.  How do you debug SharePoint Webparts?
57. How would you retrieve large number of Items form the list ?
58.  How Do you implement Impersonation in SharePoint.
59.  What is the performance impact of RunWithElevatedPrivileges?
60.  How will you add Code behind to a Custom Application Page or a Layout Page in SharePoint?
61.  What is the difference between a Site Definition and a Site Template
62.  Why do you use Feature Receivers?
63.  Can you give a example where feature receivers are used.
64. Where do you deploy the additional files used in your webpart, like css or javascript files, and how do you use them in your WebPart?
65.  When should you dispose SPWeb and SPSite objects?
66.  What are the best practices for SharePoint development.
67. What is the main difference between using SPListItem.Update() and SPListItem.SystemUpdate()?
68. When do you use SPSiteDataQuery ?
69.  How do you create a Custom action for an item in a list?
70. How would you bind this CustomAction to a specific list ?
71. How will you deploy an existing asp.net webapplication or website in SharePoint?
72.  How will you cancel a deployment from central admin -> solution managment, if it’s stuck at “deploying” or “Error”.
73.  How do make an existing non-publishing site Publishing?
74. Can you name some of the tools used for SharePoint Administration?
75. What are Application Pages in SharePoint?
76. What is Authentication and Authorization?
77. How do you deploy a User Control in SharePoint ?
78. Which is faster a WebPart or a User Control?
79.  How Do you deploy Files in 12 hive when using wspbuilder or vsewss?
80. What files gets created on a file system, when a Site collection is created?
81. How would you pass user credentials while using SharePoint WebService from your Web Part or application.
82.  How would you remove a webapart from the WebPart gallery? Does it get removed with Webpart retraction?
83.  What type of components can be created or deployed as a feature?
84. How Do you bind a Drop-Down Listbox with a Column in SharePoint List ?
85. Can you display\add a Custom aspx or WebApplication Page in SharePoint Context?
86. What is a delegate control ?
87.  What is the difference when using Using() Vs Dispose() Vs Try / finally while developing SharePoint Components.
88. How would you know the Potential memory leaks?
89. What is the difference between targeting Audience Vs SharePoint Group.
90. How do add JQuery or JavaScript in your SharePoint Site?
91.  How do you Change the Datasource for Global and Quick Launch Navigation?
92. How do you Override the Navigation For example Quick Launch with your Own control.
93.  Can you add left navigation in your Custom aspx page which you deployed in SharePoint?
94.  What is 14 hive in SharePoint?
95.  How would you re-deploy the old custom solutions in SharePoint 2010.What Changes are needed to the old Solution files.
96.  How many types of Client Object model extension are available in 2010 and when would you use one or the other.
97.  What are the security improvements in SharePoint 2010 ?
98.  Whats New with SharePoint WebParts?
99. What are the Visual Studio 2010 Tools for SharePoint?What is LINQ.
100.  How is it used in SharePoint?
101.  What Changes are made in SharePoint 2010 to enforce Referential Integrity?
102.  What’s New in SPALerts?
103.  What Has Changed with SSP in SharePoint 2010?
104.  What are the Hardware and Software requirements for SharePoint 2010.
105.  What Has Changed with SSP in SharePoint 2010.
106.  Additional improvements for the service application model include
107.  What are the advantages of Service Applications overSSP?
108.  Can we create a Single set of Services that will be shared across the farm?
109.  What are Managed Accounts?
110.  What are the Methods of Backup and Recovery in SharePoint 2010?
111.  How to Move content Databases using PowerShell?
112.   How to Export a Site or List in SharePoint 2010?
113.  Changes in Themes in SharePoint 2010. Can we re-deploy and use the Old       Cutsom themes in SharePoint 2010?
114.  What is Enterprise Metadata Management?
115.   What is Business Connectivity Services in SharePoint ?
116.  How is BCS Different from BDC in SharePoint 2007?
117.  How would you create an Information Site in SharePoint 2010?
118.  What would you clean up before upgrading to SharePoint 2010?
119.   What Browsers are not supported with SharePoint 2010?
120.  Can you personalize Shared Services for a single Web application?
121.  How will you move or separate a Site Collection which stays in a shared WebApplication content database, into its own separate database.
122.  What are Security methods(Authentication methods) available in sharepoint 2007.
123.  What does AllowUnsafeUpdates do ?
124.  What does RunWithElevatedPrivileges do?
125.  What are content types ?
126.  6. What are the ways to initiate the workflow ?
127.  7. What are the types of input forms that can be created for a workflow ?
128.  What is ServerUpdate() ?
129.  What is query.ViewAttributes OR how can you force SPQuery to return results from all the folders of the list?
130.  What is strong naming (signing) a WebPart assembly file mean?
131.  What are safe controls, and what type of information, is placed in that element in a SharePoint web.config file?
132.  What is the CreateChildControls() method? How can you use it to do something simple like displaying a Label control?
133.  What does the RenderContents method do in an ASP.NET 2.0 WebPart?
134.  What is the WebPartManager sealed class? What is its purpose?
135.  Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
136.  How do you connect (reference) to a SharePoint list, and how do you insert a new List Item?
137.  How would you loop using SPList through all SharePont List items, assuming you know the name (in a string value) of the list you want to iterate through, and already have all the site code written?
138.  What are the various kinds of roles the users can have?
139.  How customizable is the user-to-user access?
140.  Can each user have access to their own calendar?
141.  What does partial trust mean the Web Part developer?
142.  When retrieving List items using SharePoint Web Services, how do you  specify explicit credentials to be passed to access the list items?
143.  What is the IDesignTimeHtmlProvider interface, and when can you use it in WebParts?
144.  What types of SharePoint assets can be deployed with a SharePoint feature?
145.  How could you append a string to the title of a site when it is provisioned?
146.  Can an event receiver be deployed through a SharePoint feature?
147.  How does one deploy new SharePoint site definitions so that they are made aware to the SharePoint system?
148.  Can a list definition be derived from a custom content type?
149.  When creating a list definition, how can you create an instance of the list?
150.  What is a Field Control?
151.  What base class do custom Field Controls inherit from?
152.  What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
153.  When running with SPSecurity.RunWithElevatedPrivileges (web context) what credentials are being used?
154.  When should you dispose SPWeb and SPSite objects? And even more important, when not?
155.  What are the built in ways to backup a SharePoint install?
156.  -What step(s) should you take to get a stack dump from your web part instead of that error page?
157.  How would you programmatically retrieve a list item?
158.  What are the data types which are supported as Lookup column in SharePoint.
159.  how can debugging share point application and timer jobs ? with steps?
160.  what is web part?
161.  What are the advantages of SharePoint Portal Services (SPS) over SharePoint Team Services (STS)?
162.  What are SharePoint 2010 main features?
163.  What is SharePoint Central Administration?
164.  What is a Site collection and Web application?
165.  What are the site templates available in SharePoint?
166.  What is a SharePoint list?
167.  How to create a SharePoint List in browser in SharePoint 2010?
168.  What is a SharePoint Farm?
169.  What is a service applications in SharePoint 2010?

Good luck Guys

Saturday 5 July 2014

SharePoint Timer Jobs and Multiple Servers

Timer jobs are wonderfully robust creatures. They effectively replace the "Windows Scheduled Task" for SharePoint servers, allowing you to run .Net code on a scheduled or "one off" basis.
However, there can be some confusion about running Timer Jobs on multiple servers, so this should clear it up a bit.
  1. By default Timer Jobs will only execute on the server that they are called from (typically the Central Administration server)
  2. Through code you can specify a specific box (SPServer) to run your Timer Job on.
  3. It is possible to run a Timer Job on every server on the farm (although this can be dangerous!)
The constructor includes a parameter for an SPServer object, which allows you to specify which server the timer job will run on.
Example Code 1 – Add Job to single Server:
The code below is for a Web Application scoped which will register a job definition on a single server. As Web Application scoped features are activated from Central Administration, it will use the current SPServer (i.e. the Central Admin server).
This is useful for code which modified content in the database, as you only want it to execute a single time.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
SPJobDefinition job = new SPJobDefinition("CustomJobDef", webApp);
}
Example Code 2 – Add Job to All Servers:
The code below is for a Web Application scoped which will register a job definition on all web front end servers in the farm.
This is useful for code which modifies files or server settings, as you need it to execute separately for each server.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
foreach (SPServer server in SPFarm.Local.Servers)
{
if (server.Role == SPServerRole.WebFrontEnd)
{
SPJobDefinition job = new SPJobDefinition("CustomJobDef", webApp, server,SPJobLockType.None);
}
}
}
Hope this helps! Enjoy!