Wrox Real World Sharepoint 2010 – Chapter 10

[Chapter 10: Automating Business Processes]

Infopath form is completely based on XML. InfoPath Designer – for designers; InfoPath Filler – by end users to fill out the form.

InfoPath can be used independently of Sharepoint. Form templates can be placed on a network drive or on intranet; user can get them and fill them out. Or, forms can be sent directly user’s mail inboxes, where they can fill out in Outlook 2010 and submit it back.

Form templates – usually consists of labels and controls through which you want o accept user inputs. These elements are best arranged in table.  InfoPath Designer allow you to use a Rule Engine to decide how the controls should behave. Three types of rules that can be created:
(1) validation – validating
(2) Formatting – changing format of a control
(3) Action – such as setting a field’s value, submitting data…

You can quickly start incopporating rules in your form by using Quick Rules.  Think of Quick Rules as a wizard. Or you can start from scratch by clicking “Manage Rules”. InfoPath Form ends with *.xsn. Publishing and sharing the Form via Sharepoint is the recommended option, because the Sharepoint framework provides a multitude of built-in options to support the form process. When the form is published to Sharepoint, it can utilize all the base features available, such as versioning, check in-out, attach to workflow etc. An added feature is Merge View, that let’s you merge the information of multiple instances of the filled-out forms.

07/17/2011, 11:25PM, Page 341

When the user fills out and saves the form (inputs), it is saved as an XML file, which has a pointer pointing to the original InfoPath form (*.xsn). Options to send the form input back:
(1) email, (2) to a Sharepoint library, (3) to s predefined connection in Sharepoint and (4) to a web service.  Page 344

*** Using Sharepoint Designer to build SP Solutions — SPD’s work begins with Site COllection. You cannot create a site collection with SPD.

Side note about external content type: Just data sources that connect to external databases; to create a ECT is to create a connection to a database and set up read/write/execute options. After that you can create a Sharepoint list based on this new connection. Not that you have to go to Sharepoint Admin to set the permission for this ECT – or else you get a Access Denied by BDC error when you want to browse the list (called external List)> This is where to set the permission:
Central Admin –>Application Management –> manage service Application –> click “BDC service” –> Locate the ECT –> Right click the item and select “set permission”.

** Combining InfoPath and Sharepoint Designer: Practice:
(1) A training request form is esigned and published to a new forms lib called Training Requests
(2) Visio is sued to model a workflow for routing the training request form, and the workflow is exported.
(3) The exported workflow file is imported into SPD and attached to the training Requests library.
(4) Workflow rules are configured within SPD and published.

When you rename a control in InfoPath, always use Pascal – such as TrainingRequested because Sharepoint recognize this format and will break the words for you  when needed.

Two ways to mark a InfoPath field “required”
(1) select the field, and in the Ribbon (“Control Tools/Property”), check “Cannot be blank”.
(2) Quick Rules – select the control, from ribbon Add Rules –> Is Blank –> Show Validation Error.

You can copy/paste a rule from one InfoPath control to another — after you copy them you can modify them to fine tune it.

**** iMPORTANT
**** When you create a InfopathForm, and define adata source that retrieves a list of items such as (Product Names) and use it to populate a drop down box, you might get an erro rmessage when you preview the form: Infopath doesn’t support cross domain……

You need to do this to get rid of this error: File –>Advanced Form Options –> Security and Trust –> Select Full Trust.

*** Another important note: If your trust level is set to Full Trust (becuse you need to test it/preview it in InfoPath), you need to change it back to “Domain” (allow access to all resources in the same domain) before you publish it. or else you get an weird message that says the form has to be approved by an admin first….. change it back and the warning will go away.

Once you publish it, you can go to the form library (“Taining Request”) fill out the form by : Documents –> New Document.

07/18/2011, 11:51PM, Page 358

You need to export the data connectons to Sharepoint Server (create a Data Connection Library, or DCL, first). In InfoPath, Manage Data Connections –> Convert to Data Connection File

Best practice designing InfoPath Form and data connection libraries:
1. Create data connections locally first using infoPath (*.odc) and then convert/export them to Sharepoint server under a data connection library.
2. When Designing Infopath form control (such as a drop down) populate the drop down by associating it with a data connection that is saved on Sharepoint server, not a local one.
3. When the form is published, the form will automatically use the data connection files in the DCL.

SPD can be used to create the following workflows:
(1) list workflow – simplest. meant for a specific list or library and are not portable.
(2) Reusable – very portable. Can be used to attach to a content type, which can then be used in other lists/libraries. Reusable workflow can be packaged and deployed to other site collections.
(3) Site workflows – deployed to a site and work on all site components when execute.

 When you import VISIO workflow design file (VWI) into SPD, you need to decide which list/library to attach it to, or make it a reusable workflow so you can configure it later. Important step because you cann’t change it later.

07/19/2011, 08;19PM, Page 375

Wrox Real World Sharepoint 2010 – Chapter 9

[Chapter 9: Sharepoint 2010 web Part]

Explorer these web part before creating a custom one:
(1) XSL List View (XLV) Web Part
(2) Data View Web Part (DVWP)
(3) Data Form Web Part (DFWP)

web Part:
1. Reusability – reusable
2. Componentization – encapsulate common business functions
3. Interoperability – facilitate cross-webpart and cross-page communications with other web parts
4. Portability – should work on Sharepoint and non-sharepoint (ASP.NET) site.
5. Configurability – can be configured by client.

Web part is derived from System.web.UI.WebControls.WebParts,.Webpart.

Create control declaratively –
<asp:TextBox Text=”….”….>

Create control imperatively: (imperative – using a command)
TextBox t=new Textbox();
t.text=”….”

Web part development:
(1) make a DLL
(2) write some XML
(3) deploy.

*** Sharepoint feature is a bundle of functionality that can be activated in one of 4 scopes: Web, Site Collection, Web Application or Farm. Everything delivered to a Sharepoint farm should be delivered using a WSP. This includes all Sharepoint Features, all files detined for Sharepoint root, all content detined for the configuration or Content Database, all web.config modifications, and so on,

Whenever a new item is added into a Sharepoint Project, VS attempts to auto-update the feature and solution with its best guess as to where that item should be included. Build -> Debug from the menu will sve changes to all project files, compile the imperative logic (if any) into an assembly, validte the declarative logic, generate a WSP, upload to Sharepoint (either Farm’s solution store or site collection’s solution gallery), and by default, activate the features in the solution.

Web Part benchmarks: Each web part must meet the following benchmarks:
(1) compiled
(2) Signed – actually not required for all, but is required for web parts for GAC.  Always sign web PART!!!!
(3) Marked as Safe – a sharepoint app will run a web part only if it is eplicitly identified as SafeControl in the web.config.
(4) Trusted
(5) deployed 

web Part makeup – a minimum of two files make up the web part –
(1) web part definition – come in the form of an assembly
(2) web part template – (*.webpart)

** Page :
(1) File system: ….\_layouts\**** (application pages) [{Sharepointroot}\TEMPLATE\LAYOUTS]
(2) Content database:
      a. Instance pages (system pages), and publishing pages (site pages)
      b. Master page gallery: Master page, payge layouts

What is instance page (system page) – are pages not based on PageLayout. Wiki page; web Part page; Meeting workspace tab page; ASPX/HTML page; /default.aspx; /Lists/Tasks/AllItems.aspx…. Use masterURL to decide which master page to use

*** Publishing pages: Pages always based on a Page Layout. Use CustomMasterURL to decide which master page to use. /Pages/default.aspx; /Pages/Todd.aspx

** Master Page — master pages in Master Page Gallery are used for Content Pages; whereas master pages in _layout are typically for ApplicationPages.

** Page Layouts –They’re  in the master page gallery and are used to define what Content Type (and therefore what site columns) will be positionsed where within the master page.
Application pages:

Web Part Galleries:
web part tempalte is hossted in web part Galleries. web Part templates uploaded to the site collection;s web part galleryy are available anywhere from within the site collection. These web part templates typically get into site collection web Part Gallery using a Module Feature.

web part templates placed in the physical wpcatalog folder just off the root of the web app’s IIS web site will be shown in all pages of all site collections within the web app. These web part templates typically get into web App’s Web Part Gallery using the Dwpfiles element of the Sharepoint solution.

*** Web Part manager. web Part Manager typically is placed on the master page; but Sharepoint uses SPWebPartManager. Job:
(1) maintain an inventory of the controls on a specific page that supports web parts.
(2) provide a vehicles to add/remove/import/export web parts
(3) raise web part life cycle events.
(4) Change between the different web page views (design, page layout, editing views etc.)
(5) Create/delete/manage web parts connections.
(6) Manage page and web part personalization.

** Web Part Zone – primary role: provide a common user interface and to control the appearance of web part controls.

Sharepoint Web Part requires these two controls: SPWebPartManager and WebPartZone.

On the Insert –> Web Part page, you can upload a web part template (from local) by clicking the “Upload a Web Part” link. Browse and select the *.webpart file. Once uploaded, the uploaded will be available for selection in the “Imported Web Parts” category.

Web part properties: 4 attributes unique to Sharepoint – state management:
(1) WebBrowsable – whether end user can see the properties in the Edit pane. If false, to imperatively set the property’s value on behalf of the end user.
(2) WebDescription – this string shows as a tooltop over the display name.
(3) webDisplayName – shows as the label for the control in the Editor pane.
(4) Personalizzable – a. PersonalizationScope.Shared – true/false: whether Sharepoint should store one value for everyone; b. PersonalizationScope.User: whether Sharepoint should still one common value for everyone, but allow anyone who has permission to personalize to change that value.

** Web Part resources: Sometimes it is needed to deploy other resources with the web part, such as CSS< HTML, Javascript, CSV, XML etc.
 
** Creating a sample visual web part.

When creating a custom/new web part, change the Group property of the web part’s Element.XML to a custom name, so they can be displayed in a specific category:
<Property Name=”Group” Value=”RealWorld” />

Look at the property of the Feature, the deplayment path is:
$SharePoint.Project.FileNameWithoutExtension$_$SharePoint.Feature.FileNameWithoutExtension$

That’s {ProjectName}_{FeatureName}

web part (or other items to be deployed) <<< Feature <<< package

In Package designer, it is default to deplay to WFE. To validate a package, use “Packaing Explorer”, do this to open Packaging Explorer:
View –> Other Windows –> Packaging Explorer. The Packaging Explorer will open in the Tool Box area!!!! (on the left) Right click the top item, right click and “Validate”. Once validatation completed, you will see at the bottom whether it’s successful/failed. You will see the reason in the output window.

When will the “validate” fail? For example, you create a Visual Web part project, but try to deploy it as a sandbox solution!!!! Simply change the solution to be a Farm solution and the validation will pass.

In Webpart’s *.cs file, add this (example) to inside the web part class, to create a user-customizable property: Your web part can use user’s input to customize the web part.

        [WebBrowsable(true)]
        [Personalizable(PersonalizationScope.Shared)]
        [WebDisplayName(“Gagaoolala”)]
        [WebDescription(“Enter the custom name: gagaxxxxxx”)]
        [System.ComponentModel.Category(“Real World”)]
        public string WpProperty { get; set; }

Page 335, 07/17/2011, 10:17PM

Wrox Real World Sharepoint 2010 – Chapter 8

[Chapter 8: Building Sandbox Solutions]

CAS (Code Access Security)  – a set of policies that control which functions can be performed by code based on a set of criteria. e.G., EXECUTION OF CODE THAT IS HOSTED ON A NETWORK SHARE IS DISABLED BY DEFAULT. CAS policies are in XML. CAS doesn’t appy to the code in GAC!!!
 BIN/CAS is the approach used in 2007, but is still not perfect.  
 
Sharepoint 2010 – SandBox Solution. With sandbox solution, each site collection administrator can deploy the solution into a special solution gallery.  Only farm administrator will have the capability to add the new solution to the farm.

Sandbox solution is run in this IIS process: SPUHostservice.exe. Sandbox solution can access anything inside the site collection, and nothing esle. Any given time, there’s only one thing in this unique application doamin that will be running, SP will terminate the sandbox code if it executes for too long. Default: 60 seconds. All sandbox resources are tracked.

Once the site collection reaches it quota, the solutions in the site collections are shut down for the day. You can host the sandbox user code in WFE, or another sets of servers.

** Query throtting — at web application level. Default: 5000 because if > 5000 rows  SQL will apply table lock (no updates alowed) until query compelted. Solutions:
(1) Administrator has a different row quota.
(2) Turn off query throttling for a list via the property.
(3) HAPPY hour – query throttling is turned of for a few hours (such as 1-6AM).

Sandbox:
(1) Solution Garllery in a site collection, and the Sharepoint solutions (WSP) in it. THis is sandbox deployment.
(2) SPUHostservice.exe. This is where the code is executed.

What you can and cannot do:
Three basic permissions are granted to Sandbox:
(1) SecurityPermission.Execution,
(2) AspnetHostingPermission.Level=Minimal,
(3) SharepointPermission.ObjectModel

No access to Microsoft.Sharepoint.Administratiorn

Not allowed: SPSite Constructor, SPSecurity, SPWorkitem and SPWorkitemCollection, SPUserSoluton, SPUtility.SendEmail, Microsoft.Sharepoint.Navigation, SPUtility, SPWebPartmanager, SPWebpartConnection, WebPartZone, WebPartPage, ToolPane, ToolPart, SPGridView. etc. No access to write to ULS log. Very restricted!!!! No TCP cnnection, no web service call, no reading RSS, no database connection or any backend system. No external list.

To see the resources used by the sandbox solution –> Site Actions –> Site settings –> Gallery –> Solution

use proxy to break the limitation — overriding two classes: (1) argument class and operations class, and registering your proxy to Sharepoint.

ADO.Net Data service –> REST can return ATOM XML and Javascript Object Notation (JSON).  REST is not suppoerted for external list.

Workflow – full trust – farm solution
Event receiver – full trust – farm solution.
External site use, high volumn, public-facing – overhead consideration – farm solution.

07/14/2011, 10:17PM

Wrox Real World Sharepoint 2010 – Chapter 7

[Chapter 7: Working with Sharepoint Designer 2010]

SPD 2010: Creating sites, managing users, list and libraries, even content types and site columns; branding, creating workflows, connecting to external data sources.
Central Admin settings regarding Sharepoint Designer 2010: Central Admin –> General App Setting –> Sharepoint Designer 2010. Options:
(1) Enable Sharepoint Designer – can SPD used at all? (at the Web Application level)
(2) Enable Detaching Pages from the Site Definition
(3) Enable Customizing Master Pages and Layout Pages
(4) Enable Managing of Web Site URL Structure –

You can control SPD access from two places (1) Central Admin (above), and (2) Site Collection.

CSS: Skewer Click: Click this button and hover to an element (text etc.) and you can see whch style is being applied to the element.
Page 220, 07/10/2011, 07:37PM

Copying and modifying an existing style is the recommended way to update the out-of-the-box-CSS.  
— Forms- out of the box, most list forms in Sharepoint 2010 are ASP.NET forms. If you have Sharepoint 2010 Enterprise, you can edit a list form from SPD by going to the “List and Libraries”, open a list/Library, and in the ribbon, you see “Design Forms in InfoPath”.

— Views and XSLT List View web Part

Views are the primary ways that contents from list and libraries are displayed to the user. You can create a new View for a list/library from SPD. In Sharepoint 2007, views are based on CAML, which is difficult to update; in Sharepoint 2010, it uses XSLT – with XSLT List View Web Part.  

You can create or update a list view (conditional formatting; filtering). In Sharepoint 2010, you can see the view selector in breadcrumbs (Browser mde) or the List tab (edit mode).

— Work flow: sharepoint 2007 – cannot reuse workflow; cannot move workflow to another server easily. Sharepoint 2010: you can now.

types of workflow:
(1) List workflow: directly associated with a list.
(2) reusable workflow: can be used with many lists or libraries. based on a specific content type and can be reused throughtout the site.
(3) Site workflow: not associated with a list or content type.
(4) Globally reusable workflow: the out-of-the-box workflows.

Best to make a copy before modifying it.

SPD uses declarative rule-based workflows. Use conditions and actions to define the process. This simply means that when a workflow runs on an item, it evaluates each condition, starting with the first one, until a condition is found that applied. SPD 2010 supports Parallel block (multiple tasks can execute in parrallel).

Workflow impersonatyion – by default workflow runs under the identity of the user who’s logged in. Lookup profile – you can lookup user’s profile and use it in workflow. You can import and export workflows to/from Visio 2010.

— Data Source: Sharepoint, or other external such as SQL server, or list/libraries.

pAGE 241, 07/11/2011, 10:1

07/14/2011, 06:26PM Connecting to web Service
To create a site page with a data view that gets data from a SOAP service: (assuming a SOAP connection has been created in Data Source)
1. In SPD 2010, click Site Pages, create a new site page.
2. In edit mode of the site page, click [PlaceHolderMain], and click “Data View” –> the data source created (in the robbon)
3. A Data view will be created with the data rom SOAP populated. Click the first link cell, click the arrow next to it, and you can format the link as a hyperlink.

** Sharepoint Designer 2010 is an ideal tool for site owners to use to manage all aspects of their sites quickly and efficiently. Why would you not want to give SPD to your site owners? Reasons:
(1) it is still a very power tool that requires contreol from administrator.
(2) User shoul dbe given training to use SPD.

— Workflow — options for an orgination to create workflow:
(1) out-of-the-box – good for very simple workflows, such as feedbacks and approval workflow.
(2) Sharepoint Designer – declarative, rule-based workflows that are capable of medium complexity. Ideal for the majority of workflows that are capable of medium complexity. Quick to create/change/support.  [Out of box workfow can be modified for extended use)
(3) Custom development: VS 2010.

** branding —
07/14/2011, 07:32PM

Wrox Real World Sharepoint 2010 – Chapter 6

[Chapter 6: Backing Up and Restoring Sharepoint 2010]

Page 166

Types of recovery:
Content Recovery – 2 levels of recycle bin; 30 days after deletingdoesn’t move the file into 2nd level automatically.
Disaster recovery – sites site collections, content databasess, adn farms.

In Sharepoint 2010, you have true farm configuration backup and recovery. (in 2007 you can’t)

There is still no scheduled backup support in SP 2010. recommended: write a Powershell script and schedule it through the Task Scheduler.
Backup/Restore-SPFarm/SPStie
Export/Import-SPWeb

Sharepoint marks a site collection as read-only when performing a backup.

To restore a site/site collection (unattached content database recovery)
1. Restore the content database to a database from backup.
2. Use Central Admin to connect to the database, browse and export the website.
3. Import the web site to prodcution.

In Sharepoint 2010, you can export a single list or library.

Two types of backup:
(1) farm 
(2) granular – site collection and web/list

Granular backups can be made against the regular Content Databases that are attached to the farm, ot against unattached Content Databases.
* Site Collection backup – fast; will place a lock (can be solved by using databae snapshot) ; back up all (all webs, users, groups, permissions, galleries, workflow status, feature activations, navigation and everything else); a site collection can only be restored to its entirity, not portion of.

All backup restore commnad issued form Central Admin are executed by timer services.

Backup-SPSite http://localhost/sites/realworld -path e:\backup\a.bak <-UseSqlSnapshot> <-NoSiteLock> <-force>

Restoring site collection – cannot use Central Admin. The restored site collection will have the same GUID’s, so be careful.

Restore-SPSite http://localhost/hr -Path e:\path\hr.bak -force <-ContentDatabase SP_HR_Contetn>

If you don’t specify the Contentdatabase option, SP automatically choose a “most available” content DB.

Export an WEB:
Export -SPWeb http://localhost/sites/realworld/teamsite -path \\SP2010\backup\teamsite.cmp
Just the library:
Export -SPWeb http://localhost/sites/realworld/teamsite -path \\SP2010\backup\teamsite.cmp -ItemUrl “Shared Documents” <-IncludeUserSecurity> -IncludeVersions All

** Import — Import-SPWeb

— Farm backup:  Page 186, 07/09/2011, 11:01PM 

Backup-SPFarm -BackupMethod full -Directory \\SP2010\backup\farm <-ConfigurationOnly> <-item “User Profile service Application”>

To increase farm backup speed, use -BackupThread 5 to perform multiple backup tasks at the same time.

— Use Sharepoint soluton packages for any custom code deployed into Sharepoint Environment. (*.WSP). (1) Simply the effort in deploying custom code and (2) ensure changes are consistently and correctly applied; in cases of farm restoration, Sharepoint will restore and redeploy custom solutions automatically. Saves much time!!!!

If you expect to deploy custom code in your SP environment, insist that the development team build solution packages for all deployed artifacts.

Content Database: No more than 100GB. Always do a trial restore!!! To make sure backup is good, and also you know how to do a restore.

07/10/2011, 11:45AM

Wrox Real World Sharepoint 2010 – Chapter 5

[Chapter 5: Using PowerShell with SharePoint 2010]

PowerShell shortcut property:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe  -NoExit  ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1

sharepoint.ps1:

$ver = $host | select version

if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = “ReuseThread”}

Add-PsSnapin Microsoft.SharePoint.PowerShell

Set-location $home

To explicit declare a type for a cmdlet variable, such as:

$farm=Get-SPFarm,

you can do this:

[Microsoft.Sharepoint.Administration.SPFarm]$farm=Get-SPFarm

** Object pipeline

e.g., C:> Get-SPWeb http://portal/* | where {$_MasterUrl -like “*/v4.master”}}

$_ means the current object in the script block. How do you kow what parameters can be piped into a cmdlet? use “help Get-SPWeb -full”.

You will see Accept Pipeline Input and Accept Pipeline input is True/False.

– Filter:
Get-SPSite – Limit All -Filter {$_Owner – eq “wrox/spadmin”}

Loop:

C:\> 1..10 | ForEach-Object {
if ($- -eq 5) {continue}
Write-Host $_
}

you get:
1
2
3
4

foreach ($i in 1..10) {
if ($i -eq 5) {continue}
Write-Host $i
}

you get:
1
2
.
.
9
10

Functions and Scripts
function New-ManagedAccount {
$cred=Get-Credential “wrox\spfarm”
return New-SPManagedAccount -Credential #cred
}

To load a script: (*.ps1)
C:\> . .\Functions.ps1

To accept parameters:
function New-ManagedAccount ([string]$accountname) {
$cred=Get-Credential $accountname
return New-SPManagedAccount -Credential #cred
}

Check if a variable if NULL:

if ($account -eq $null)

Get-Command:
Get-Command -pssnapin Microsoft.Sharepoint.Powershell
returns all sharepoint powershell commands

Get-Command -noun SPService* | sort noun | ft name
returns all commands with “SPService” in name, sorted by name, and return name only.

To see members (properties) of an object:
Get-SPSite http://* | Get-Member

Start- and Stop-SPAssignment – used to dispose of objects after using them.

E.g.,: (Simple)
Start-SPAssignment -Global
blah
blah
Stop-SPAssignment

Wrox Real World Sharepoint 2010 – Chapter 4

[Chapter 4: Claimed-Based Authentication]

kerberos use a Key Distribution Center (KDC) to safeghuard information and broker ticket issuance. As such, Keberos is commonly known as network-based identity, because Keberos protocol provides third party authentication where a user proves his or her identity by the use of a centralized server.

Bundled identity information in the digtal context is often referred to as a token, or security token. A security token can contain any number of arbitrary claims. Each claim represents a piece of information – referred to as [assertions]. Each of the token is digitally signed to ensure validity.

Each token in a CBA is generated by a security token service (STS). If user has more than one identities, then an [identity selector] is used.

Components of a claimed-based authentication:

** Active Directory Federation services (AD FS) — the central component in a claimed-based environment is STS, and Microsfot’s STS solution is ADFS (ADFS is a STS).  ADFS issues SAML token in response to WS-Trust requests. Supports both active and passive clients. Can be used from a web and client environment.

** Windows Identity Foundation (WIF) —

** Cardspace — Microsoft’s version of identity selector.

Configuring Sharepoint Claim-based authentication: By default, Sharepoint 2010 includes a trusted STS. the web service name in IIS is “SecurityTokenService”.  Use “Get-SPTrustedIdentityTokenIssuer” command to examine the “IdentityClaimTypeInformation”, it is possible to findout exactly what claims Sharepoint is expecting.

In a real world, ASFS 2.0 will be hosted on a separate server.

(P.129, 6/4. 12:24 PM)

Wrox Real World Sharepoint 2010 – Chapter 3

UL – Unifeid Logging servicve. Can report events to three different location:
(1) Sharepoint trace logs
(2) Windows Event Logs
(3) Sharepoint logging database.

Sharepoint Trace Logs location:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS
By default, a new log file is created every 30 minutes.
This changes the time to 60 min:
Set-SPDiagnosticConfig -LogCutInterval 60

To select which event to monitor in the trace log: Admin –> Monitoring –> Configure Diagnostic Logging.
Also on the same page, you can change the trace log file location, delete log files time limit (14 days) and file size etc.
This is a FARM level setting, so make sure all servers have the same drive letter path etc.

Get or set Diagnostic setting:
Get-SPDiagnosticConfig
Set-SPDiagnosticConfig

get help on any Powershell command:
Get-Help Set-SPDiagnosticConfig -Examples

search command by keyword:
Get-Command -Noun SPLogLevel (Powreshell comannd is “Verb-Noun”, such as “Get-Help”)

Get the sp log level of all objects in the “Access services” area:
Get-SPLoglevel | Where-Object {$_.area.tostring() -eq “Access Services”}

(P.77, 05/30/2011

** Correlation ID is a unique GUID that is assigned to each conversion a user or process has with Sharepoint. When an error occurs, an admin can use the Correlation ID to track down in the trace log.

** Developer dashboard: A dsahboard that shows how long it took for a page to load, and which components are loaded. The display level can be: On, Off, OnDemand. It’s a Farm-Wide setting!!!!!! Only users with AddAndCustomizePages permission can see it.

** MSDN ULS Viewer: Allows realtime monitoring of the ULS log. Do smart highlighting. You can do Open–> File, or Open –> ULS (the default “/LOG” folder). Smart highlight: Mouse over a column data, and other cells with the same data are hghlighted. Use Get-SPLogEvent to search trace log. New-SOLogFile tells Sharepoint to start a new trace log file. Merge-SPLogFile to merge log files from all servers into one — by default, only get the last hour data.

Sharepoint also wirte to Windows Event Log (Monitoring –> Configuring Diagnostic Logging) For Windows Event Log only, you can set “event throttling”. Keeps from Windows Event log from being overrun by the same message.

** Logging Database: Farm-Wide repository of Sharepoint events from every machine in your farm. Aggregate info from many different location, and write them into one database. If you destroy the database, you can delte it, and then have Sharepoint re-create it.

(P.88, 05/31/2011, 11:59PM)

By default, health data collection is enabled. Admin –> Monitoring –> Reporting –> Configure usage and health data collection. By default, the health data log are saved in the same folder as the trace logs (…..\14\LOGS\), but with the extension of *.usgae.  Defalt logging database name: WSS_Logging.

To view analytics report for each [site collection], go to the site collection, Site Actions –> Site settings –> Web Analytics

** Admin –> Monitoring –> Health Analyzer: Sharepoint uses timer jobs to check on system metrics; when a rule fails, alert an administrator, or just fix the problem. Sharepoint comes with 60 “Rule Definitions”.

You can assign a preferred server for timer jobs per Content Database. Admin –> App Management –> Manage Content Database, click a content database name, and then select a preferred server for the timer job.

(6/1/2011, 09:15PM)

Interesting week

It was an interesting week…. worked overtime all week for an office project… finishing up the built-in bookshelf…. review the Sharepoint 2010 materials etc. I will keep studying and looking forward to learning more.

Chapter 13 – Databases

SAMS CSHARP 4.0 (Page 238)

Create new DB in VS 2010
In server explorer:

Select server instance and enter new DB name:

Add new table:

Set up the table

Connect and Retrieve Data