Skip to content

Day4 – Dev

Collections in sharepoint are by default given security trimmed.Generally good to use about feature, without coder needing to check anything.items count will only show those items to which we have permission.Collection takes time to read.

=============================================
HOW TO DEBUG A SIMPLE SOLUTION
=============================================
symbol files to debug : pdb file is for debugging. attaching to the process,
go to Debug -> Process with debugger
Compilation with debug = true and custom error = off , Safe Parser.
Sharepoint callstack = true. Change web.config auto deploys the application F9 for debug.

Debug: Attach/ Detach to process, If the circle debug point is not complete – symbol files not yet generated or rebuild.SPSecurityTrimmedControl: Shows controls if user has permissions to view the control.
Assembly name: Name.Version.Culture.PublicKey. Every dll or exe as created will have all four. Object browser gives some information

DLL : ILDASM. Tool that gives info.
GAC : Global assembly cache: of information.

First the dll is looked for in GAC path. if found there not looked elsewhere.
Probepath: can be defined by each application,
for desktop the probe path is same directory as the app, followed by sub dir in appl and then os system
for Asp.net appl the probe path is simply Bin, that is the only place apart from gac where they can load the dll.

BUT:

This has a downside, and an applic uses that dll, and then you replace the dll in the GAC, the replaced dll will not take effect, until ALL application that restart,
that are using this DLL.Try putting as many things in probe but not in gac, unless used by most – and needs security then u put in gac.
Compilers cannot conviniently use it, so need to keep a copy of it.

GAC collection of directory which are 4/5 levels deep. GAC Viewer helps us see it flat.
Assembly names are not case sensitive and are senitive to spelling and punctuation!.

C:\windows\assembly

~ can only be used to set properties of the .net controls link

core.css: 1033 styles need to be redefined for difft languages. per lang basis, 1033 = english, usa.

=======================================================================================================
Master Page contains controls and tags just like an aspx page does. ASPX Page.
Content placeholder control. It can contain other controls but it usually does not. each content placeholder control has got an id , unique to it.
Then you write a content plage: that is also an aspx page, page directive indicates that it is linked to XYZ Master.

Content control in master , ASP:Content they state which page to be replaced over.
placeholder = content control. if the aspx page is provided a content control – then it will replace the conetnt.

Share point uses content controls : everywhere.
Every site can have any number of master pages and site can have pages which use whichever one of these masters,
but the convention in sharepoint is that TWO are marked :
1. System of Default Master
2. Application or the Custom Master

Path to these masters can be found through these. The idea is that application pages, forms and views use the system master and all other pages use the custom master.
Admin can change both these 2 master pages. Content page can at any time state that I will work with difft master, old and new master have exactly the same placeholders.
Pages use either system or custom master.

Default templates – Home pages use system master.

Our pages need to use custom. Implement the main placeholder in sharepoint.
Forms and Views use the system master.
Other use : Custom master
Layout: They are not in site: Normally layout pages do not use site master, instead they use their own master,

@Register durectuve for Microsoft.Sharepoint with tag prefix : ST , and using SPSecurityTrimmedControl Permissions , PermissionContext.
Page class after onLoad – if this page to a different maaster – then it assumes that the second master will have the same placeholders as well!.

This has to be done very early in the pages life is – preInit. In this event we capture the master switching.

Need not keep the asp:content in the sequence?
Use different master in preInit = Web.customMasterUrl and this uses application master.

Layout: in template/layout / subdir
either root / template files

ST:CSSLink/>
ST:Theme
If layout pages tries to write to sharepoint – then immediately the call fails. it puts some special data in thebody of the page and when the request is responsed to thtn this data is send back. page.Layout pages can be seen in any site!it is generic : flexible way to get same look and feel. If the form digest control is present on the page then the page on the control can write = a+ depending on, the masters actually include a placeholder called placeholder formdigest. So its better to use placeholder.

Site master: site master puts this control automatically.
Application master: does have it by default. put placeholder but keep it blank.
Only directives and content controls are allowed – NOT even comments are allowed.

=======================================================================================================================================================
WEB PARTS:
=============================================

Custom actions or hyperlinks are security driven.
Custom action if dynamic is custom control. Need to give declaration for it.

Several other kind of new elements, what are features – of user interface or functionality that are added to sharepoint site/site collection or application.
a feature can be added at time of creation or later or removed later.

Features are deployed: after that features are activated, SCOPE: of the feature :site collection, site, application.
SP* itself uses features,

Feature.xml : ID and scope is mantdaory, Feature is defined in terms of elements.
Elements: Custom action, Files which go into database, list etc, feature manifest does not describe elements,
the actual elements are described in these files. element files which are used to support elements.

Element , say a list template – those 4 form files are element files, so when u require supporting file than u write in tlement listing thier reference.
This feature called fields is the scope site. Site columns. this feature is active on each site collection.

CustomAction can have URLAction

Custom control = ASAX = control source – give path to asax file there
or you can create it as a class in a dll – then control assembly contains full pf dll,
and control class uses control CLASS name.

Type 103 and baseType 0 in lists
Go to the director which contains feature manfiest

===========================
Where a custom action appears depends on locationa nd GroupId.
GroupdId may be blank, In certain location you might want the custom action to appear conditionally?

Group ID is given only when you want to add to a group.
Custom ID is given if you want to hide a element from the given element.

Registration type and registration ID (combination is impt in certain cases) : conditional appearing of link!.
ECB – regist type would contain and regis id would contain type : 101. (DOC LIB)
Registration Type: 101. Limit a menu item to appear in certain type of list, alternatively you can specify the content type.
Regis id would hv content type identified: for existing content types (CTYPES feature has it)

Item’s contenty type or list type?

All lists define : BASE STYPE.
0 – non lib list (linked list, custom list)
1 – doc list (all library type of)
2,3,4 – base type.

Security bits only work with base type 0 and not with base type 1:
11 – see edit all
12 – see
22 – see only edit own
24 – see own, edit not allowed

You cannot change the fact that the feature contains a list template and also the attrib of list. Featire adds new capabilities.
Create list of type links.
Appearance of custom action based on CONTEXT OF CONTENT etc.

Site Features: Site Settings exists. (Activate/ deactivate them as per need).
Version should be four part number : REquirement!,

Finally: who can see this? RequiresSiteAdmin or Rights/ Whichever permissions are required, on – the list or the item. for site?
On what is important. Sequence is just a number. it sorts on sequence.

solution manifest file. = manifest.xml
feature : feature.xml

now all these files in directory under features – so what we really need to specify the name of dir and all files under,in the solution package: create a dir – this dir has the name you want under features, your feature manifest and element manifest should exist in that dir as required. ST Feature1

Scope of feature is : WEB so separately activate for each site collection!.
web parts are controls which can be added to a page by a user dynamically at run time.
web part manager: change user interface such that edit mode comes
web part zone: in design mode zones are visible such that zones are not visible. (left/ right mode ) you can tell web part manager to put modes.

Add a web part to one of the zones?. Web part definition file: xml file that the info – class reside in assembly , + properties.Given a web part definition – the web part mgr to that zone.

Every page inside sharepoint – they all derive from class called WebPartPage and in that class already a web part manager put in place.
Gallery or catalogue: web part definitions are stored there.

==============================================================================================================
USING WEB PARTS:
1. Assembly
2. trusted by sharepoing safe parser: Security
3. Definition for web part should be available in some form to the user who wants to add.
==============================================================================================================

Use a solution from DAY1 for deploying web part.
Web part can be loaded – the assembly has to be available to the application – in asp.net only 2 locations.
One: GAC
Second: Bin
Which means if web part has to be usable. webPartPage.

Content is rendered by web part and web part manager has control of CHROME : Titel of webpart.
Closing web part has a negative side effect; Prevent your web parts from closing.

Base class of web part of sharepoint : Let that derive from ASP.net Webpart.
In design mode you will always see chrome in display may or maynot,

can also remove title/border of chrome and then minimize effect is same as hidden.
visibility:False (single line of space is taken)
display: none . The difference between both!!

all sites in all site collection in that application = SERVER GALLERY.
Per Site Collection : We have _CatalogsWP : Web part Defn XML file: in the database.
Closed web parts and this

For mantainence of web parts: default.asp?Contents=1
Site URL/_layouts/spcontnt.aspx?&url=[server relative page url]

Every list has a listview web part. ListView Web part shows the view of the list.
Certain lists have such common content – that viewing.

Web PArt = VIEWING THINGS!! – here in this case for view.

Site Users : Meeting, Messenger, Communication enabled.
Task item – assign them to people – shows each user all tasks assigned.
XML

Add and customize pages: Permission to edit page.
Personal view: only personal view, Permission: add/remove personal web parts.
Shared Web parts has two kinds of properties: Shared (Then this property is shared only and not personal ) and Personalized (Shared and personalized property).
Personalied Web parts: have exclusive rights on it.

For web part : create a class library and set assembly info in it. (3 part) extend base web part make class public : First is OnPreInit, then properties are loaded, [onLoad is fired then] then Control is composite – and then they get their child controls and so on down the value.
Two impt methods r called: OnPreRender and then Render, (Render is the last method – in this method html is written out.So beings on pre init and ends at render). Web Part – render method – calls chrome, so override the method called renderContents (do not override render!)

Only assembly with public key token should be put in GAC and normally do not put it in Gac.
Copy the dll to wwwroot folder -> testroot / bin
For assembly which have strong name : that is public key token – and give the first part and let it be if culture neutral and version 1.0.0.0

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: