1. Creating GUIDs with C#
=========
System.Guid guid=System.Guid.NewGuid();
2.
isNumeric("42000", System.Globalization.NumberStyles.Integer)If you want to test for an integer number separated with commas, then do the following:
Collapse Copy CodeisNumeric("42,000", System.Globalization.NumberStyles.Integer |
System.Globalization.NumberStyles.AllowThousands)Using Other Cultures
(string val, System.Globalization.NumberStyles NumberStyle, string CultureName)
{
Double result;
return Double.TryParse(val,NumberStyle,new System.Globalization.CultureInfo
(CultureName),out result);
}
--------
sqlserver 2008 -> right click on database then : tasks -> generate scripts
----------
c#
convert Dataview to a DataTable in C#. All you have to use ToTable() Method of DataView objects
-----------------------------------------------------------------
drop table #temp
create table #temp
(i int)
insert into #temp values(null)
--insert into #temp values(1)
--insert into #temp values(2)
--insert into #temp values(3)
select max(i) from #temp
------------------------------
sqlserver 2008
Problem :
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
Solution:
Tools -> Options then go to the Designer Page and uncheck "Prevent saving changes that require table re-creation".
======================================================================================
YOu cannot create a temporary tabe inside a function.
Functions always needs select dbo.functionname(par1) .. it is not select functionname(par1) ie dbo is required
----------------------
Split a string sqlserver
http://www.logiclabz.com/sql-server/split-function-in-sql-server-to-break-comma-separated-strings-into-table.aspx
-------------
sqserver
in if else statemenet u cannot keep empty statements in the braces
---------------------------------------------
In Asp.net
for getting a rounded rectangle use fieldset
<form id="form1" runat="server">
<fieldset style="width:140px">
<legend> User Login </legend>
<!-- your Rest HTML control goes here -->
</fieldset>
</form>
<Legend> tag is used to give the name to a group box.
After end of the <Legend> tag you can write any HTML tag like Table, Input etc.
--------------------------------------------------------
http://www.csharp-examples.net/string-format-double/
String.Format("{0:0.0}", 0.0); // "0.0"
String.Format("{0,-10:0.0}", 123.4567); // "123.5 "
------------------
I have an identity column in a table which is autoincremented column.
I entered some 10 records,
I deleted those 10 records
WHen I tried to insert a new record it starts with 11
But my requirement is it should start with 1
How to achieve this in Sqlserver?
Ans: Use truncate instead of delete
But I think one more way is also there which I dont know.
-----------------
DROP table t (here t is table name): completely deletes all the records and it will drop the table also.
u will get object not exists error once u drop the table and using this select * from t
Truncate table t : deletes all the records and it wont drop the table.
so u can use select * from t even after truncating also.
in drop and truncate u cannot use where condition. It means u have lose the entire data in the table.
But in case of delete u can control the no. of records to be deleted.
----------------------
Giving datetime default value during creation of table in Sqlserver
CREATE TABLE [Test] (
[Test_Creation_Date] [datetime] DEFAULT (getdate()) )
---------------------------------
C# check whether a string is integer or not
public bool IsInteger(string data){ bool result = true; try { int.Parse(data); } catch (FormatException) { result = false; }return result;}
----------
set date format in grid
<asp :GridView ID="GridView1" runat="server">
<columns>
<asp :BoundField DataField="CreationDate"
DataFormatString="{0:M-dd-yyyy}"
HeaderText="CreationDate" />
</columns>
</asp>
You have two choices to make this work as you would expect. The first choice is to simply set HtmlEncode to false as follows:
<asp :GridView ID="GridView1" runat="server">
<columns>
<asp :BoundField DataField="CreationDate"
DataFormatString="{0:M-dd-yyyy}"
HtmlEncode="false"
HeaderText="CreationDate" />
</columns>
</asp>
The second choice is to make the column a template and simply set the format string directly in the Label or Text Fields as follows.
<asp :GridView ID="GridView3" runat="server" >
<columns>
<asp :TemplateField HeaderText="CreationDate" >
<edititemtemplate>
<asp :Label ID="Label1" runat="server"
Text='<%# Eval("CreationDate", "{0:M-dd-yyyy}") %>'>
</asp>
</edititemtemplate>
<itemtemplate>
<asp :Label ID="Label1" runat="server"
Text='<%# Bind("CreationDate", "{0:M-dd-yyyy}") %>'>
</asp>
</itemtemplate>
</asp>
</columns>
</asp>
========================
System.Guid.NewGuid() in C# for new guid
-----------
geting the date part only in sqlserver
select CAST(FLOOR(CAST(getdate() AS DECIMAL(12, 5))) AS DATETIME)
---------------------------------------
Running Notes 5
December 10, 2009Dotnet Interview Questions Part 11- Accenture
December 3, 2009- What is an interface?
- What do you know about web service?
- What is a nullable type?
- Difference between value type and reference type?
- Difference between hash table and array list?
- What is a web service?
- Diff between string and string builder?
8. Diff between user control and custom control. And how to use them?
Regarding the project:
1) Project explanation
2) What I have done in the project?
3) How asked about the database tables and how they are used in the .NET code
4) Currently what I am doing? For this I said there are some performance issues in the project so we are planning to redesign the project.
Then he asked how we are solving the issues?
SQL Server:
- What is a trigger?
- What are various types of joins?
- What are DML and DDL commands?
- Employee table:
| EmpId | EmpName | Place | City | Country |
If country is having null values write a query which replaces null values with India?
Ans : Select Empid, empname ,place,city ,isnull(Country,’india’) from Employee
5. Different types of joins
6. Write a query for Self Join?
Sharepoint Interview Questions part 4
November 28, 2009WIPRO
—–
1. What are the new features that are introduced in SP 2007?
2.Difference between WSS 3.0 and MOSS 2007?
3. What is a feature in SP?
4.What Application Definition File contains?
5.Difference between SPSite and SPWeb?
6. Explain Object model in Sharepoint?
7. Sharepoint Architecture?
8. Asynchronous and Synchronous events in Sp?
Infosys
——
1. Difference b/w Site Definition and Site Template
2. Infopath
3. What is ghosting and unghosting?
4. Diff b/w SPSITE and SPWEB?
5. How to deploy Silverlight application in MOSS?
6. What are webparts?
7. How to write a query in a webpart using out of box functionality in SP?
8. What is Sharepoint?
9. What are the features available in MOSS 2007?
10.what is BDC and how to configure BDC in MOSS?
11.Difference between Solution and Feature?
12. Diff b/w Site Solution and web application?
13. What is Shared Service Provider contains?
14.Security Levels in Sharepoint?
15. In document library user level settings
16. Explain the steps in creating webparts?
17. Difference between solution and feature
18. Difference between Master page and Page Layout
19. Workflow types
20. Infopath forms
21. Difference between Form Library and Doc Library
22. What is collaboration portal
23. Search functionality
24. What is CAML query
25. what does BDC metaman contains
26. Event handling in Sharepoint
27.How to initiate workflow in Sharepoint
28.Difference between site definition and site template
29. How to change Themes
30. What is the use of css in sharepoint
Sharepoint Notes 1
November 25, 20091.what is site provisioning?
Ans: what is the url of the site, what is the page layout of the site
2.what is this site
what is my site? (can create a blog)
what is team site? How it is different from above?
List
——
Add columns
Add Columns from Site Columns
Single LIne of TExt
Multiple Line Of Text
Number
Currency
Calculated I = PNR/100
Choice (dropdown)
Yes/No (CheckBox)
Date and Time
Lookup
Person or Group
Hyperlink or Picture
Business Data
Audience Targetting
create views
Edit in DataSheet
Actions -> Totals appears only in DataSheet
Central Admin Configuration:
Application Management
1. INfopath
2. Excel
3. Workflow
4. Search
5. Create or extend web application (Form Authentication) {SP web application management tab}
6. Authentication Providers (Form Authentication) {Application Security tab}
use ASPREGIIS.exe roles & membership
7. Site Collection (Form Authentication) {SP Site Management}
Site Templates Tabs: Collaboration, Meeting,Enterprise,Publish
——————
Internet Presence website (collaboration) for web content management
Publish tab: Corporate Intranet site
8. How to suppress windows authentication popup during logging into sp
9. How to create Form Authentication in SP
site actions -> site settings -> modify all site settings
webparts
site templates
content types
site collections
save site as template
site columns
c:\inetpub\wwwroot\virtual directories\port no.\
c:\prog files\common files\ microsoft shared\web server extensions\12\
isapi
site collection
content type
site columns
choice menu : checkbox, radio button ,dropdown
SHarepoint designer:
1. _catalogs
lt,master page,users,wp,wt
2. images
3. _cts
4. private
5. lists
6. Documents
7. cached profiles
8. form server templates
9. IWConvertedForms
Long Operation Status
m
workflows
notification pages
–
Content Types
Site Definition
WSS 3.0 enhancements: Form Based AUthentication, Branding
REcycle BIn
Security at document and list level
How to create internet facing public websites –>Create Site collection-> Collaboration tab
www.gorillatraining.com
u2u.be
What is the difference between document library and list?
Title,CreatedBy and Modified By are the default columns.
————————
1. For KPI what is the procedure?
Use Report Center site Template from Enterprise tab while creating the site collection.
Key Performance Indicators:
Central Admin – > View All Site Content – > Lists – > Sample KPIs
View All Site Content -> Create -> KPI LIst (under Lists)
Various ways to get data into KPI list:
1.Using Data in Sharepoint List
2.Using Data in Excel
3.Using Data in Sqlserver Analysis Services
4.using Data in manually entered data
1 a. Number of List Items in the view
b. Percentage of List Items in the view
c. Calculation using all list items in the view
KPList views:
1. Standard View
2. Gantt View
3. Calendar View
4. Access View
5. DataSheet View
Site ACtions -> Create DashBoard
It creates a webpart
Now add Key Performance Indicators from the Suggested Webpart list
KPIList
From Open Tool pane : Select Top Level Site
————————————————–
Different Areas of SP:
WCM: Content Types, page Layout, Sharepoint Designer
BPM: Infopath
ECM: BDC
BI: Excel Services
Collaboration : WIKI, BLog, WSS 3.0
Portal & Search
——————
Creating custom workflows using Sharepoint Designer
Associate with document library and list
Can we apply wf to each item of doc library and list?
create document library
in Sharepoint designer : File ->new->Workflow
Attach to the respective doc library
Manually add
automatically whenever a new item is created
autoamatically fire whenever a change was done
Initiate variables
Add workflow condition steps
In email Add Lookup fields then u can see the initialize variables in email.
Then in document library attach a document and start the workflow .
—————-
Creating workflows using Visual Studio
state machine
sequential workflow
microsoft.sharepoint.workflowactions
files that are created with vs
workflow.xml
workflow.xoml
feature.xml
files that are created are:(using sp designer)
aspx
xoml
xml
xoml.config
one more
————————————
Security in Sharepoint
Go to a site
Operations -> Site settings
1.People and groups
2.Site collection administrators
3.Advanced Permissions
4.Site creation rights
People and groups permissions:
1.Owners (full control)
2.Members or Contributors(Read and write)
3.Visitors(Readers)
Group permissions:
1. Owner
2. Design
3. Contribute
4. Read
Security can be applied to the deep item level in 2007
—–
Setting up anonymous and form based authentication in wss 3.0
Central Configuration -> Application Management -> Application Security ->Authentication Providers
www.codeproject.com/kb/sharepoint/fba.aspx
———————
Browser enabled forms with Infopath and Form Services
Central Admin -> Application Management ->
Configure Infopath Form Services
a. Allow users to browser-enable form templates
b.Render form templates that are browser enabled by users.
Manage the webservice proxy
a. Enable the webservice proxy
b. Enable the webservice proxy for users .By enabling the above two changes are reflected from infopath form to sharepoint site and vice versa.
Form Library
Design Tasks -> Datasource .. Create columns
Design Tasks -> Design Checker -> Change Compatibility Settings -> FCorm Options ..Compatibility ->Design a form template that can be opened in a browser or Infopath (specify the url)
“Repeatable table” in infopath is for creating child table
File -> Publish
wizard comes ..
a. specify the url
b. Enable This form to be filed out by a browser
Form Library Settings -> Advanced Settings ->
1. open in a client application
2. open in a web page ( if this is selected infopath opens in webpage with save,saveas,printview ,close buttons.
———————————–
Document Information Panel (Infopath )
MS WORD : File -> Finish -> Properties .. It opens DIP
Content Type : On top of document library view we have New button. On click of New it will show a form to insert a new record in SP doc library. But we dont want this. We want our custom form. Then use COntent Type where we can specify custom columns.
DIP is for filling metadata information of Content Types from Office obx applications.
——————
BDC
is a connector between third party databases with SHarepoint server. SP has inbuilt webparts for BDC
BDCMetaman is the tool
Application Definition File — Central Admin -> Appln Management
Finder Methods
Actions
——————————
Sharepoint Notes 2
November 23, 20091. http://www.dotnetspark.com/kb/515-sharepoint-workflow-basics.aspx
What is a 3 state workflow?
2.Difference between Features, Feature Deffinition and Solutions
Using Features and Solutions will help customize sites and site templates.
Features: It helps sites to reuse functionality from one site to other sites without requiring to copy and paste XML. It is also an instance of Feature Definition.
Solutions: It helps to package Features in a cabinet (.cab) file along with meta data.
Feature Definition: It hides feature manifest contained in a feature directory and are installed at farm level.
http://srikanthsharepointmcp.blogspot.com/2009/07/difference-between-features-feature.html
3.Key difference between Sharepoint 2007 and 2010
major difference which is everything will and has to be 64 bit:
SharePoint Server 2010 will be 64-bit only.
SharePoint Server 2010 will require 64-bit Windows Server 2008 or 64-bit Windows Server 2008 R2.
SharePoint Server 2010 will require 64-bit SQL Server 2008 or 64-bit SQL Server 2005.
4.
What is Microsoft Windows SharePoint Services? How is it related to Microsoft Office SharePoint Server 2007?
Windows SharePoint Services is the solution that enables you to create Web sites for information sharing and document collaboration. Windows SharePoint Services — a key piece of the information worker infrastructure delivered in Microsoft Windows Server 2003 — provides additional functionality to the Microsoft Office system and other desktop applications, and it serves as a platform for application development.
Office SharePoint Server 2007 builds on top of Windows SharePoint Services 3.0 to provide additional capabilities including collaboration, portal, search, enterprise content management, business process and forms, and business intelligence.
[edit]What is Microsoft SharePoint Portal Server?
SharePoint Portal Server is a portal server that connects people, teams, and knowledge across business processes. SharePoint Portal Server integrates information from various systems into one secure solution through single sign-on and enterprise application integration capabilities. It provides flexible deployment and management tools, and facilitates end-to-end collaboration through data aggregation, organization, and searching. SharePoint Portal Server also enables users to quickly find relevant information through customization and personalization of portal content and layout as well as through audience targeting.
[edit]What is Microsoft Windows Services?
Microsoft Windows Services is the engine that allows administrators to create Web sites for information sharing and document collaboration. Windows SharePoint Services provides additional functionality to the Microsoft Office System and other desktop applications, as well as serving as a plat form for application development. SharePoint sites provide communities for team collaboration, enabling users to work together on documents, tasks, and projects. The environment for easy and flexible deployment, administration, and application development.
[edit]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.
[edit]Who is Office SharePoint Server 2007 designed for?
Office SharePoint Server 2007 can be used by information workers, IT administrators, and application developers. is designed
[edit]What are the main benefits of Office SharePoint Server 2007?
Office SharePoint Server 2007 provides a single integrated platform to manage intranet, extranet, and Internet applications across the enterprise.
Business users gain greater control over the storage, security, distribution, and management of their electronic content, with tools that are easy to use and tightly integrated into familiar, everyday applications.
Organizations can accelerate shared business processes with customers and partners across organizational boundaries using InfoPath Forms Services–driven solutions.
Information workers can find information and people efficiently and easily through the facilitated information-sharing functionality and simplified content publishing. In addition, access to back-end data is achieved easily through a browser, and views into this data can be personalized.
Administrators have powerful tools at their fingertips that ease deployment, management, and system administration, so they can spend more time on strategic tasks.
Developers have a rich platform to build a new class of applications, called Office Business Applications, that combine powerful developer functionality with the flexibility and ease of deployment of Office SharePoint Server 2007. Through the use of out-of-the-box application services, developers can build richer applications with less code.
[edit]What is the difference between Microsoft Office SharePoint Server 2007 for Internet sites and Microsoft Office SharePoint Server 2007?
Microsoft Office SharePoint Server 2007 for Internet sites and Microsoft Office SharePoint Server 2007 have identical feature functionality. While the feature functionality is similar, the usage rights are different.
If you are creating an Internet, or Extranet, facing website, it is recommended that you use Microsoft Office SharePoint Server 2007 for Internet sites which does not require the purchase client access licenses. Websites hosted using an “Internet sites” edition can only be used for Internet facing websites and all content, information, and applications must be accessible to non-employees. Websites hosted using an “Internet sites” edition cannot be accessed by employees creating, sharing, or collaborating on content which is solely for internal use only, such as an Intranet Portal scenario. See the previous section on licensing for more information on the usage scenarios.
[edit]What suites of the 2007 Microsoft Office system work with Office SharePoint Server 2007?
Office Outlook 2007 provides bidirectional offline synchronization with SharePoint document libraries, discussion groups, contacts, calendars, and tasks.
Microsoft Office Groove 2007, included as part of Microsoft Office Enterprise 2007, will enable bidirectional offline synchronization with SharePoint document libraries.
Features such as the document panel and the ability to publish to Excel Services will only be enabled when using Microsoft Office Professional Plus 2007or Office Enterprise 2007.
Excel Services will only work with documents saved in the new Office Excel 2007 file format (XLSX).
[edit]How do I invite users to join a Windows SharePoint Services Site? Is the site secure?
SharePoint-based Web sites can be password-protected to restrict access to registered users, who are invited to join via e-mail. In addition, the site administrator can restrict certain members’ roles by assigning different permission levels to view post and edit.
[edit]Can I post any kind of document?
You can post documents in many formats, including .pdf, .htm and .doc. In addition, if you are using Microsoft Office XP, you can save documents directly to your Windows SharePoint Services site.
[edit]Can I download information directly from a SharePoint site to a personal digital assistant (PDA)?
No you cannot. However, you can exchange contact information lists with Microsoft Outlook.
[edit]How long does it take to set up the initial team Web site?
It only takes a few minutes to create a complete Web site. Preformatted forms let you and your team members contribute to the site by filling out lists. Standard forms include announcements, events, contacts, tasks, surveys, discussions and links.
[edit]Can I create custom templates?
Yes you can. You can have templates for business plans, doctor’s office, lawyer’s office etc.
[edit]How can I make my site public? By default, all sites are created private.
If you want your site to be a public Web site, enable anonymous access for the entire site. Then you can give out your URL to anybody in your business card, e-mail or any other marketing material. The URL for your Web site will be: http:// yoursitename.wss.bcentral.com
Hence, please take special care to name your site. These Web sites are ideal for information and knowledge intensive sites and/or sites where you need to have shared Web workspace. Remember: Under each parent Web site, you can create up to 10 sub-sites each with unique permissions, settings and security rights.
[edit]How do the sub sites work?
You can create a sub site for various categories. For example:
Departments – finance, marketing, IT
Products – electrical, mechanical, hydraulics
Projects – Trey Research, Department of Transportation, FDA
Team – Retention team, BPR team
Clients – new clients, old clients
Suppliers – Supplier 1, Supplier 2, Supplier 3
Customers – Customer A, Customer B, Customer C
Real estate – property A, property B
The URLs for each will be, for example:
http://yoursitename.wss.bcentral.com/finance
http://yoursitename.wss.bcentral.com/marketing
You can keep track of permissions for each team separately so that access is restricted while maintaining global access to the parent site.
[edit]How do I make my site non-restricted?
If you want your site to have anonymous access enabled (i.e., you want to treat it like any site on the Internet that does not ask you to provide a user name and password to see the content of the site), follow these simple steps:
Login as an administrator
Click on site settings
Click on Go to Site Administration
Click on Manage anonymous access
Choose one of the three conditions on what Anonymous users can access:
Entire Web site
Lists and libraries
Nothing
Default condition is nothing; your site has restricted access. The default conditions allow you to create a secure site for your Web site.
[edit]Can I get domain name for my Web site?
Unfortunately, no. At this point, we don’t offer domain names for SharePoint sites. But very soon we will be making this available for all our SharePoint site customers. Please keep checking this page for further update on this. Meanwhile, we suggest you go ahead and set up your site and create content for it.
[edit]What are picture libraries?
Picture libraries allow you to access a photo album and view it as a slide show or thumbnails or a film strip. You can have separate folder for each event, category, etc
[edit]What are the advantages of a hosted SharePoint vs. one that is on an in-house server?
No hardware investment, i.e. lower costs
No software to download – ready to start from the word go
No IT resources – Anyone who has used a Web program like Hotmail can use it
Faster deployment
[edit]Can I ask users outside of my organization to participate in my Windows SharePoint Services site?
Yes. You can manage this process using the Administration Site Settings. Simply add users via their e-mail alias and assign permissions such as Reader or Contributor.
[edit]Are there any IT requirements or downloads required to set up my SharePoint site?
No. You do not need to download any code or plan for any IT support. Simply complete the on-line signup process and provide us your current and correct email address. Once you have successfully signed up and your site has been provisioned, we will send a confirmation to the email address you provided.
[edit]I am located outside of the United States. Are there any restrictions or requirements for accessing the Windows SharePoint Services?
No. There are no system or bandwidth limitations for international trial users. Additionally language packs have been installed which allow users to set up sub-webs in languages other than English. These include: Arabic, Danish, Dutch, Finnish, French, German, Hebrew, Italian, Japanese, Polish, Portuguese (Brazilian), Spanish and Swedish.
[edit]Are there any browser recommendations?
Yes. Microsoft recommends using the following browsers for viewing and editing Windows SharePoint Services sites: Microsoft Internet Explorer 5.01 with Service Pack 2, Microsoft Internet Explorer 5.5 with Service Pack 2, Internet Explorer 6, Netscape Navigator 6.2 or later.
[edit]What security levels are assigned to users?
Security levels are assigned by the administrator who is adding the user. There are four levels by default and additional levels can be composed as necessary.
Reader – Has read-only access to the Web site.
Contributor – Can add content to existing document libraries and lists.
Web Designer – Can create lists and document libraries and customize pages in the Web site.
Administrator – Has full control of the Web site.
[edit]How secure are Windows SharePoint Services sites hosted by Microsoft?
Microsoft Windows SharePoint Services Technical security measures provide firewall protection, intrusion detection, and web-publishing rules. The Microsoft operation center team tests and deploys software updates in order to maintain the highest level of security and software reliability. Software hot-fixes and service packs are tested and deployed based on their priority and level of risk. Security related hot-fixes are rapidly deployed into the environment to address current threats. A comprehensive software validation activity ensures software stability through regression testing prior to deployment.
[edit]What is the difference between an Internet and an intranet site?
An internet site is a normal site that anyone on the internet can access (e.g., www.msn.com, www.microsoft.com, etc.). You can set up a site for your company that can be accessed by anyone without any user name and password. The internet is used for public presence and a primary marketing tool managed typically by web programmers and a system administrator.
An intranet (or internal network), though hosted on a Web site, can only be accessed by people who are members of a specific network. They need to have a login and password that was assigned to them when they were added to the site by the site administrator. The intranet is commonly used as an internal tool for giving employees access to company information. Content is driven by business relevance, business rules and has increasingly become a common tool in larger organizations. An intranet is becoming more and more the preferred method for employees to interact with each other and the central departments in an organization, whether or not the organization has a Web presence.
[edit]What is a workspace?
A site or workspace is when you want a new place for collaborating on Web pages, lists and document libraries. For example, you might create a site to manage a new team or project, collaborate on a document or prepare for a meeting.
[edit]What are the various kinds of roles the users can have?
A user can be assigned one of the following roles
Reader – Has read-only access to the Web site.
Contributor – Can add content to existing document libraries and lists.
Web Designer – Can create lists and document libraries and customize pages in the Web site.
Administrator – Has full control of the Web site.
[edit]Can more than one person use the same login?
If the users sharing that login will have the same permissions and there is no fear of them sharing a password, then yes. Otherwise, this is discouraged.
[edit]How customizable is the user-to-user access?
User permissions apply to an entire Web, not to documents themselves. However, you can have additional sub webs that can optionally have their own permissions. Each user can be given any of four default roles. Additional roles can be defined by the administrator.
[edit]Can each user have access to their own calendar?
Yes there are two ways to do this,
by creating a calendar for each user, or
by creating a calendar with a view for each user
[edit]How many files can I upload?
There is no restriction in place except that any storage consumed beyond that provided by the base offering may have an additional monthly charge associated with them.
[edit]What types of files can I upload / post to the site?
The only files restricted are those ending with the following extensions: .asa, .asp, .ida, .idc, .idq. Microsoft reserves the right to add additional file types to this listing at any time. Also, no content that violates the terms of service may be uploaded or posted to the site.
[edit]Can SharePoint be linked to an external data source?
SharePoint data can be opened with Access and Excel as an external data source. Thus, SharePoint can be referenced as an external data source. SharePoint itself cannot reference an external data source.
But 3rd pary software can do this for you: http://www.layer2.de/en/products/pages/sharepoint-business-data-list-connector.aspx
[edit]Can SharePoint be linked to a SQL database?
SharePoint 2007 Portal Server (MOSS2K7) allows connections to SQL based datasources via the Business Data Catalog (BDC). The BDC also allows connecting to data via Web Services.
[edit]Can I customize my Windows SharePoint Services site?
YES! Windows SharePoint Services makes updating sites and their content from the browser easier then ever.
SharePoint includes tools that let you create custom lists, calendars, page views, etc. You can apply a theme; add List, Survey and Document Library Web Parts to a page; create personal views; change logos; connect Web Parts and more.
To fully customize your site, you can use Microsoft FrontPage 2003. Specifically, you can use FrontPage themes and shared borders, and also use FrontPage to create photo galleries and top ten lists, utilize standard usage reports, and integrate automatic Web content.
[edit]Will Microsoft Office SharePoint Server 2007 run on a 64-bit version of Microsoft Windows?
Windows SharePoint Services 3.0, Office SharePoint Server 2007, Office Forms Server 2007, and Office SharePoint Server 2007 for Search will support 64-bit versions of Windows Server 2003.
[edit]How Office SharePoint Server 2007 can help you?
Office SharePoint Server 2007 can help us:
Manage content and streamline processes. Comprehensively manage and control unstructured content like Microsoft Office documents, Web pages, Portable Document Format file (PDF) files, and e-mail messages. Streamline business processes that are a drain on organizational productivity.
Improve business insight. Monitor your business, enable better-informed decisions, and respond proactively to business events.
Find and share information more simply. Find information and expertise wherever they are located. Share knowledge and simplify working with others within and across organizational boundaries.
Empower IT to make a strategic impact. Increase responsiveness of IT to business needs and reduce the number of platforms that have to be maintained by supporting all the intranet, extranet, and Web applications across the enterprise with one integrated platform.
Office SharePoint Server 2007 capabilities can help improve organizational effectiveness by connecting people, processes, and information.
Office SharePoint Server 2007 provides these capabilities in an integrated server offering, so your organization doesn’t have to integrate fragmented technology solutions itself.
[edit]What are the features that the portal components of Office SharePoint Server 2007 include?
The portal components of Office SharePoint Server 2007 include features that are especially useful for designing, deploying, and managing enterprise intranet portals, corporate Internet Web sites, and divisional portal sites. The portal components make it easier to connect to people within the organization who have the right skills, knowledge, and project experience.
[edit]What are the advanced features of MOSS 2007?
User Interface (UI) and navigation enhancements
Document management enhancements
The new Workflow engine
Office 2007 Integration
New Web Parts
New Site-type templates
Enhancements to List technology
Web Content Management
Business Data Catalog
Search enhancements
Report Center
Records Management
Business Intelligence and Excel Server
Forms Server and InfoPath
The “Features” feature
Alternate authentication providers and Forms-based authentication
[edit]What are the features of the new Content management in Office SharePoint 2007?
The new and enhanced content management features in Office SharePoint Server 2007 fall within three areas:
Document management
Records management
Web content management
Office SharePoint Server 2007 builds on the core document management functionality provided by Windows SharePoint Services 3.0, including check in and check out, versioning, metadata, and role-based granular access controls. Organizations can use this functionality to deliver enhanced authoring, business document processing, Web content management and publishing, records management, policy management, and support for multilingual publishing.
[edit]Does a SharePoint Web site include search functionality?
Yes. SharePoint Team Services provides a powerful text-based search feature that helps you find documents and information fast.
[edit]Write the features of the search component of Office SharePoint Server 2007?
The search component of Office SharePoint Server 2007 has been significantly enhanced by this release of SharePoint Products and Technologies. New features provide:
A consistent and familiar search experience.
Increased relevance of search results.
New functions to search for people and expertise.
Ability to index and search data in line-of-business applications and
Improved manageability and extensibility.
[edit]What are the benefits of Microsoft Office SharePoint Server 2007?
Provide a simple, familiar, and consistent user experience.
Boost employee productivity by simplifying everyday business activities.
Help meet regulatory requirements through comprehensive control over content.
Effectively manage and repurpose content to gain increased business value.
Simplify organization-wide access to both structured and unstructured information across disparate systems.
Connect people with information and expertise.
Accelerate shared business processes across organizational boundaries.
Share business data without divulging sensitive information.
Enable people to make better-informed decisions by presenting business-critical information in one central location.
Provide a single, integrated platform to manage intranet, extranet, and Internet applications across the enterprise.
[edit]Will SharePoint Portal Server and Team Services ever merge?
The products will come together because they are both developed by the Office team.
[edit]What does partial trust mean the Web Part developer?
If an assembly is installed into the BIN directory, the code must be ensured that provides error handling in the event that required permissions are not available. Otherwise, unhandled security exceptions may cause the Web Part to fail and may affect page rendering on the page where the Web Part appears.
[edit]How can I raise the trust level for assemblies installed in the BIN directory?
Windows SharePoint Services can use any of the following three options from ASP.NET and the CLR to provide assemblies installed in the BIN directory with sufficient permissions. The following table outlines the implications and requirements for each option.
Option Pros Cons
Increase the trust level for the entire virtual server. For more information, see “Setting the trust level for a virtual server” Easy to implement.
In a development environment, increasing the trust level allows you to test an assembly with increased permissions while allowing you to recompile assemblies directly into the BIN directory without resetting IIS. This option is least secure.
This option affects all assemblies used by the virtual server. There is no guarantee the destination server has the required trust level. Therefore, Web Parts may not work once installed on the destination server.
Create a custom policy file for your assemblies. For more information, see “How do I create a custom policy file?” Recommended approach.
This option is most secure.
An assembly can operate with a unique policy that meets the minimum permission requirements for the assembly.
By creating a custom security policy, you can ensure the destination server can run your Web Parts.
Requires the most configuration of all three options. Install your assemblies in the GAC
Easy to implement. This grants Full trust to your assembly without affecting the trust level of assemblies installed in the BIN directory.
This option is less secure.
Assemblies installed in the GAC are available to all virtual servers and applications on a server running Windows SharePoint Services. This could represent a potential security risk as it potentially grants a higher level of permission to your assembly across a larger scope than necessary
In a development environment, you must reset IIS every time you recompile assemblies.
Licensing issues may arise due to the global availability of your assembly.
[edit]Does SharePoint work with NFS?
Yes and no. It can crawl documents on an NFS volume, but the sharepoint database or logs cannot be stored there.
[edit]How is SharePoint Portal Server different from the Site Server?
Site Server has search capabilities but these are more advanced using SharePoint. SPS uses digital dashboard technology which provides a nice interface for creating web parts and showing them on dashboards (pages). SS doesn’t have anything as advanced as that. The biggest difference would be SPS document management features which also integrate with web folders and MS Office.
[edit]What would you like to see in the next version of SharePoint?
A few suggestions:
SPS and STS on same machine
Tree view of Categories and Folders
General Discussion Web Part
Personalization of Dashboards
Role Customization
Email to say WHY a document has been rejected for Approval
More ways to customize the interface
Backup and restore an individual Workspaces
Filter for Visio
Better way to track activity on SPS
Ability to Save as from Adobe to space on My Network Places
[edit]Why Sharepoint is not a viable solution for enterprise wide deployments?
Planning an enterprise deployment using SharePoint features is a very difficult task unless you can establish a Service Oriented Architecture, using AD for managing security with well defined roles based information access(EISA). Sounds reasonable, although it seems difficult to deploy with the tools limitations in document storage.
Document management does not scale beyond a single server, but scales great within a single server. For example, a quad Xeon machine with 4GB of RAM works great for a document management server that has about 900,000 – 1,000,000 document, but if you need to store 50,000,000 document and want to have them all in one single workspace then it does not scale at all. If you need a scenario like this, you need to plan your deployment right and it should scale for you, it just does not right out of the box. If you are using your server as a portal and search server most for the most part it scales great. You can have many different servers crawl content sources and have separate servers searching and serving the content.
If you have < 750,000 documents per server and fewer than 4 content sources and fewer than 50,000 users, SPS should scale just fine for your needs with the proper planning.
[edit]What are the actual advantages of SharePoint Portal Services (SPS) over SharePoint Team Services (STS)?
SharePoint Portal Services (SPS) has MUCH better document management. It has check-in, check-out, versioning, approval, publishing, subscriptions, categories, etc. STS does not have these features, or they are very scaled back. SharePoint Portal Services (SPS) has a better search engine, and can crawl multiple content sources. STS cannot. STS is easier to manage and much better for a team environment where there is not much Document Management going on. SPS is better for an organization, or where Document Management is crucial.
[edit]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.
[edit]How do I open an older version of a document?
Normally, all previous versions are located in the shadow, so if you right click a published document from within the web folders, go to properties and then the third tab, versions you can view older versions.
If you want to do this in code:
strURL = “url of the last published version”
Set oVersion = New PKMCDO.KnowledgeVersion
Set prmRs = oVersion.VersionHistory(strURL)
Set oVersion = Nothing
prmRS will contain a recordset, which contains the url to the old versions in the shadow.
[edit]Why do the workspace virtual directories show the error “stop sign” symbol in the IIS snap-in?
If World Wide Web Publishing Service (W3SVC) starts before Microsoft Exchange Information Store (MSExchangeIS), “stop sign” symbols appear under the Default Web Site folder of the Internet Information Services console in Microsoft Management Console (MMC).
There is a dependency between the local paths of the SharePoint Portal Server virtual directories and the MSExchangeIS. You must start MSExchangeIS first, followed by W3SVC.
Complete the following steps to prevent the stop signs from appearing each time you restart:
Change the Startup type for W3SVC to Manual.
Restart the server. The MSExchangeIS service starts automatically.
Start W3SVC.
[edit]What newsgroups are available?
There are two,
microsoft.public.sharepoint.portalserver and
microsoft.public.sharepoint.portalserver.development.
[edit]What is SharePoint from a Technical Perspective?
Technically SharePoint illustrates neatly what Microsoft’s .net strategy is all about: integrating Windows with the Web. Microsoft has previously made accessing stuff on a PC easier, (Windows) then on a network (NT) and now on the web (.NET). SharePoint is an application written to let a user access a web accessible directory tree called the Web Storage System.
SharePoint was written with a set of technologies that allow the programmer to pass data, functions, parameters over HTTP, the web’s medium. These are XML, XSL and SOAP, to name a few I understand the basics of!
To the user it looks easy, like Hotmail, but every time they click a button or a link, a lot has to happen behind the scenes to do what they want to do quickly and powerfully. Not as easy as you might think, but SharePoint does it for you. Accessing this Web storage system and the server itself is also done using technologies like ADO, CDO, PKMCDO, LDAP, DDSC, ADSC. More on these later. SharePoint is a great example of how the Internet Platform can be extended and integrated into an existing well adopted technology, Windows.
[edit]What is SharePoint from an Administration Perspective?
Administering SharePoint mainly consists of setting it up, which is much easier than you expect, adding the content, which can be just dragging and dropping in whole directory structures and files, and then organizing the files better by giving them categories or other metadata. This is done either through the Web interface or through the SharePoint Client: a program what means you can access SharePoint as a Web folder and then right-click files to select options like “edit profile”. Or add files by dragging them in individually or in bulk.
Setting the security is also important, using NT accounts, either NT4 or Active Directory (or both in mixed mode) you can give users access to files/folders the same way as you do in standard Windows. Users can be grouped and the groups given access privileges to help manage this better. Also SharePoint has 3 Roles that a User or Group can be given on a particular item. Readers can see the item (i.e. document/file or folder) but not change it, Authors can see and edit items and coordinators can set security privileges for the part of the system they have control over. Thus, you could set 12 different coordinators for 12 different folder trees, and they could manage who can do what within that area only.
[edit]What is SharePoint from a Users Perspective?
From a Users perspective SharePoint is a way of making documents and folders on the Windows platform accessible over the web. The user visits the SharePoint Portal web page, and from there they can add documents, change documents & delete documents. Through this Portal, these documents are now available for discussion, collaboration, versioning and being managed through a workflow. Hence the name “Share-Point”. Details about the document can be saved too, such as: who wrote it, when, for whom, its size, and version, category or target audience. These can then be used to find the document through SharePoint’s Search facility. Even documents not “in” SharePoint can be included in the search engine’s index so they become part of the portal. All in all, it’s a great way to get stuff up on the web for users with average technical skills, and for administrators to manage the content.
[edit]What are the various Sharepoint 2003 and Exchange integration points?
[edit]Link to Outlook
This is a button on contacts or events lists that lets Outlook 2003 add a pst file named Sharepoint Folders and it links to the data on the site. It’s read-only, but you could make the home page for that PST be the Sharepoint site for easier viewing. The link to outlook feature seems more to be where some can public a calendar, but not want too much collaboration. For example, a holiday schedule, company meeting schedule, etc, can be made available for people to be able to view from Outlook without having to go to a web browser. Another nice thing about OL2K3 is that you can compare these calendars with others side by side.
[edit]Searching Public Folders
With SPS you can index Exchange’s public folders with the search engine so that all that precious public folder content is searchable. You’ll want to look at content sources and indexing in Sharepoint administration.
[edit]Displaying Public Folders in a web part
Since exchange web-enables public folders, you can create a web part that displays that content. IE, http://exchangeserver/Public/IT/Helpdesk will display the IT/Helpdesk public folder via OWA. So you add the Page Viewer web part to a page and point it at that URL. The key here is to add ?cmd=contents to the end of the url if you don’t want the navigator pane on the left.
[edit]Smart web parts
Some of the web parts that come with SPS allow you to add a web part to a page that actually takes the users outlook info (calendar, inbox, contacts, tasks) and put them into the page.
The SmartPart Web Part project template for Visual Studio allows developers to create quickly a project which contains the base infrastructure to:
* write a web user control (ASCX)
* wrap the user control in a SmartPart instance
* generate a SharePoint Solution file (WSP) for easy deployment
* generate a setup package for a wizard driven installation
[edit]Can SharePoint compare two document versions?
“In Word 2003, you can compare documents side by side. Open two documents. Then, from the Window menu of one of them, select the Compare Side By Side command. If you have only two documents open, the command will automatically choose to compare them. If you have three or more documents open, you’ll have to select which document to compare with the current file.
A floating toolbar with two buttons will open. If the button on the left is selected, Word will scroll both documents at the same time. Press the button on the right side of the toolbar to return to where the cursor was located when you started comparing.”
[edit]What are the integration differences between SPS 2003 and the various Office versions?
SPS webpage can detect you have installed the Office 2003 and run local dll to implement some SPS function, e.g. multi-file upload only works when you have office 2003 installed.
Integration with Office XP is gone.
You will get guys telling you that you can integrate with SPSv2 if you install a backwards compatible document library – but that’s really just putting a bit of SPS 2001 on the server.
Believe me, check-in, check-out, which are themselves very basic, are not available from inside Office XP, or even from the context menu in Windows Explorer.
The ONLY option you have is to use the web interface to check-in or check-out.
http://it.toolbox.com/wiki/index.php/Sharepoint_Interview_questions#What_are_picture_libraries.3F
—————–
http://iminvincible.com/faq.aspx
———-
1. Add new document to Document Library in SharePoint using C#
Here is the code for adding new document to document library using C#. I have created a page with a file upload control and a button. When user clicks on button the selected document will be uploaded to specific document library. You need to add reference to Microsoft.SharePoint DLL to make this code running.
if (FileUpload1.PostedFile != null)
{
if(FileUpload1.PostedFile.ContentLength > 0)
{
System.IO.Stream strm = FileUpload1.PostedFile.InputStream;
byte[] byt = new byte[
Convert.ToInt32 (FileUpload1.PostedFile.ContentLength)];
strm.Read(byt, 0, Convert.ToInt32
(FileUpload1.PostedFile.ContentLength));
strm.Close();
// Open site where document library is created.
using (SPSite objSite = new SPSite(“http://server:port/”))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPFolder mylibrary = objWeb.Folders["Name of Document Library"];
// Set AllowUnsafeUpdates = true to avoid security error
objWeb.AllowUnsafeUpdates = true;
mylibrary.Files.Add(System.IO.Path.GetFileName
(FileUpload1.PostedFile.FileName), byt);
}
}
}
}
Above code first reads the uploaded file in Stream and than uploads it on document library.
2.
Nishant Rana’s Weblog
Everything related to Microsoft .NET technology
Code snippets My CRM Learning Useful CRM Tools Links Head First OOAD(C#) News for Microsoft Lovers Posted by: Nishant Rana | June 26, 2008 Programmatically uploading and setting permission to a document in a document library in SharePointWe can use the following code for uploading a document to document library.
// create a filestream object and open an existing file for reading its contents
FileStream oFileStream = File.OpenRead(@”C:\G.doc”);
byte[] content = new byte[oFileStream.Length];
// store the contents in a byte array
oFileStream.Read(content, 0, (int)oFileStream.Length);
oFileStream.Close();
// create an SPSIte object
using (SPSite objSite = new SPSite(“http://d-1246?))
{
// get reference to the web application or web site
using (SPWeb objWeb = objSite.OpenWeb())
{
// get reference to the document library. Proposal – name of the document library
SPFolder mylibrary = objWeb.Folders["Proposal"];
objWeb.AllowUnsafeUpdates = true;
// add the file to the document library and update it
SPFile myFile = mylibrary.Files.Add(“MyProposal.doc”, content, true);
mylibrary.Update();
// get the reference to the file just uploaded as a SPListItem for setting permissions
SPListItem myListItem = myFile.Item;
// HasUniqueRoleAssignments – returns false if it inherits permission from parent else true
myListItem.HasUniqueRoleAssignments.ToString());
// BreakRoleInheritance – breaking role inheritance so that we can define our own permissions
myListItem.BreakRoleInheritance(false);
// webroledefinitions – Full Right, Design, Contribute and Read
SPRoleDefinitionCollection webroledefinitions = objWeb.RoleDefinitions;
// group – different groups created in that site
SPGroup group = objWeb.SiteGroups[“MyGroup”];
SPRoleAssignment roleassignment = new SPRoleAssignment(group);
roleassignment.RoleDefinitionBindings.Add(webroledefinitions[“Design”]);
myListItem.RoleAssignments.Add(roleassignment);
// same for the user as well
SPUser user = objWeb.SiteUsers[@"domainname\username"];
SPRoleAssignment roleassignment1 = new SPRoleAssignment(user);
roleassignment1.RoleDefinitionBindings.Add(webroledefinitions["Full Control"]);
myListItem.RoleAssignments.Add(roleassignment1);
}
}
3.
Download all files from SharePoint Library
Now, we are going to see how we can download all documents(incluing sub folders) from SharePoint Library.
First of all,we have get all documents from SharePoint Library. The following code help us to get all the documents including Subfolders.
//Get the Document Library and its view
SPList list = web.Lists["Test Document"];
SPView view = list.Views["All Documents"];
//Query all documents in Library including files under subfolders
SPQuery squery = new SPQuery(view);
squery.ViewAttributes = “Scope=\”Recursive\””;
SPListItemCollection items = list.GetItems(squery);
Now we have to write a code for downloaing documents,
//Read all documents and write those files to Local System
foreach (SPListItem item in items)
{
byte[] binfile = item.File.OpenBinary();
FileStream fstream = new FileStream(“F:\\” + item.File.Name, FileMode.Create, FileAccess.ReadWrite);
fstream.Write(binfile, 0, binfile.Length);
fstream.Close();
}
4.Programmatically creating folder in SharePoint Document library
SPSite _MySite = new SPSite(“http://adfsaccount:2222/”);
34.
SPWeb _MyWeb = _MySite.OpenWeb();
35.
36.
SPDocumentLibrary _MyDocLibrary = (SPDocumentLibrary) _MyWeb.Lists["My Documents"];
37.
SPFolderCollection _MyFolders = _MyWeb.Folders;
38.
_MyFolders.Add(“http://adfsaccount:2222/My%20Documents/” + txtUpload.Text + “/”);
39.
_MyDocLibrary.Update();
40.
MessageBox.Show(“Docuemnt Created”);
5.
Podcasting Kit for SharePoint
PKS is freely available on codeplex. It allows you to use MOSS as a podcasting platform. Users can upload documents/podcasts/videocasts along with secondary files. This is great if you want to store your sample code, documentation, etc. along with your podcast.
http://blogs.3sharp.com/johnp/archive/2008/06/09/pks.aspx
6.What is the External Collaboration Toolkit for SharePoint?
The External Collaboration Toolkit for SharePoint provides guidance and tools to deploy a pre-built, customizable SharePoint solution that teams can use to collaborate with those outside the firewall. At the same time, the toolkit helps ensure that sensitive data on these systems is protected.
Once the ECTS is installed, your users can be up and running with a secure, SharePoint-based team site in minutes. They can easily invite external users to collaborate, sharing documents that are centrally located on a SharePoint site inside the firewall. Administrators can require administrative approval for all new sites and users, or they can delegate this control to end users and free up time for other tasks.
Where do I access the External Collaboration Toolkit for SharePoint?
The ECTS is available now at http://www.microsoft.com/collabkit.
LINQ Notes 1
November 23, 2009Book name: programming microsoft linq
1.LINQ to Objects
2.LINQ to ADO.NET
LINQ to SQL
LINQ to DataSet
LINQ to Entities (see note below)
3.LINQ to XML
4. Parallel LINQ (PLINQ
INTO clause
—————
You can use the into keyword to store the results of a
select, group, or join statement in a temporary variable
var categoriesAndProducts =
from c in categories
join p in products on c.IdCategory equals p.IdCategory
select new {
c.IdCategory,
CategoryName = c.Name,
Product = p.Description
};
foreach (var item in categoriesAndProducts) {
Console.WriteLine(item);
2.Let Clause
———-
The let clause allows you to store the result of a
subexpression in a variable that can be used somewhere else
in the query. This clause is useful when you need to reuse
the same expression many times in the same query and you do
not want to define it every single time you use it. Using
the let clause, you can define a new range variable for that
expression and reference it within the query. Once assigned,
a range variable defined by a let clause cannot be changed.
However, if the range variable holds a queryable type, it
can be queried. In Listing 2-21, you can see an example of
this clause applied to select the same product categories
with the count of their products, sorted by the counter
itself.
Listing 2-21: A C# 3.0 sample of usage of the let clause
var categoriesByProductsNumberQuery =
from c in categories
join p in products on c.IdCategory equals
p.IdCategory
into productsByCategory
let ProductsCount = productsByCategory.Count()
orderby ProductsCount
select new { c.IdCategory, ProductsCount};
foreach (var item in categoriesByProductsNumberQuery) {
Console.WriteLine(item);
}
Aggregate, which is useful for applying an aggregate
function to a data source. It can be used to begin a new
query instead of a From clause.
Distinct, which can be used to eliminate duplicate values in
query results.
Skip, which can be used to skip the first N elements of a
query result.
Skip While, which can be used to skip the first elements of
a query result that verify a predicate that is provided.
Take, which can be used to take the first N elements of a
query result.
Take While, which can be used to take the first elements of
a query result that verify a predicate that is provided.
——
LINQ to Objects
1. projection operators:
select and select many
2.orderby and orderbydescending
3. Thenby and thenbydescending
4. reverse operator
5. Join
GroupJoin
In cases in which you need to define something similar to a
LEFT OUTER JOIN or a RIGHT OUTER JOIN, you need to use the
GroupJoin operator
6. Set Operators
Distinct
Union,INtersect, Except
7. Aggregate Operators
Count , LongCount
LongCount variations simply return a long instead of an
integer.
SUM,MIn,MAx,
Aggregate
8.Generation Operators
Repeat , Range.empty
9. Quantifier Operators
Any,All,CONTAINS
10.Partitioning Operators
Take (Top in Sql)
TakeWhile
Skip, SkipWhile
11. Element Operators
First
FirstOrDefault : If you need to find the first element only
if it exists, without any exception in case of failure, you
can use the FirstOrDefault method. This method works like
First, but if there are no elements that verify the
predicate or if the source sequence is empty, it returns a
default value:
LAst
LastOrDefault
Single
SingleORDefault
ElementAt and ElementAtOrDefault
DefaultEmpty
—-
1. SubmitChanges
in-memory changes(dataset) to the database by calling
SubmitChanges:
Product product = db.Products.Single(p => p.ProductID ==
42);
product.UnitPrice *= 1.05M;
db.SubmitChanges();
2.
Association between entities
[Table(Name="Orders")]
public class Order {
[Column(IsPrimaryKey=true)] public int OrderID;
[Column] private string CustomerID;
[Column] public DateTime? OrderDate;
[Association(Storage="_Customer", ThisKey="CustomerID",
IsForeignKey=true)]
public Customer Customer {
get { return this._Customer.Entity; }
set { this._Customer.Entity = value; }
}
private EntityRef<Customer> _Customer;
}
3.DataLoadOptions, AssociateWith
[Table(Name="Customers")]
public class Customer {
[Column(IsPrimaryKey=true)] public string CustomerID;
[Column] public string CompanyName;
[Column] public string Country;
[Association(OtherKey="CustomerID")]
public EntitySet<Order> Orders;
}
4.
static void QueryManipulation() {
DataContext db = new DataContext( ConnectionString );
Table<Customer> Customers = db.GetTable<Customer>();
db.Log = Console.Out;
// All Customers
var query =
from c in Customers
select new {c.CompanyName, c.State, c.Country };
DisplayTop( query, 10 );
// User interaction add a filter
// to the previous query
// Customers from USA
query =
from c in query
where c.Country == “USA”
select c;
DisplayTop( query, 10 );
// User interaction add another
// filter to the previous query
// Customers from WA, USA
query =
from c in query
where c.State == “WA”
select c;
DisplayTop( query, 10 );
}
static void DisplayTop<T>( IQueryable<T> query, int rows ) {
foreach( var row in query.Take(rows)){
Console.WriteLine( row );
}
}
5.How to call sps in linq
Stored Procedures:
ExecuteMethodCall,
Consider the Customers by City stored procedure:
CREATE PROCEDURE [dbo].[Customers By City]( @param1
NVARCHAR(20) )
AS BEGIN
SET NOCOUNT ON;
SELECT CustomerID, ContactName, CompanyName, City
FROM Customers AS c
WHERE c.City = @param1
END
You can define a method decorated with a Function attribute
that calls the stored procedure through the
ExecuteMethodCall method of the DataContext class. In
Listing 4-12, we define CustomersByCity as a member of a
class derived from DataContext.
Listing 4-12: Stored procedure declaration
class SampleDb : DataContext {
// …
[Function(Name = "Customers by City", IsComposable =
false)]
public ISingleResult<CustomerInfo>
CustomersByCity(string param1) {
IExecuteResult executeResult =
this.ExecuteMethodCall(
this,
(MethodInfo)
(MethodInfo.GetCurrentMethod()),
param1);
ISingleResult<CustomerInfo> result =
(ISingleResult<CustomerInfo>)
executeResult.ReturnValue;
return result;
}
}
b.
Stored procedure with multiple results
class SampleDb : DataContext {
// …
[Function(Name = "TwoCustomerGroups", IsComposable =
false)]
[ResultType(typeof(CustomerInfo))]
[ResultType(typeof(CustomerShortInfo))]
public IMultipleResults TwoCustomerGroups() {
IExecuteResult executeResult =
this.ExecuteMethodCall(
this,
(MethodInfo)
(MethodInfo.GetCurrentMethod()));
IMultipleResults result =
(IMultipleResults) executeResult.ReturnValue;
return result;
}
}
6. How to call a UDF in LINQ
Function attribute is used for both stored procedures and
UDFs, the IsComposable argument is set to true to map a UDF,
and is set to false to map a stored procedure.
a. Scalar valued udf
class SampleDb : DataContext {
// …
[Function(Name = "dbo.MinUnitPriceByCategory",
IsComposable = true)]
public decimal? MinUnitPriceByCategory(int? categoryID)
{
IExecuteResult executeResult =
this.ExecuteMethodCall(
this,
((MethodInfo)
(MethodInfo.GetCurrentMethod())),
categoryID);
decimal? result = (decimal?)
executeResult.ReturnValue;
return result;
}
}
b. Table Valued UDF
A table-valued UDF always sets IsComposable to true in
Function arguments, but it calls the
DataContext.CreateMethodCallQuery instead of
DataContext.ExecuteMethodCall.
Listing 4-15: Table-valued user-defined function
class SampleDb : DataContext {
// …
[Function(Name = "dbo.CustomersByCountry", IsComposable
= true)]
public IQueryable<Customer> CustomersByCountry(string
country) {
return this.CreateMethodCallQuery<Customer>(
this,
((MethodInfo) (MethodInfo.GetCurrentMethod())),
country);
}
}
8. CompiledQueryClass
If you need to repeat the same query many times, eventually
with different argument values, you might be worried about
the multiple query construction. Several databases, such as
SQL Server, try to parameterize received SQL queries
automatically to optimize the compilation of the query
execution plan. However, the program that sends a
parameterized query to SQL Server will get better
performance because SQL Server does not spend time to
analyze it if the query is similar to another one already
processed. LINQ already does a fine job of query
optimization, but each time that the same query tree is
evaluated, the LINQ to SQL engine parses the query tree to
build the equivalent SQL code. You can optimize this
behavior by using the CompiledQuery class.
9.
Direct Queries
Sometimes you might need access to database SQL features
that are not available with LINQ. For example, imagine that
you want to use Common Table Expressions (CTEs) or the PIVOT
command with SQL Server. LINQ does not have an explicit
constructor to do that, even if its SQL Server provider
could use these features to optimize some queries. Listing
4-22 shows how you can use the ExecuteQuery<T> method of the
DataContext class to send a query directly to the database.
The T in ExecuteQuery<T> is an entity class that represents
a returned row.
Listing 4-22: Direct query
var query = db.ExecuteQuery<EmployeeInfo>( @”
WITH EmployeeHierarchy (EmployeeID, LastName, FirstName,
ReportsTo, HierarchyLevel) AS
( SELECT EmployeeID,LastName, FirstName,
ReportsTo, 1 as HierarchyLevel
FROM Employees
WHERE ReportsTo IS NULL
UNION ALL
SELECT e.EmployeeID, e.LastName, e.FirstName,
e.ReportsTo, eh.HierarchyLevel + 1 AS
HierarchyLevel
FROM Employees e
INNER JOIN EmployeeHierarchy eh
ON e.ReportsTo = eh.EmployeeID
)
SELECT *
FROM EmployeeHierarchy
ORDER BY HierarchyLevel, LastName, FirstName” );
10.Deferred Loading of Entities
We have seen that using graph traversal to query data is a
very comfortable way to proceed. However, sometimes you
might want to stop the LINQ to SQL provider from
automatically deciding what entities have to be read from
the database and when, thereby taking control over that part
of the process. You can do this by using the
DeferredLoadingEnabled and LoadOptions properties of the
DataContext class.
The code in Listing 4-24 makes the same QueryOrder call
under three different conditions, driven by the code in the
DemoDeferredLoading method.
Listing 4-24: Deferred loading of entities
public static void DemoDeferredLoading() {
Console.Write(“DeferredLoadingEnabled=true “);
DemoDeferredLoading(true);
Console.Write(“DeferredLoadingEnabled=false “);
DemoDeferredLoading(false);
Console.Write(“Using LoadOptions “);
DemoLoadWith();
}
static void DemoDeferredLoading(bool deferredLoadingEnabled)
{
nwDataContext db = new
nwDataContext(Connections.ConnectionString);
db.DeferredLoadingEnabled = deferredLoadingEnabled;
QueryOrder(db);
}
static void DemoLoadWith() {
nwDataContext db = new
nwDataContext(Connections.ConnectionString);
db.DeferredLoadingEnabled = false;
DataLoadOptions loadOptions = new DataLoadOptions();
loadOptions.LoadWith<Order>(o => o.Order_Details);
db.LoadOptions = loadOptions;
QueryOrder(db);
}
static void QueryOrder(nwDataContext db) {
var order = db.Orders.Single((o) => o.OrderID == 10251);
var orderValue = order.Order_Details.Sum(od =>
od.Quantity * od.UnitPrice);
Console.WriteLine(orderValue);
}
11.Deferred Loading of Properties
LINQ to SQL provides a deferred loading mechanism that acts
at the property level, loading data only when that property
is accessed for the first time. You can use this mechanism
when you need to load a large number of entities in memory,
which usually requires space to accommodate all the
properties of the class that correspond to table columns of
the database. If a certain field is very large and is not
always accessed for every entity, you can delay the loading
of that property.
To request the deferred loading of a property, you simply
use the Link<T> type to declare the storage variable for the
table column, as you can see in Listing 4-25.
Listing 4-25: Deferred loading of properties
[Table(Name = "Customers")]
public class DelayCustomer {
private Link<string> _Address;
[Column(IsPrimaryKey = true)] public string CustomerID;
[Column] public string CompanyName;
[Column] public string Country;
[Column(Storage = "_Address")]
public string Address {
get { return _Address.Value; }
set { _Address.Value = value; }
}
}
public static class DeferredLoading {
public static void DelayLoadProperty() {
DataContext db = new
DataContext(Connections.ConnectionString);
Table<DelayCustomer> Customers =
db.GetTable<DelayCustomer>();
db.Log = Console.Out;
var query =
from c in Customers
where c.Country == “Italy”
select c;
foreach (var row in query) {
Console.WriteLine(
“{0} – {1}”,
row.CompanyName,
row.Address);
}
}
}
12.Read-Only DataContext Access
If you need to access data exclusively in a read-only way,
you might want to improve performance by disabling a
DataContext service that supports data modification:
DataContext db = new DataContext( ConnectionString );
db.ObjectTrackingEnabled = false;
var query = …
The ObjectTrackingEnabled property controls the change
tracking service .By default, ObjectTrackingEnabled is set
to true.
13.
Limitations of LINQ to SQL
LINQ to SQL has some limitations when converting a LINQ
query into a corresponding SQL statement. For this reason,
some valid LINQ to Objects statements are not supported in
LINQ to SQL. In this section, we cover the most important
operators that cannot be used in aLINQ to SQL query.
More Info A complete list of unsupported methods and types
is available in the product documentation, “Data Types and
Functions (LINQ to SQL),” which is available at
http://msdn2.microsoft.com/en-us/library/bb386970.aspx.
Aggregate Operators
The general-purpose Aggregate operator is not supported.
However, specialized aggregate operators such as Count,
LongCount, Sum, Min, Max, and Average are fully supported.
Any aggregate operator other than Count and LongCount
requires particular care to avoid an exception if the result
is null. If the entity class has a member of a non-nullable
type and you make an aggregation on it, a null result (for
example when no rows are aggregated) throws an exception.
You need to cast the aggregated value to a nullable type
before considering it in the aggregation function in order
to avoid that exception. You can see an example of the
necessary cast in Listing 4-26.
Listing 4-26: Null handling with aggregate operators
decimal? totalFreight =
(from o in Orders
where o.CustomerID == “NOTEXIST”
select o).Min( o => (decimal?) o.Freight );
This cast is necessary only if you declared the Freight
property with decimal:
[Table(Name = "Orders")]
public class Order {
[Column] public decimal Freight;
}
Another solution is declaring Freight as a nullable type
using decimal?, but it is not a good idea to have different
nullable settings between entities and corresponding tables
in the database.
More Info You can find a more complete discussion about
this issue in this post written by Ian Griffiths:
http://www.interact-sw.co.uk/iangblog/2007/09/10/linq-aggreg
ates.
Partitioning Operators
The TakeWhile and SkipWhile operators are not supported.
Take and Skip operators are supported, but be careful with
Skip because the generated SQL query could be complex and
not very efficient when there are a large number of rows to
skip, particularly if the target database is SQL Server
2000.
Element Operators
The following operators are not supported: ElementAt,
ElementAtOrDefault, Last, and LastOrDefault.
String Methods
Many of the .NET String type methods are supported in LINQ
to SQL because there is a corresponding method in T-SQL.
However, there is no support for methods that are
cultureaware (those that receive arguments of type
CultureInfo, StringComparison, and IFormatProvider) and for
methods that receive or return a char array.
DateTime Methods
There are differences between the DateTime type in .NET and
the DATETIME and SMALLDATETIME types in SQL Server. The
range of values and the precision is greater in .NET than in
SQL Server, allowing for a correct representation of SQL
Server types in .NET, but not the opposite. Moreover,
DATETIME in SQL Server does not have the notion of a time
zone, thus it cannot be supported by LINQ to SQL. Finally,
some .NET DateTime methods are not supported, mainly because
of the lack of a corresponding function in T-SQL.
Unsupported SQL Functionalities
LINQ to SQL does not have syntax to make use of the SQL LIKE
operator and STDDEV aggregation.
——-
Querying a DataTable with LINQ
Field<t>
You can use the Field<T> accessor method instead of using a
direct cast on the result of the standard DataRow accessor
(such as o["OrderDate"]). The query shown in Listing 7-6
gets the orders that show a date of 1998 or later.
Listing 7-6: Querying a DataTable with LINQ
DataSet ds = LoadDataSetUsingDataAdapter();
DataTable orders = ds.Tables["Orders"];
var query =
from o in orders.AsEnumerable()
where o.Field<DateTime>(“OrderDate”).Year >= 1998
orderby o.Field<DateTime>(“OrderDate”) descending
select o;
———-
A DataView can also be created from a LINQ query on a
DataTable by using the AsDataView extension method
——-
var order = oldCustomer.Orders.Single( o => o.OrderID ==
10248 );
————
Tools of LINQ: SQLMetal.exe
————–
1. CRUD and CUD Operations
The term CRUD means Create, Read, Update, and Delete. These
are the fundamental operations provided by a storage system,
and they correspond to the SQL statements INSERT, SELECT,
UPDATE, and DELETE, respectively. Using LINQ to SQL, read
operations are typically performed in an indirect way, by
executing LINQ queries or by accessing LINQ entities through
their relationships without a direct call of the SELECT SQL
statement. For this reason, in LINQ to SQL documentation you
will find another acronym
2,changeSet.Updates
changeSet.Deletes
changeSet.Inserts
public static void DumpChanges(ChangeSet changeSet) {
if (changeSet.Deletes.Count > 0) {
Console.WriteLine(“** DELETES **”);
foreach (var del in changeSet.Deletes){
Console.WriteLine(Dump(del));
}
}
if (changeSet.Updates.Count > 0) {
Console.WriteLine(“** UPDATES **”);
foreach (var upd in changeSet.Updates){
Console.WriteLine(Dump(upd));
}
}
if (changeSet.Inserts.Count > 0) {
Console.WriteLine(“** INSERTS **”);
foreach (var ins in changeSet.Inserts){
Console.WriteLine(Dump(ins));
}
}
Console.WriteLine(changeSet);
}
public static string Dump(this object data) {
if (data is Customer) {
Customer customer = (Customer) data;
return String.Format(
“CustomerID={0}, CompanyName={1}”,
customer.CustomerID, customer.CompanyName);
}
else {
throw new NotSupportedException(
String.Format(
“Dump is not supported on {0}”,
data.GetType().FullName));
}
}
3.
InsertOnSubmit
DeleteOnSubmit
var newCustomer = new Customer {
CustomerID = “DLEAP”,
CompanyName = “DevLeap”,
Country = “Italy” };
db.Customers.InsertOnSubmit(newCustomer);
var oldDetail = db.Order_Details.Single(
od => od.OrderID == 10422
&& od.ProductID == 26);
db.Order_Details.DeleteOnSubmit(oldDetail);
4.
Cascading Deletes and Updates
if you need to remove a row, you always have to do this in a
direct way, calling the DeleteOnSubmit method on the
corresponding Table collection. When you remove an object,
you need to be sure that there are no more entities
referencing it; otherwise, an exception will be thrown when
SubmitChanges is called, because the SQL DELETE statement
will violate some referential integrity constraint (such as
FOREIGN KEY being declared in the database). You can unbind
related entities by setting their foreign key to NULL, but
this might throw an exception if constraints do not allow
NULL values. Another option is to remove the child objects
from an object you want to remove by calling the
DeleteOnSubmit method on them. You can do that by leveraging
the DeleteAllOnSubmit method:
var order = db.Orders.Single(o => o.OrderID == 10248);
db.Orders.DeleteOnSubmit(order);
db.Order_Details.DeleteAllOnSubmit(order.Order_Details);
b.
Another cascading operation that is possible on a relational
database is the cascading update. For example, changing the
primary key of a Customer changes all the foreign keys in
related entities referring to that Customer. However, LINQ
to SQL does not allow changing the primary key of an entity.
You need to create a new Customer, change the references
from the old Customer to the new one, and finally remove the
old Customer. This operation is shown in Listing 5-2.
Listing 5-2: Replace a Customer on existing orders
var oldCustomer = db.Customers.Single(c => c.CustomerID ==
“FRANS”);
Customer newCustomer = new Customer();
newCustomer.CustomerID = “CHNGE”;
newCustomer.Address = oldCustomer.Address;
newCustomer.City = oldCustomer.City;
newCustomer.CompanyName = oldCustomer.CompanyName;
newCustomer.ContactName = oldCustomer.ContactName;
newCustomer.ContactTitle = oldCustomer.ContactTitle;
newCustomer.Country = oldCustomer.Country;
newCustomer.Fax = oldCustomer.Fax;
newCustomer.Orders = oldCustomer.Orders;
newCustomer.Phone = oldCustomer.Phone;
newCustomer.PostalCode = oldCustomer.PostalCode;
newCustomer.Region = oldCustomer.Region;
10.
Entity States
Untracked This is not a true state. It identifies an object
that is not tracked by LINQ to SQL. A newly created object
is always in this state until it is not attached to a
DataContext. Because this state is the relationship of an
entity in a given DataContext, an entity created as a result
of a query of a DataContext instance is Untracked by other
DataContext instances. Finally, after deserialization, an
entity instance is always Untracked.
Unchanged The initial state of an object retrieved by using
the current DataContext.
PossiblyModified An object attached to a DataContext. In
Figure 5-1, the two states Unchanged and PossiblyModified
are represented by the same box (state).
ToBeInserted An object not retrieved by using the current
DataContext. This is a newly created object that has been
added with an InsertOnSubmit to a Table<T> collection, or
that has been added to an EntitySet<T> of an existing entity
instance.
ToBeUpdated An object that has been modified since it was
retrieved. This state is set by a change to any property of
an entity retrieved by using the current DataContext.
ToBeDeleted An object marked for deletion by calling
DeleteOnSubmit.
Deleted An object that has been deleted in the database. The
entity instance for this object still exists in memory with
this particular state. If you want to use the same primary
key of a Deleted entity, you need to define a new entity in
a different DataContext.
12.Entity Synchronization
After you write an entity to the database by calling
SubmitChanges, it is possible that changes are made directly
on the database to some column of the table. Identities,
triggers, and time stamps are all cases in which the actual
value written on the database cannot be known in advance by
the entity itself and needs to be read from the database
after the SubmitChanges call. If you use an entity after the
call to SubmitChanges, you probably need to update these
values by reading the entity from the database. LINQ to SQL
helps automate this process by providing the AutoSync
parameter to the Column attribute that decorates entity
properties. For each column, this parameter can have one of
the following values provided by the
System.Data.Linq.Mapping.AutoSync enumeration:
Default There is an automatic handling of the entity update,
based on known metadata of the column itself. For example,
an IsDbGenerated column will be read after an Insert
operation, and an IsVersion column will be updated after any
Update or Insert operation.
Always The column is always updated from the database after
any SubmitChanges call.
Never The column is never updated from the database.
OnInsert The column is updated from the database after the
SubmitChanges call that inserts the entity.
OnUpdate The column is updated from the database after the
SubmitChanges call that updates the entity.
——-
Generating a DBML File from a Database
To generate a DBML file, you need to specify the /dbml
option, followed by the filename to create. The syntax to
specify the database to use depends on the type of the
database. For example, a standard SQL Server database can be
specified with the /server and /database options:
sqlmetal /server:localhost /database:Northwind
/dbml:northwind.dbml
Windows authentication is used by default. If you want to
use SQL Server authentication, you can use the /user and
/password options. Alternatively, you can use the /conn
option, which cannot be used with /server, /database, /user,
or /password. The following command line that uses /conn is
equivalent to the previous one, which used /server and
/database:
sqlmetal
/conn:”Server=localhost;Database=Northwind;Integrated
Security=yes”
/dbml:northwind.dbml
If you have the Northwind MDF file in the current directory
and are using SQL Server Express, the same result can be
obtained by using the following line, which makes use of the
input file parameter:
sqlmetal /dbml:northwind.dbml Northwnd.mdf
Similarly, an SDF file handled by SQL Server Compact 3.5 can
be specified as in the following line:
sqlmetal /dbml:northwind.dbml Northwind.sdf
By default, only tables are extracted from a database. You
can also extract views, user-defined functions, and stored
procedures by using /views, /functions, and /sprocs,
respectively, as shown here:
sqlmetal /server:localhost /database:Northwind /views
/functions /sprocs
/dbml:northwind.dbml
Note Remember that database views are treated like tables
by LINQ to SQL.
Generating Source Code and a Mapping File from a Database
To generate an entity’s source code, you need to specify the
/code option, followed by the filename to create. The
language is inferred by the filename extension, using CS for
C# and VB for Visual Basic. However, you can explicitly
specify a language by using /language:csharp or /language:vb
to get C# or Visual Basic code, respectively. The syntax to
specify the database to use depends on the type of the
database. A description of this syntax can be found in the
preceding section, “Generating a DBML File from a Database.”
For example, the following line generates C# source code for
entities extracted from the Northwind database:
sqlmetal /server:localhost /database:Northwind
/code:Northwind.cs
If you want all the tables and the views in Visual Basic,
you can use the following command line:
sqlmetal /server:localhost /database:Northwind /views
/code:Northwind.vb
Optionally, you can add the generation of an XML mapping
file by using the /map option, as in the following command
line:
sqlmetal /server:localhost /database:Northwind
/code:Northwind.cs /map:Northwind.xml
Important When the XML mapping file is requested, the
generated source code does not contain any attribute-based
mapping.
There are a few options to control how the entity classes
are generated. The /namespace option controls the namespace
of the generated code. (By default, there is no namespace.)
The /context option specifies the name of the class
inherited from DataContext that will be generated. (By
default, it is derived from the database name.) The
/entitybase option allows you to define the base class of
the generated entity classes. (By default, there is no base
class.) For example, the following command line generates
all the entities in a LinqBook namespace, deriving them from
the DevLeap.LinqBase base class:
sqlmetal /server:localhost /database:Northwind
/namespace:LinqBook
/entitybase:DevLeap.LinqBase /code:Northwind.cs
Note If you specify a base class, you have to be sure that
the class exists when the generated source code is compiled.
It is a good practice to specify the full name of the base
class.
If you want to generate serializable classes, you can
specify /serialization:unidirectional in the command line,
as in the following example:
sqlmetal /server:localhost /database:Northwind
/serialization:unidirectional
/code:Northwind.cs
———————————-
Sharepoint Interview Questions 3
November 16, 20096. What are event hanlders in Sharepoint
Ans: Synchronous (ing) and Asynchronous (ed) doubt
7.In Sp what are event receivers?
Ans: SPList and SpItem.
What is their base class?
Ans: SpReceiverBase
8. Security Permissions in SP?
Ans: Contributor
Reader
Full Control
9. What are content types?
In Document Library we have Add Columns , Multi Columns
Ans: check this box “Calculated Fields” .. I= PNR/100
10. You created Doc Library Templates and HR created another library,Different people in organisation created different documents.
One should not view documents created by others. How to achieve this in Sharepoint?
Ans: Sharepoint Service Provider -> Audience And Targetting
11. What is the use of BDC ?
12. Are you using any tools for BDC? How to configure?
13. You want to get Top 5 records from a database and to display in a webpart. What is the out of box feature available in Sharepoint?
Ans: Use content query webpart.
It expects database connection and asks for a select query.
There write like this: select top 5 …
14. Infopath and Excel Services
15. Out of Box different workflow types?
Ans: Sequential
State
Steps : Initialize
Modify
Associate
16.What are the steps in creating a custom them?
Ans: hive/templates/themes
2 ways: 1. Theme gallery
2. In visual studio how u will or SPDesigner
Site.ApplyThemes
17. Namespace for webpart
18. UpdateChanges()
19.
| Document Library | Form Library |
| excel ,ppt and word | ms office + Infopath form + xml files |
| + flat files.(This is one of advantages in SPp 2007) |
20. What is in SP collaboration portal ?
a. What is Publish , Unpublish , Report Center and Search Center.
b. Team Site
21. Different between 2007 and 2010?
22. STSADM tool is SP Administration. How to create a batch file?
23. What is Server Farm?
WebFront End Server , Application Server
Microsoft Capacity Planner, SqlServer
24. Performance Tools in SP
a. Search Tools
b. How to do crawling in content management
25. Sp + Silverlight
26. Difference WSS 3.0 and SP 2007
27. Difference Site Collection and Sites
28. Backup Restore tools
29. Webpart tools (See: Litware site)
30. How many Shared Providers can be created?
Ans: No Limit
31. Form Authentication
Ans:Create SqlProvider .Use SQLRegIIS.exe
32. Single Sign On
33. Any difference in time between SPTime and Sqlserver?
Ans: Yes
34. Write CAML sample query
Sharepoint Interview Questions 2
November 13, 2009
1. What are the new features provided in Sharepoint 2007?
2. What are the features of Sharepoint Service Provider ?
Sharepoint Interview Questions Topics I
November 11, 20091. Difference between WSS & MOSS
2. Webparts and Deployment
3. Difference between Document Library and Picture Library
4. Event Handlers : What is the base Class?
Ans : SPEventReceiverBase
5. Content Type
6. Site Templates
For resuability it is used.
7.How to display a pdf icon when it is uploaded into Document Library?
Ans : Use IFilter of Pdf
8. SP object model
9. Features
10. workflows (out of the box and custom workflows)
11. Deployment of Workflows using WSP, Cab?
Tools to remember:
——————-
1. WSPBuilder (codeplex)
2. BDC Metaman (U2Usite)
3.CAMLQuery Builder(U2U site)
4. Stramit Query Viewer (http://www.codeplex.com/SPCamlViewer)
5. SonofSmartPart webpart
Interview Questions Part 4 – Answers
November 5, 2009
TCS Mumbai
—————-
Locks
Concurrency
Error handling in Sql server
@@Rowcount , @@Error
Error handling in .Net Ans: try catch block can be used
How to pass parameters in stored procedures
IN , OUT parameters
Passing Input and output parameters to SP:
create procedure sproc_employees
(
@a1 int,
@a1 int out
)
as
begin
set @a1 =(select count(*) from employees_u where employeeID<@a1)
return @a1
end
Declare @op int
EXEC sproc_employees 5,@op OUT
PRINT @op
create proc sp_nam( @a1 IN, @a1 OUT)
Can we used the same parameter name as input and output.?
Ans: No,we cannot give same parameter as input and output,it will throw error- “Variable names must be unique within a query batch or stored procedure”
Using the same parameter as input and output:
CREATE PROCEDURE [dbo].[SP_GetEmpDetails]
(
@name varchar(50) output,
@Empsalary varchar(50) output
)
as
BEGIN
set @name =(select EmployeeID from employees_u where LastName=@name)
set @Empsalary =(select Title from employees_u where EmployeeID=@name)
select @name,@Empsalary
End
Declare @op int
EXEC SP_GetEmpDetails ‘usha’,@op OUT
Here the first paramter is used as both input and output parameter.
Can we configure the Server of our application with 2 different versions of
Asp.net
What is Polymorphism?
In function overloading can we write as below:
i. functionname(int a1)
samefunctionname(float a1)
ii. function(int a1)
samefunction(int a1,int b1)
Can we remove global.asax file from our application? Ans: When we create a new web application global.asax file is not added automatically so even if the file is not there the application works fairly well.we can add the file explicitly.
What is the use of global.asax file http://msdn.microsoft.com/en-us/library/1xaas8a2(VS.71).aspx Ans:The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HttpModules. The Global.asax file resides in the root directory of an ASP.NET-based application.The Global.asax file is optional. If you do not define the file, the ASP.NET page framework assumes that you have not defined any application or session event handlers.
What are the events in global.asax file Ans: http://www.dotnetcurry.com/ShowArticle.aspx?ID=126&AspxAutoDetectCookieSupport=1#
The Global.asax, also known as the ASP.NET application file, is located in the root directory of an ASP.NET application. This file contains code that is executed in response to application-level and session-level events raised by ASP.NET or by HTTP modules. You can also define ‘objects’ with application-wide or session-wide scope in the Global.asax file. These events and objects declared in the Global.asax are applied to all resources in that web application.
Methods corresponding to events that fire on each request
Application_BeginRequest() – fired when a request for the web application comes in.
Application_AuthenticateRequest –fired just before the user credentials are authenticated. You can specify your own authentication logic over here.
Application_AuthorizeRequest() – fired on successful authentication of user’s credentials. You can use this method to give authorization rights to user.
Application_ResolveRequestCache() – fired on successful completion of an authorization request.
Application_AcquireRequestState() – fired just before the session state is retrieved for the current request.
Application_PreRequestHandlerExecute() – fired before the page framework begins before executing an event handler to handle the request.
Application_PostRequestHandlerExecute() – fired after HTTP handler has executed the request.
Application_ReleaseRequestState() – fired before current state data kept in the session collection is serialized.
Application_UpdateRequestCache() – fired before information is added to output cache of the page.
Application_EndRequest() – fired at the end of each request
Methods corresponding to events that do not fire on each request
Application_Start() – fired when the first resource is requested from the web server and the web application starts.
Session_Start() – fired when session starts on each new user requesting a page.
Application_Error() – fired when an error occurs.
Session_End() – fired when the session of a user ends.
Application_End() – fired when the web application ends.
Application_Disposed() – fired when the web application is destroyed.
Can we have more than 2 machine.config files in IIS servers?
Ans: 2 machine.config files can be present in a machine ,machine.config files will be located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG and it depends on the numver of .NET framework versions installed in the machine.
Can we install 2 IIS versions in one system?
what is the use of web.config and machine.config files? What is the difference between these 2 files?
What is the difference between HTML server control and Web Server control?
Say something about Datagrid? What is the use of Bound Columns? We gave AutoGenerateColumns = True and we have 3 BoundColumns out of 5 columns. How many columns are displayed in the grid? Ans: 5
What is the use of autogenerate columns? Ans: If the DataGrid control’s AutoGenerateColumn property is set to true, the control will generate and display a bound column for each bindable column in the data source, the column names in the grid can be specified explicitly by setting it to false
Which one is better DataReader/DataSet in terms of performance? Ans:http://www.dotnetfunda.com/articles/article74.aspx We should use a DataSet populated by SqlDataAdapter when
1. We require a disconnected memory-resident cache of data so that we can pass to different component or layers
2. We are working wtih data retrived from multiple data sources.
3. We want to update some of all retrieved rows using batch updated provided by SqlDataAdapter
4. We want to perform data binding against a control that requires a data source that spport IList such as GridView, Repeater etc.
We should use SqlDataReader by calling ExecuteReader method of SqlCommand object when
1. We are dealing with large volumes of data – too much to maintain in single cache.
2. We want to reduce the memory occupied by the application (using DataSet consumes memory)
3. We want to perform data binding with a control that supports a data source that implements IEnumerable
Can we pass null values to stored procedures?
Difference b/w Order BY and GROUP BY in SQL? Ans: Groupby: It is a way to sub-total your results,or perform some other ‘aggregate’ functions on them.
Orderby: It is a simply a way to sort your results. It doesn’t affect what shows up in your result set,only what order it is displayed. http://stackoverflow.com/questions/1277460/what-is-the-difference-between-group-by-and-order-by-in-sql
How to submit one page information to another? Which methods are used? Ans: POST and GET
POST : Request.Form
GET : Request.QueryString
If we are using Request then what is the default method it takes?
Ans : QueryString (doubt) .Default Method of form is GET
Difference b/w Response.Redirect and Server.Transfer?
Ans:http://www.dotnetspider.com/resources/30822-Server-Transfer-Server-Execute.aspx
http://www.dotnetspider.com/forum/ViewForum.aspx?ForumId=21599
Server.Transfer processes the page from one page directly to the next page without making a round-trip back to the client’s browser. This way is faster, with a little less overhead on the server. However, it does NOT update the clients url history list or current url.
Response.Redirect, as expected, is used to redirect the user’s browser to another page or site. It DOES perform a trip back to the client where the client’s browser is actually redirected to the new page. The browser history list is updated to reflect the new address.
Can we connect 2 different databases of Sqlserver to our application? How to connect?
Can we connect oracle and sqlserver at the same time?
In web.config <errors mode=Debug ,none,remote
In web.config <trace mode = verbose, none
In web.config <sessionstate mode=sqlserver , stateserver inproc,outproc,stateserver
How to debug javascript function in frontend? Ans: IE -> Tools -> Internet Options-> Advanced ->Uncheck “Disable Script Debugging (IE)” and “Disable Script Debugging (others)”.
<Compilation debug = true / false > ie Debug and Release.
In terms of performance which one is better? Ans: In the application itself we have bin folder. In Debug mode dll size is more and release mode dll is small.
Use Release mode in production as it removes breakpoints and dll size is less.
What is viewstate?
Can we write nested try catch blocks?
we can write n number of catch blocks for a single try block. If errors occurs
only the related catch executes.
Can we compare two dates in Asp.net? How? Which control to use? Eg: RegularExpression validator. Don’t use Comparevalidator control (it is for string,int)
Repeater control
What do you know XML?
Diff b/w custom controls and user controls
Diff b/w Stored Procedure and function
select * from functionname …….. Can we write like this if the function is returning some table. Ans : Yes .
What are table valued, scalar valued functions.. Diff functions in Sqlserver
How do u execute Scalar Valued and table Valued functions in Sqlserver
Ans : select * from fucntionname …. (Table Valued function .. It returns table)
Exec function functionname .. (Scalar valued function .. It returns single value)
Gujarat Ahmedabad company
1. How to provide pagination in Datagrid? Ans: AllowPaging = true ..Event(PageIndexChanging) to be written in codebehind.
2. DBCC commands
3. Viewstate . How they implemented ? Ans : Hidden value
It is specific to the page
What is the difference between ViewState and Hidden Values.
4. Sql Profiler
5. What are views? Security
Read Only Views
If we change any value in view will it effect the backend table?
6. What are Cursors? Types of Cursors?
7. What is Stored Procedure? Give an example?
8. How to submit one page information to another?
Session , Cache, QueryString, Cross Page post back
Get Post
9. What are directives in Asp.net? Different directives?
10. Difference b/w Response.Redirect/ Server.Execute and Server.Transfer?
11. What are joins? Types of Joins?
12. Does C# supports multiple inheritance?
13. What is an interface?
14. Difference b/w interface and abstract class?
15. What is a webservice?
16. What is the formatting protocol used in Webservices ? Ans: SOAP
17. Which one of the following is used in Webservices – DataReader / DataSet/DataList Ans: DataSet
18. What is the difference b/w function overloading/ overriding?
19. What is the difference b/w system.string and system.stringbuilder
Mutable .. immutable
20. Difference b/w System.Int32 and int?
21. Difference b/w String and string
22. C# access modifiers
23. What is normalization ? Different types of normalizations ? Give examples?
24. What is Denormalization? Why and when to denormalize?
25. Dotnet features?
26. Dotnet assemblies and types of assemblies
27. What is the transmission protocol used in webservices ? Ans: HTTP
28. What are the differences b/w ASP and ASP.Net?
29. What is ADO.NET
30. How many languages supports .Net?
INDPRO (9/9/2006)
1. What are SqlCommand objects methods? What is the difference b/w ExecuteNonQuery and ExecuteScalar?
2. What is the diff b/w DataRepeater and DataList?
3. What is the diff b/w Container.DataBind , Eval, Bind
Ans: Eval for formatting the data like date format
Bind directly binds and displays the db data as it is.
4. What is the diff b/w Array and ArrayList
5. Difference b/w Hash Table and ArrayList
6. What are Enumerations , Collections
7. For raising an event of a control (which is present in usercontrol) where to write the code ( In usercontrol or webform)
8. Page Life Cycle Events
9. Mention Application and Sessions events of Global.asax
10. When viewstate is loaded in Page Life Cycle (Is it Init or Page Load)
11. Template column in DataGrid? How hyperlink is used in Asp.net datagrid?
12. What is the use of webserver controls
13. Page Directives
1. Diff b/w interface and Abstract class
2. What is viewstate and where it is stored
3. Purpose of FXCOP
4. What is unmanaged code? How CLR executes Unmanaged code
5. Write a SP that returns the largest of two numbers
EMids Technologies Pvt Ltd
1. In FXCOP can we define our own custom rules? How ?
2. Diff b/w Sqlserver 2000 and 2005
3. Equals method comes under {String} class
Tostring, Equals,GetHashCode , GetType .. default methods of an Object
4. What is the default base class for all classes Ans: System.Object
5. Base class for Asp.net pages
6. Base class for Windows Forms
7. What is the diff b/w Class and object? Real world example?
8. Diff b/w HTML Server control and Web server control? What is the base class for these two controls? Can we convert HTML server control to webserver control?
9. How to call javascript function? Where we will write the code for calling the function
10. There is an Employee table. What are the steps involved in populating the datagrid with this table
Employee IDs from 1 to 5000 are there. Without changing the query in the above example fill the datagrid with values Empid < 100
Ans: Use Dataview for filtering the records in dataset
11. Diff b/w Stored Procedure and function
12. What are the parameters of SP ? What is the default parameter in SP. Ans: In,Out, INOUT and default is IN
13. Two textboxes and submit button is there. Which validation control in Asp.net to be used to validate those textboxes. What are the properties to be set in validation controls? Ans: ControlToValidate and ErrorMessage
Without using validation controls how to validate the above things.Any properties are there.? How to validate controls through coding
FCG (5/12/2006)
1. Diff b/w Interface and Abstract class? When to use these ?
2. What is an Assembly
3. Diff b/w custom and user controls
4. Diff b/w DataSet and DataReader
5. Diff b/w DataSet and DataTable
6. Diff b/w Overloading and Overriding with example codes
7. What is runtime polymorphism and compile time polymorphism
8. What is Static Binding, Dynamic Binding
9. What is Late and Early Binding
10. What are the different ways of using NEW operator
11. What is AS,IS in C#
Ans: AS is for type casting
IS is for comparing objects
12. What are Transactions in Sqlserver and in ADO.Net
13. What are ACID properties?
14. What are LOCKS. Diff Locks
15. Concurrency
16. Isolation levels
17. Diff b/w Convert.ToString() and ToString()
18. diff b/w ParseInt and int.Parse() and what is IsParseInt
19. If two developers are updating data into the same dataset then how the dataset will update the data
20. What is Biztalk Orchestration?
21. How to use the webservice to get the document from Document Library in SharePoint
22. Want to give some permissions to the documents in the document library so that users can see only particular documents. How to achieve this?
23. What is base class for ASP.Net Page ? Ans: System.Web.UI.Page
24. System.Object – > a. GetType
b. GetHashCode
c. ToString
d. Equals
25. Types of Polymorphism?
26. Types of Caching and with example code
27. Session Management
28. What are the conditions to use INPROC/OutProc
InProc …. When we want to work with only one webserver
OutProc…. When we have multiple webservers
29. NUNIT, FXCOP . Write unit test cases in NUNIT
30. C# access specifiers. What is default Access Specifier Ans: Public
31. Diff b/w internal and Protected Internal
32. What are Out and Ref parameters in C#
For out no need to initialize , Ref needs initialization
33. What is Call By Value and Call By Reference
34. Specify default base classes for following controls
Control Name
Base Class
WebControls
System.Web.UI.WebControls
HTML Controls
System.Web.UI.HTMLControls
Class
System.object
Form
System.Windows.Form
Asp.Net page
System.Web.UI.Page
Asp.Net WebPart
System.Web.UI.WebControls.WebPart
35. What is Implicit Type Conversion
Ans: Converts smaller datatype to higher datatype
36. What is Garbage Collection
In C# explain
What are the namespaces
GC.Collect
Different Periods in GC
37. How to use these tools
NCOVER – Code Coverage
NUNIT – Unit Testing tool
FXCOP – Code Analysis Tool
NTYPE
NDOC
NANT – deployment scripting tool
IBS(24/12/2006)
1. What is the use of FileUpload Control? Default file size: 4 MB.Cane we increase the default file size?
Ans: Yes by using MaxRequestLimit
2. What is transaction? Ans: Process following ACID rules
3. When to use interface?Can we overwrite virtual functions? How multiple inheritance is possible in C#?
4. function overloading is early binding,function overriding is late binding
5. Diff b/w XML Serialization & binary serialization.
Ans: XML Serialization – Webservices
SOAP Serialization for Remoting
6. How to refresh an aspx page automatically. Ans : by using meta tag
7. Is clustered index created automatically? Ans: when we are create primary key on a table.
8. Diff b/w dispose and finalize?
9. Diff b/w Web services and Remoting
10. what is a delegate? what are event delegates?
11. How to avoid SQL Injection?
US Technologies
1. Diff b/w interface and abstract class? Can we create an instance for abstract class?
Ans: http://geekswithblogs.net/mahesh/archive/2006/07/05/84120.aspx
When to use: In short,
We can go with a normal class when the class contains the core business logic,if not we can use either abstract class or interface.
If the base class have some default behavior which applies to all its derived classes the abstract class is to be used.
If there is no default behavior and every derived has its own implementation then interface is better.
Some more extra points not covered in the above article:
In case of interface to implement the methods we use ‘override’key word, But in case of abstract class we use’ virtual’ keyword.
A class may implement several interfaces but A class may extend only one abstract class.
2. How to create a web part and how to place the web part in Share point portal?
3. How to GAC the dll? What happens when we GAC a DLL? Where the DLL is stored?
4. What is the use of stored procedure? What happens when a SP is compiled?
5. Types of Joins.
Ans: Inner Join, Left Outer Join, Right Outer Join, full join Cross Join, Self Join.
6. Use of Createchildcontrols and RenderContents methods of web part creation
7. Bubbling Events:
Event bubbling is used by the data-bound controls (Repeater, DataList, and DataGrid)
8. What is the namespace that is used for sending email?
Ans: System.Net.Mail
9. How to use user controls in web.config
<pages>
<controls>
<add tagPrefix=”scottgu” src=”~/Controls/Header.ascx” tagName=”header”/>
<add tagPrefix=”scottgu” src=”~/Controls/Footer.ascx” tagName=”footer”/>
<add tagPrefix=”ControlVendor” assembly=”ControlVendorAssembly”/>
</controls>
</pages>
we can use custom controls as well in web.config file
Posted by ambatisreedhar