Sunteți pe pagina 1din 9

1) What are the two base classes a WebPart you are going to use within SharePoint 2007 can

inherit from? There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the SharePoint WebPart Base class or the ASP.NET 2. WebPart base class. When inheriting from the SharePoint WebPart Base class your deri!ed WebPart class will inherit from "icrosoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2. WebPart base class your deri!ed WebPart class will inherit from System.Web.#$.Web%ontrols.WebParts.WebPart. $t is considered good &ractice to use the ASP.NET WebPart base class since the old base class is meant for bac'wards com&atibility with &re!ious !ersion of SharePoint, howe!er there are four e(ce&tion when it is better to le!erage functionality from the SharePoint WebPart base class) %ross &age connections %onnections between Web Parts that are outside of a Web Part *one %lient+side connections ,Web Part Page Ser!ices %om&onent.ata caching infrastructure 2) What are the differences between the two base classes and what are the inherit benefits of using one over another? The difference is the "icrosoft.SharePoint.WebPartPages.WebPart base class is meant for bac'ward com&atibility with &re!ious !ersions of SharePoint. The benefit of using the SharePoint WebPart base class is it su&&orted) %ross &age connections %onnections between Web Parts that are outside of a Web Part *one %lient+side connections ,Web Part Page Ser!ices %om&onent.ata caching infrastructure ASP.NET 2. WebParts are generally considered better to use because SharePoint is built u&on the ASP.NET 2. web architecture. $nheriting from the ASP.NET 2. base class offers you features that inherit to ASP.NET 2. , such as embedding resources as o&&osed to use %lass/esources for de&loyment of said ty&es. 3) What is the !"? The 0A% stands for the global assembly cache. $t is the machine wide code cache which will gi!e custom binaries &lace into the full trust code grou& for SharePoint. %ertain SharePoint assets, such as 1eature /ecei!ers need full trust to run correctly, and therefore are &ut into the 0A%. 2ou should always try to a!oid de&loyment to the 0A% as much as &ossible since it will &ossibly allow de!elo&ment code to do more than it was intended to do. #) What is strong naming $signing) a WebPart assembly file mean? Signing an assembly with a strong name ,a.'.a strong naming- uses a cry&togra&hic 'ey &air that gi!es a uni3ue identity to a com&onent that is being built. This identity can then be referred throughout the rest of the en!ironment. $n order to install assemblies into the 0A%, they must be strongly named. After signing, the binary will ha!e a &ublic 'ey to'en identifier which can be use to register the com&onent in !arious other &laces on the ser!er.

%) What are safe controls& and what ty'e of information& is 'laced in that element in a SharePoint web(config file? When you de&loy a WebPart to SharePoint, you must first ma'e it as a safe control to use within SharePoint in the web.config file. Entries made in the safe controls element of SharePoint are encountered by the SharePoint4andler ob5ect and will be loaded in the SharePoint en!ironment &ro&erly, those not will not be loaded and will throw an error. $n the generic safe control entry ,this is general, there could be more-, there is generally the Assembly name, the names&ace, the &ublic 'ey to'en numeric, the ty&ename, and the safe declaration ,whether it is safe or not-. There are other o&tional elements. )) What is the "reate"hild"ontrols$) method? *ow can you use it to do something sim'le li+e dis'laying a ,abel control? The %reate%hild%ontrols method in WebParts is used to notify the WebPart that there are children controls that should be out&ut for rendering. Basically, it will add any child ASP.NET controls that are called instantiating each control with its rele!ant &ro&erties set, wire any rele!ant e!ent handlers to the control, etc. Then the add method of the control class will add the control to the controls collection. $n the rele!ant WebPart render method, the Ensure%hild%ontrols method can be called ,or set to false if no child controls should be calledto ensure that the %reate%hild%ontrols method is run. When using %reate%hild%ontrols it im&lies that your WebPart contains a com&osition of child controls. $n order to create something li'e a label control in %reate, you would create a new label control using the new 'eyword, set the !arious &ro&erties of the control li'e 6isible7True and 1ore%olor 7 %olor./ed, and then use %ontrols.Add,my8abel%ontrol- to add the control to the controls collection. Then you can declare Ensure%hild%ontrols in the /ender method of the WebPart. 7) What does the -ender"ontents method do in an !SP(./0 2(0 WebPart? The render contents method will render the WebPart content to the writer, usually an 4tmlTe(tWriter since WebParts will out&ut to an 4T"8 stream. /ender%ontents is used to tell how the controls that are going to be dis&layed in the WebPart should be rendered on the &age. 111 Side 2uestion3 $ got as'ed what the difference between %reate%hild%ontrols and the /ender%ontents method. The %reate%hild%ontrols method is used to add controls to the WebPart, and the /ender%ontents method is used to tell the &age framewor' how to render the control into 4T"8 to dis&lay on a &age. 4) What is the WebPart5anager sealed class? What is its 'ur'ose? The WebPart"anager sealed class is res&onsible for managing e!erything occurring on a WebPart &age, such as the WebParts ,controls-, e!ents, and misc. functionality that will occur in WebPart9ones. 1or e(am&le, the WebPart"anager is res&onsible for the functionality that is &ro!ided when you are wor'ing with mo!ing a WebPart from WebPart9one to WebPart9one. $t is 'nown as the :the central class of the Web Part %ontrol Set.; 111 Side 2uestion3 $ got as'ed how many WebPart"anager controls should be on a &age. $n order to ha!e WebParts on a &age there has to be 5ust one WebPart"anager control to manage all the WebParts on the &age.

6) What is a SPSite and SPWeb ob7ect& and what is the difference between each of the ob7ects? The SPSite ob5ect re&resents a collection of sites ,site collection <a to& le!el sites and all its subsites=-. The SPWeb ob5ect re&resents an instance SharePoint Web, and SPWeb ob5ect contains things li'e the actual content. A SPSite ob5ect contains the !arious subsites and the information regarding them. 10) *ow would you go about getting a reference to a site? %>) oSPSite 7 new SPSite,?htt&)@ser!er?-A oSPWeb 7 oSPSite.B&enWeb,-A 11) What does a SPWeb!''lication ob7ect re'resent? The SPWebA&&lication ob5ects re&resents a SharePoint Web A&&lication, which essentially is an $$S !irtual ser!er. #sing the class you can instigate high le!el o&erations, such as getting all the features of an entire Web A&&lication instance, or doing high le!el creation o&erations li'e creating new Web A&&lications through code. 12) Would you use SPWeb!''lication to get information li+e the S50P address of the SharePoint site? 2es, since this is a Web A&&lication le!el setting. 2ou would iterate through each SPWebA&&lication in the SPWebA&&lication collection, and then use the a&&ro&riate &ro&erty calls ,Butbound"ailSer!ice$nstance- in order to return settings regarding the mail ser!ice such as the S"TP address. Side 2uestion3 $ got as'ed if there are other ways to send emails from SharePoint. The answer is yes, there is. 2ou can use the Send"ail method from the SPutility class to send sim&le emails, howe!er it is not as robust as using the System.Net."ail functionality since it doesnCt allow things li'e setting &riorities on the email. 13) *ow do you connect $reference) to a SharePoint list& and how do you insert a new ,ist 8tem? %>) using,SPSite mySite 7 new SPSite,?yourser!er?-D using,SPWeb myWeb 7 mySite.B&enWeb,-D SP8ist inter!iew8ist 7 myWeb.8ists<?listtoinsert?=A SP8ist$tem new$tem 7 inter!iew8ist.$tems.Add,-A new$tem<?inter!iew?= 7 ?inter!iew?A new$tem.#&date,-A E E

1#) *ow would you loo' using SP,ist through all SharePont ,ist items& assuming you +now the name $in a string value) of the list you want to iterate through& and already have all the site code written? %>) SP8ist inter!iew8ist 7 myWeb.8ists<?listtoiterate?=A foreach ,SP8ist$tem inter!iew in inter!iew8istD @@ .o Something E 1%) *ow do you return SharePoint ,ist items using SharePoint web services? $n order to retrie!e list items from a SharePoint list through Web Ser!ices, you should use the lists.asm( web ser!ice by establishing a web reference in 6isual Studio. The lists.asm( e(&oses the 0et8ist$tems method, which will allow the return of the full content of the list in an F"8 node. $t will ta'e &arameters li'e the 0#$. of the name of the list you are 3uerying against, the 0#$. of the !iew you are going to 3uery, etc. Side Guestion) $ got as'ed how $ built 3ueries with the lists.asm( web ser!ice. $n order to build 3ueries with this ser!ice, one of the &arameters that the 0et8ist$tems method e(&oses is the o&tion to build a %A"8 3uery. There are other ways to do this as well, but that was how $ answered it. 1)) When retrieving ,ist items using SharePoint Web Services& how do you s'ecify e9'licit credentials to be 'assed to access the list items? $n order to s&ecify e(&licit credentials with a Web Ser!ice, you generally instantiate the web ser!ice, and then using the credentials &ro&erties of the Web Ser!ice ob5ect you use the System.Net.Networ'%redential class to s&ecify the username, &assword, and domain that you wish to &ass when ma'ing the web ser!ice call and o&erations. 111 Side 2uestion3 $ got as'ed when you should state the credentials in code. 2ou must state the credentials you are going to &ass to the web ser!ice before you call any of the methods of the web ser!ice, otherwise the call will fail. 17) What is "!5,& and why would you use it? %A"8 stands for %ollaborati!e A&&lication "ar'u& 8anguage. %A"8 is an F"8 based language which &ro!ides data constructs that build u& the SharePoint fields, !iew, and is used for table definition during site &ro!isioning. %A"8 is res&onsible for rending data and the resulting 4T"8 that is out&ut to the user in SharePoint. %A"8 can be used for a !ariety of circumstances, o!erall is used to 3uery, build and customi*e SharePoint based sites. A general use would be building a %A"8 3uery in a SharePoint WebPart in order to retrie!e !alues from a SharePoint list. 14) What is im'ersonation& and when would you use im'ersonation? $m&ersonation can basically &ro!ide the functionality of e(ecuting something in the conte(t of a different identity, for e(am&le assigning an account to users with anonymous access. 2ou would

use im&ersonation in order to access resources on behalf of the user with a different account, that normally, that wouldnCt be able to access or e(ecute something. 16) What is the 8:esign0ime*tmlProvider interface& and when can you use it in WebParts? The $.esignTime4tmlPro!ider interface uses the function 0et.esignTime4tml,- which can contain your rele!ant render methods. $t was hel&ful to use in 2 H since it allowed your WebPart to ha!e a &re!iew while a &age was edited in 1rontPage with the Web&art on it, because the 0et.esignTime4tml,- method contains the 4T"8 for the designer to render. 20) What are WebPart 'ro'erties& and what are some of the attributes you see when declaring WebPart 'ro'erties in code? WebPart &ro&erties are 5ust li'e ASP.NET control &ro&erties, they are used to interact with and s&ecify attributes that should be a&&lied to a WebPart by a user. Some of the attributes you see with ASP.NET 2. &ro&erties are Web.escri&tion, Web.is&layName, %ategory, Personali*able, and WebBrowsable. Although most of these &ro&erties come from the System.Web.#$.Web%ontrols.WebParts class, ones li'e %ategory come out of System.%om&onent"odel names&ace. 21) Why are 'ro'erties im'ortant in WebPart develo'ment& and how have you e9'loited them in 'ast develo'ment 'ro7ects? What must each custom 'ro'erty have? Pro&erties are im&ortant because WebParts allow le!els of &ersonali*ation for each user. WebPart &ro&erties ma'e it &ossible for a user to interact, ad5ust, and increase o!erall e(&erience !alue with the &rogrammatic assets that you de!elo& without ha!ing the need to use an e(ternal editor or right any code. A !ery sim&le e(am&le of e(&loiting a &ro&erty would be something li'e allowing the user to change the te(t on the WebPart design interface so that they can dis&lay whate!er string of te(t they desire. Each custom &ro&erty that you ha!e must ha!e the a&&ro&riate get and set accessor methods. 22) What are "lass-esources? *ow do you reference and de'loy resources with an !SP(./0 2(0 WebPart? %lass/esources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the w&resources directory on the ser!er. $t is a hel&ful directory to use in order to de&loy custom images. $n ASP.NET 2. , ty&ically things such as images are referenced by embedding them as resources within an assembly. The good &art about %lass/esources is they can hel& to eliminate recom&iles to change small interface ad5ustments or alterations to e(ternal Ia!aScri&t files. 23) What is a SharePoint Solution ;ile? *ow does it differ from WebPart (cab files in legacy develo'ment? What does it contain? A SharePoint solution file is essentially a .cabinet file with all a de!elo&ers ustom com&onets suffi(ed with a .ws& e(tension that aids in de&loyment. The big difference with SharePoint solution files is is that a solution) allows de&loyment to all W1ECs in a farm

is highly manageable from the interface allowing de&loyment, retraction, and !ersioning %an &ac'age all ty&es of assets li'e site definitions, feature definitions ,and associated com&onents-, Web&arts, etc. %an &ro!ide %ode Access Security &ro!isioning to a!oid 0A% de&loyments Iust to name a few thingsJ 2#) What is a (ddf file and what does it have to do with SharePoint Solution creation? A .ddf file is a data directi!e file and is used when building the SharePoint solution bundle s&ecifying the source files and their destination locations. The im&ortant thing for someone to understand is that the .ddf file will be &assed as a &arameter to the "AKE%AB utility to orchestrate construction of the SharePoint solution fiel. 2%) What file does a SharePoint solution 'ac+age use to orchestrate $describe) its 'ac+aged contents? The solution "anifest.F"8 file. 2)) What de'loyment mechanism can you use to instigate "ode !ccess Security attributes for your WebParts? SharePoint solution files can add in order to handle code access security de&loyment issues. This is done in the element in the SharePoint solution manifest.F"8, which ma'es it easier to get assemblies the a&&ro&riate &ermissions in order to o&erate in the bin directory of the web a&&lication. 27) What is a SharePoint ;eature? What files are used to define a feature? A SharePoint 1eature is a functional com&onent that can be acti!ated and deacti!ate at !arious sco&es throughout a SharePoint instances, such as at the farm, site collection, web, etc. 1eatures ha!e their own recei!er architecture, which allow you to tra& e!ents such as when a feature is installing, uninstalling, acti!ated, or deacti!ated. They are hel&ful because they allow ease of u&grades and !ersioning. The two files that are used to define a feature are the feature.(ml and manifest file. The feature F"8 file defines the actual feature and will ma'e SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality. Side 2uestion3 $ got as'ed how the introduction of features has changed the conce&t of site definitions. SharePoint features are im&ortant when understanding the architecture of site definitions, since the BNET.F"8 file has been !astly truncated since it has se!eral feature sta&led on it. 24) What ty'es of SharePoint assets can be de'loyed with a SharePoint feature? 1eatures can do a lot. 1or e(am&le, you could de&loy Sim&le site customi*ations %ustom site na!igation WebParts &ages list ty&es

list instances e!ent handlers wor'flows custom actions 5ust to name a fewJ. 26) What are event receivers? E!ent recei!ers are classes that inherit from the S&$temE!ent/ecie!er or SP8istE!ent/ecie!er base class ,both of which deri!e out of the abstract base class SPE!ent/ecie!erBase-, and &ro!ide the o&tion of res&onding to e!ents as they occur within SharePoint, such as adding an item or deleting an item. 30) When would you use an event receiver? Since e!ent recei!ers res&ond to e!ents, you could use a recei!er for something as sim&le as canceling an action, such as deleting a document library by using the %ancel &ro&erty. This would essentially &re!ent users from deleting any documents if you wanted to maintain retention of stored data. 31) What base class do event receivers inherit from? E!ent recei!ers either inherit from the SP8istE!ent/ecie!er base class or the SP$temE!ent/ecie!er base class, both which deri!e from the abstract base class SPE!ent/ecei!erBase. 32) 8f 8 wanted to not allow 'eo'le to delete documents from a document library& how would 8 go about it? 2ou would on the $tem.eleting e!ent set) &ro&erties.%ancel7 true. 33) What is the difference between an asynchronous and synchronous event receivers? An asynchronous e!ent occurs after an action has ta'en &lace, and a synchronous e!ent occurs before an action has ta'e &lace. 1or e(am&le, an asynchronous e!ent is $temAdded, and its sister synchronous e!ent is $temAdding. 3#) *ow could you a''end a string to the title of a site when it is 'rovisioned? $n the BnActi!ated e!ent) SPWeb site 7 site%ollection./ootWebA site.Title L7 ?inter!iew?A site.#&date,-A 3%) "an an event receiver be de'loyed through a SharePoint feature? 2es. 3)) What is a content ty'e? A content ty&e is an information blue&rint basically that can be re+used throughout a SharePoint en!ironment for defining things li'e metadata and associated beha!iors. $t is basically an

e(tension of a SharePoint list, howe!er ma'es it &ortable for use throughout an instance regardless of where the instantiation occurs, ergo has location inde&endence. "ulti&le content ty&es can e(ist in one document library assuming that the a&&ro&riate document library settings are enabled. The content ty&e will contain things li'e the metadata, listform &ages, wor'flows, tem&lates ,if a document content ty&e-, and associated custom written functionality. 37) "an a content ty'e have receivers associated with it? 2es, a content ty&e can ha!e an e!ent recei!er associated with it, either inheriting from the SP8istE!ent/ecie!er base class for list le!el e!ents, or inheriting from the SP$temE!ent/ecie!er base class. Whene!er the content ty&e is instantiated, it will be sub5ect to the e!ent recei!ers that are associated with it. 34) What two files are ty'ically $this is +e't generally) included when develo'ing a content ty'e& and what is the 'ur'ose of each? There is generally the main content ty&e file that holds things li'e the content ty&e $., name, grou&, descri&tion, and !ersion. There is also the %ontentTy&e.1ields file which contains the fields to include in the content ty&e that has the $., Ty&e, Name, .is&layName, StaticName, 4idden, /e3uired, and Sealed elements. They are related by the 1ield/efs element in the main content ty&e file. 36) What is an ancestral ty'e and what does it have to do with content ty'es? An ancestral ty&e is the base ty&e that the content ty&e is deri!ing from, such as .ocument , M N N-. The ancestral ty&e will define the metadata fields that are included with the custom content ty&e. #0) "an a list definition be derived from a custom content ty'e? 2es, a list definition can deri!e from a content ty&e which can be seen in the schema.F"8 of the list definition in the element. #1) When creating a list definition& how can you create an instance of the list? 2ou can create a new instance of a list by creating an instance.F"8 file. #2) What is a ;ield "ontrol? 1ield controls are sim&le ASP.NET 2. ser!er controls that &ro!ide the basic field functionality of SharePoint. They &ro!ide basic general functionality such as dis&laying or editing list data as it a&&ears on SharePoint list &ages. #3) What base class do custom ;ield "ontrols inherit from? This !aries. 0enerally, custom field controls inherit from the "icrosoft.SharePoint.Web%ontrols.Base1ield%ontrol names&ace, but you can inherit from the default field controls.

##) What is a SharePoint site definition? What is ghosted $uncustomi<ed) and unghosted $customi<ed)? SharePoint site definitions are the core set of functionality from which SharePoint site are built from, building from the SiteTem&lates directory in the SharePoint N2 hi!e. Site definitions allow se!eral sites to inherit from a core set of files on the file system, although a&&ear to ha!e uni3ue &ages, thereby increasing &erformance and allowing changes that ha&&en to a site &ro&agate to all sites that inherit from a site definition. 0hosted means that when SharePoint creates a new site it will reference the files in the related site definition u&on site &ro!isioning. #nghosted means that the site has been edited with an e(ternal editor, and therefore the customi*ations are instead stored in the database, brea'ing the inheritance of those files from the file system. #%) *ow does one de'loy new SharePoint site definitions so that they are made aware to the SharePoint system? The best way to de&loy site definitions in the SharePoint 2 O framewor' is to use a SharePoint solution file, so that the new site definition is automatically &o&ulated to all W1ECs in the SharePoint farm.

S-ar putea să vă placă și