Thursday, December 22, 2011

SPSecurity.RunWithElevatedPrivileges

The ideal way to Elevate Privileges:

(Code written on the run - Check for build errors)

Guid SiteID = SpWeb.Current.Site.ID;
Guid WebID = SPWeb.Current.Web.ID;

SpSecurity.RunWithElevatedPrivileges(delegate(){

using (SPSite oSite = new SPSite(sSiteID))
{
              using (SPWeb oWeb = oSite.OpenWeb(WebID))
               {
                             //Logic
                }
}
});

One thing to be kept in mind while implementing such logic is that any SP Object with is created outside of the RWEP belongs to that particular context and when that SP Object is sent inside the RWEP, the elevation is lost.

For Example, if I need to use a list within the RWEP, then I should follow these:

DoSomethingWithTheList(SPList tempList)
{
    Guid SiteID = SpWeb.Current.Site.ID;
    Guid WebID = SPWeb.Current.Web.ID;
    string sListName = tempList.Title;

    SpSecurity.RunWithElevatedPrivileges(delegate()  
   {
        using (SPSite oSite = new SPSite(sSiteID))
       {
            using (SPWeb oWeb = oSite.OpenWeb(WebID))
           {
                 SPList oList = oWeb.Lists.TryGetList(sListName);
                 //Logic
           }
       }
   });
}

Wednesday, December 21, 2011

Understanding Sessions

Enabling Sessions

How to enable sessions in a SharePoint Web Application:

Open the web.config file of your web application and do the following:
Locate the <modules> section, and just below <remove name="Session" />, add a new element:
 <add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />


Then, locate the <pages> element and enable session state:
    <pages enableSessionState="true" ...
 

Enable or disable session state across the entire farm

  1. On the taskbar, click Start, point to Administrative Tools, and then click SharePoint 3.0 Central Administration.
  2. In the top navigation bar, click the Application Management tab.
  3. On the Application Management page, in the Office SharePoint Servers Shared Services section, click Configure session state.
  4. On the Configure Session State page, in the Enable Session State section, select the Enable Session State check box to enable session state for the farm.
  5. To specify the duration of sessions, in the Timeout section, enter a number (in minutes) in the Session should be timed out after (minutes) box. The default is 60 minutes.
  6. Click OK to save the session state configuration.

Saturday, October 8, 2011

Exception Management in SharePoint

Best Practices: Using Disposable Windows SharePoint Services Objects

Modal PopUp in SharePoint

Have always got stuck in this.


/// <summary>
        /// Generates a modal popup
        /// </summary>
        /// <param name="sTitleOfThePage"></param>
        /// <param name="sWidthOfTheWindow"></param>
        /// <param name="sHeightOfTheWindow"></param>
        /// <param name="LinkOfThePageThatNeedsToBeOpened"></param>
        private void CallModalPopUp(string sTitle, string sWidth, string sHeight, string newLink)
        {
            string command = "ExecuteOrDelayUntilScriptLoaded(function () {var options = SP.UI.$create_DialogOptions(); options.title = \""+sTitle+"\"; options.width = "+sWidth+"; options.height = "+sHeight+"; options.url = \"" + newLink + "\"; SP.UI.ModalDialog.showModalDialog(options);}, \"sp.js\");";

            Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", command, true);
        }

Sunday, September 25, 2011

Error occurred in deployment step ‘Activate Features’: Object reference not set to an instance of an object.


This just means that some custom EventReceiver code you have written is failing.
Comment out your code and add it in step by step until you discover the problomatic code

Tuesday, September 20, 2011

Add Footer to Master Page

1. Open the v4.master page using SharePoint Designer 2010 and look for:

               DeveloperDashboard
 
2.  Copy and paste the div below into code view of the v4.master page.
 
   <div class="ms-wpselectlink" style="clear: both; padding: 10px; background-color: #FCFCFC; border: 1px solid #DBDDDE;">
&copy; Copyright 2010
<span lang="en-us">Go MCD Technology</span>
</div>
 
3. Be sure the above code is immediately before the line below.
 
<SharePoint:DeveloperDashboard runat="server"/>

Thursday, August 18, 2011

Understanding SharePoint PageLayouts

Page Layouts and their associated File names:


(Article Page) with Body Only                      pagefromdoclayout.aspx
(Article Page) with Image                             Left articlesleft.aspx
(Article Page) with Image                             Right articlesright.aspx
(Article Page) with Summary                        Links articlelinks.aspx
(Redirect Page) Redirect Page                      redirectpagelayout.aspx
(Welcome Page) Advanced Search              advancedsearchlayout.aspx
(Welcome Page) Blank Webparts Page        blankwebpartpage.aspx
(Welcome Page) People Search Results Page peoplesearchresults.aspx
(Welcome Page) Search Page                      searchmain.aspx
(Welcome Page) Search Results Page          searchresults.aspx
(Welcome Page) Site Directory Home          tabviewpagelayout.aspx
(Welcome Page) Welcome Page with Table of Contents weclometoc.aspx
(Welcome Page) with Summary Links          welcomelinks.aspx
(Welcome Page) with Webpart Zones          welcomelayout.aspx
(Welcome Page) with Splash Page               welcomesplash.aspx

Wednesday, July 20, 2011

Using SharePoint 2010 Processing Page in code

For long operations, one could use the following code in order to display the SharePoint's default processing page.

string

{
      operation.Begin();

      //Your Code

      operation.End(comeBackUrl, Microsoft.SharePoint.Utilities.
}
SPRedirectFlags.DoNotEncodeUrl, System.Web.HttpContext.Current, null);

comeBackUrl = SPContext.Current.Web.Url.ToString();using (SPLongOperation operation = new SPLongOperation(this.Page))

Error: Web site worker process has been terminated by IIS

Error Message: The web server process that was being debugged has been terminated by Internet Information Services (IIS), This can be avoided by configuring Application Pool ping settings in IIS

Solution:
In Internet Information Services (IIS) Manager -> Connections pane -> Application Pools -> Advanced Settings -> Process Model section, do one of this:

Set Ping Enabled to False.

Set Ping Maximum Response Time to a value that is larger than 90 seconds.

Monday, July 18, 2011

Activate a feature programmatically

SPFarmFeatureCollection keeps a list of all activated features on a site or site collection.  Those can be accessed using the Features property of SPWeb or SPSite objects.

WebFeatures or SiteFeatures property of SPContext.Current can also be used.

Add() and Remove() methods with the GUID as the arguement would do the work.  One thing to keep in mind here is that if we try to activate an already activated feature using Add(), an InvalidOperationException is thrown.  The only way to check if it is already activated or not is by using indexer and see if an exception is thrown.

SPWeb spCurrentSite  = SPContext.Current.Web;

spCurrentSite.Features.Add(new GUID("{G__U__I__D}"));
(or)
spCurrentSite.Features.Remove(new GUID("{G__U__I__D}"));


In case the GUID is not known, then we would have to chek out for the name in the FeaturesDefinitions collection of the SPFarm Object.

Saturday, July 16, 2011

2nd Interview Experience

Not much this time around.  The role was of a SharePoint Admin.


  1. New features added to SP2010
  2. Difference between BCS and BDCBusiness Connectivity Services (BCS) is the new name for the Busienss Data Catalog technologies from SharePoint 2007. BCS is enhanced in the 2010 release with read/write capabilities, support for Windows Communication Foundation (WCF), and new client capabilities so that you have APIs both on the server and client and can sync Line-of-Business (LOB) data from your backend systems to the client cache and work on that LOB data when offline. BCS will synchronize that data from the client with server when you can reconnect.
  3. Difference between stsadm and PowerShell (Answer is here)  In a nutshell, We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.
More questions were on my experience of working on admin project.  

Friday, July 15, 2011

Understanding WorkFlows

2 Types:

  1. Sequential: has predictable paths of execution
  2. State Machine: has many possible ways of execution as it includes conditions such as While, IfElse, Replicator etc.
When we create custom workflows, we get 5 files in our project:
  1. feature.xml - Contains the definition of the feature that will eventually deploy the WF in the server
  2. workflow.xml - defines the WF
  3. install.bat - contains command line instructions to copy the files to TEMPLATE folder and has stsadm commands to install the WF.
  4. workflow.cs - inherits the base class SequentialWorkflowActivity
  5. workflow.designer.cs


Ways of Deploying WebParts

Manual Way



  1. Copy the assembly DLL to either the bin or to the GAC (needs to strong named)
  2. Copy the DWP File to c:\inetpub\wwwroot\wpcatalog
  3. Copy resource files to C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources for GAC registered Webparts and to C:\Inetpub\wwwroot\wpresources for webparts that are copied to the bin folder
  4. Add SafeControl entries to the web.config

Life Cycle of a WebPart

1. OnInit - Handles the initialization of the webpart

2. OnLoad - Handles the load event

3. CreateChildControls - Creates all the child controls if present

4. EnsureChildControls - Ensures that the CreateChildControls method has been executed

5. OnPreRender - Handles tasks such as data loading etc that need to be completed before the controls are rendered

6. Page.PreRenderComplete - it is fired once the OnPreRender gets executed

7. Render - Renders the entire control

8. RenderContents - Renders the contents

Diff between Microsoft.SharePoint.WebPartPages and System.Web.UI.WebControls.WebParts

Microsoft.SharePoint.WebPartPages provides backward compatibility with the webparts of SharePoint 2003 in MOSS 2007.  In case we plan to create a webpart in MOSS 2007 with nothing to do with the previous versions, it's recommended to use System.Web.UI.WebControls.WebParts.

Types of WebParts

They can be braodly classified in to 2:

1. ASP .NET WebParts: These are built on top of the ASP .NET WebPart Infrastructure.  They need a reference to System.Web.dll and inherit from the webpart base class System.Web.UI.WebControls.WebParts namespace.  These can be used in ASP .NET applications as well as SharePoint sites.

2. SharePoint WebParts:  These need a reference from the Microsoft.SharePoint.dll and must inherit the base class Microsoft.SharePoint.WepPartPages namespace.  These can be used in Sharepoint Sites only.

SPVirtualPathProvider

Further strenghtening our understanding of Ghosting and Unghosting concept posted here - http://sharepointbunker.blogspot.com/2011/02/understanding-site-definitions.html

As already mentioned, Ghosting helpes in maintaining only one version of all uncustomized pages.  For example, every site has a Default.aspx that is not replicated.  Hence saving space and maintains a leaner server.  Imagine the state of the server if every site in the web application had an individual copy of Deafult.aspx saved on the server!!!

So what happens is that the common template of Default.aspx is loaded on to the memory and every site that has an uncustomized version of Default.aspx references to that.

But what happens when a page is customized!!  That cannot be maintained as a common template for all to reference to!!  This is where Unghosting and SPVirtualPathProvider comes in to picture.  The customized page gets unghosted.  It then gets saved to the content database.  And then a virtual path is provided pointing to page in the content database.

How to get Code Snippets to look good on your blogger

Was struggling quite a bit to get the snippets to look readable.&nbsp; Came across these then - http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html and http://formatmysourcecode.blogspot.com/

Quite helpful.

If any one has better ideas, do post them in the comments.

<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>  
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script>  
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script>  
<script language='javascript'>  SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script>

1. Paste it into your Blogger Template just above the </head> tag
2. Save the template
3. Then you can start creating code blocks in your existing or new Blog entries.

There are 2 ways to add a code block using syntaxhighlighter

Method 1: Using the script Tag
<script type=&quot;syntaxhighlighter&quot; class=&quot;brush: csharp&quot;>
<![CDATA[ // Comment
public class Testing {
public Testing() {} 
public void Method() 
{/* Another Commenton multiple lines */int x = 9;}
}]]></script>

becomes
// Comment
public class Testing {    
public Testing() {    
}     

public void Method() {        
/* Another Comment           
on multiple lines */        
int x = 9;    
}
}

Method 2: Using the pre Tag
<pre class="brush: csharp">// Comment
public class Testing {
public Testing() {
} 

public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
}
}
</pre>

becomes
// Comment 
public class Testing {     
public Testing() {     
}       

public void Method() {         
/* Another Comment            
on multiple lines */        
int x = 9;     
} 
}

Check a Parent node and all Child nodes get checked in TreeView using JS

Had this requirement in my project.  Got a great post here - http://pushpontech.wordpress.com/2007/06/06/aspnet-20-treeview-checkbox-checkuncheck-all-script/  and http://forums.asp.net/t/1367074.aspx

function OnTreeClick(evt){
var src = window.event != window.undefined ? window.event.srcElement : evt.target;
var isChkBoxClick = (src.tagName.toLowerCase() == “input” && src.type == “checkbox”);
if(isChkBoxClick)
{
var parentTable = GetParentByTagName(“table”, src);
var nxtSibling = parentTable.nextSibling;
//check if nxt sibling is not null & is an element node
if(nxtSibling && nxtSibling.nodeType == 1)
{
if(nxtSibling.tagName.toLowerCase() == “div”) //if node has children
{
//check or uncheck children at all levels
CheckUncheckChildren(parentTable.nextSibling, src.checked);
}
}
//check or uncheck parents at all levels
CheckUncheckParents(src, src.checked);
}
}
 function CheckUncheckChildren(childContainer, check)
{
var childChkBoxes = childContainer.getElementsByTagName(“input”);
var childChkBoxCount = childChkBoxes.length;
for(var i=0;i<checkBoxCount;i++)
{
childChkBoxes[i].checked = check;
}
}
function CheckUncheckParents(srcChild, check)
{
var parentDiv = GetParentByTagName(“div”, srcChild);
var parentNodeTable = parentDiv.previousSibling;
if(parentNodeTable)
{
var checkUncheckSwitch;
if(check) //checkbox checked
{
var isAllSiblingsChecked = AreAllSiblingsChecked(srcChild);
if(isAllSiblingsChecked)
checkUncheckSwitch = true;
else
return; //do not need to check parent if any(one or more) child not checked
}
else //checkbox unchecked
{
checkUncheckSwitch = false;
}var inpElemsInParentTable = parentNodeTable.getElementsByTagName(“input”);
if(inpElemsInParentTable.length > 0)
{
var parentNodeChkBox = inpElemsInParentTable[0];
parentNodeChkBox.checked = checkUncheckSwitch;
//do the same recursively
CheckUncheckParents(parentNodeChkBox, checkUncheckSwitch);
}
}
}function AreAllSiblingsChecked(chkBox)
{
var parentDiv = GetParentByTagName(“div”, chkBox);
var childCount = parentDiv.childNodes.length;
for(var i=0;i<childCount;i++)
{
if(parentDiv.childNodes[i].nodeType == 1)
{
//check if the child node is an element node
if(parentDiv.childNodes[i].tagName.toLowerCase() == “table”)
{
var prevChkBox = parentDiv.childNodes[i].getElementsByTagName(“input”)[0];
//if any of sibling nodes are not checked, return false
if(!prevChkBox.checked)
{
return false;
}
}
}
}
return true;
}

Tuesday, April 26, 2011

Retrieving deleted files from Recycle Bin

Understanding SharePoint Recycle Bin

Nice Read: http://weblogs.asp.net/jimjackson/archive/2007/10/03/sharepoint-recycle-bin-administration.aspx

Sharepoint Recycle Bin Administration

The recycle bin in Sharepoint is a 2-stage operation where the user can delete content and get it back for a configurable amount of time and then an administrator can get it back for a configurable frame after that.

User Level Recycle Bin

The first and most simple operation is just to click on the recycle bin link in the corner. Go to the list or content area where you deleted the item and click on the link. You should see the item if it hasn't exceeded its retention expiration date.

Administrative Level Recycle Bin (Site Collection Level)

If your item is not in the recycle bin or you can't find it in your content, ask an administrator to pull it from the site collection recycle bin.
To do this, click on Site Actions in the top right corner of the site and select Site Settings --> Modify All Site Settings.

On the next page, select the Recycle Bin link.

You can now select either all user's recycle bin items or the items that have been deleted from the user recycle bin.

Administering the Recycle Bin Retention Policies

So all the documentation talks about how an adminsitrator can change the retention policy for both the entire server and all users so lets look at how to do that.
Start by going to Administrative Tools in Windows. Select SharePoint 3.0 Central Administration. This opens the admin web site.
Select the Application Management tab.

Now, in the SharePoint Web Application Management section, click on Web application general settings.

Scroll all the way to the bottom of the next page and find the place to edit your Recycle Bin settings for the server.

You can turn off the recycle bins (not recommended), change the user level or the admin level recycle bin settings and then save your new values.

Saturday, April 9, 2011

Programming Sharepoint(MOSS 2007): Sharepoint Interview Questions

Sharepoint Interview questions

My First Interview Experience :-p

After Campus that is...

DotNet:


  1. Different Types of Inheritance
  2. How to implement Hydrid Inheritance in c sharp
  3. Can Getter and Setter Methods have different Access Modifiers.  Meaning, Get has, say, Public and Set has Private
  4. What's a CLR
SharePoint:
  1. What is WSS
  2. Differences between WSS and MOSS
  3. What are the classes used in Custom WebPart creation
  4. VirtualPath Concept in MOSS.  How a request is handled
  5. Asked about InfoPath, Excel Services, Custom WF's to which I said Pass :)
DataBase:
  1. What are Triggers, Cursors
  2. Difference between Functions and Stored Procedures
  3. Normalization, Different types, Why it's needed

Friday, April 8, 2011

Building WSP in SharePoint

Farm Architecture

Web Part description(.dwp) file

A Web Part description file is an XML text file with the extension .dwp. It can contain the following:
  • Property names and settings for the instance of this Web Part.
  • A reference to its companion Web Part assembly file (.dll).
  • If a user has personalized a Web Part, changes to any common and custom property settings
When Windows SharePoint Services is first installed, a Web Part description file is often stored in the Site Web Part Gallery. Other instances of this Web Part description file are created over time as users export Web Parts, and as site administrators upload and download Web Parts.

Thursday, April 7, 2011

SharePoint Site Owner Tip: Restrict the number of versions for documents

Source: http://www.modery.net/1_moderynet_--_share-manage-govern/archive/648_sharepoint_site_owner_tip_restrict_the_number_of_versions_for_documents.html

One of the great features of SharePoint is the possibility to keep previous versions of documents and list items. This makes it easy to see who modified what when, and to also have a look back to see what was changed. Furthermore, you can also easily restore previous versions if required.
PROBLEM
The problem with versions, however, is that if you allow an unlimited amount of versions you risk that you require a lot more storage space for all these versions. To give an example: Let's say you store one document with a size of 100KB and you allow unlimited versions (Major versions only). People start to make changes, and after a while you have reached version 50. Assuming that the document still has the same size (to simplify calculations here), that would mean that this single document now uses 50 x 100KB = 5,000KB = 5MB. While 5MB doesn't sound like much, think about how many documents there are on your site, or even on your whole intranet, and what the possible impact is if unlimited versions are allowed for all of them!
SOLUTION
After you have identified a library for which versions are required, the next step is to find out how many versions are required actually. There may be cases where it is important to keep all previous versions, but usually you will rather only need to keep a few of them. For example, it may sometimes be required to be able to revert back to only the last version that existed before changes were made to a document. You could then set the restriction to 2 versions only, however this might mean that if someone saves a document twice within a short time frame you won't be able to restore the "original" document from before these changes. A number of 5 versions may be a better and slightly safer choice here.
To activate versioning, first go to the corresponding library's settings, and then follow the Versioning [[check]] link. In the section Document Version History, select either Create major versions or Create major and minor versions. Afterwards, tick Keep the following number of major versions and Keep drafts for the following number of major versions respectively and enter the appropriate numbers.

Monday, March 28, 2011

Troubleshoot upgrade issues (SharePoint Server 2010)

Sandboxed Solutions

LINQ to SharePoint

What's New: Client Object Model

http://msdn.microsoft.com/en-in/library/ee535231(office.14).aspx

Microsoft SharePoint Foundation 2010 introduces three new client APIs for interacting with SharePoint sites: from a .NET managed application (not earlier than Microsoft .NET Framework 3.5), from a Microsoft Silverlight application (not earlier than Silverlight 2.0), or from ECMAScript (JavaScript, JScript) that executes in the browser. These new APIs provide access to a subset of the types and members that are contained in the Microsoft.SharePoint namespace of the server-side object model.

The new client object models provide an object-oriented system for interoperating with SharePoint data from a remote computer, and they are in many respects easier to use than the already existing SharePoint Foundation Web services. You start by retrieving a client context object that represents the current request context, and through this context, you can obtain access to client objects at site-collection level or lower in the SharePoint Foundation hierarchy. Client objects inherit from the ClientObject class (ECMAScript: ClientObject), and you can use them to retrieve properties for a specific SharePoint object, to retrieve child objects and their properties, or to retrieve child items from a collection.

Using SharePoint Designer for SharePoint Development

Creating SharePoint Solution Packages in VS 2010

What's New in SharePoint Foundation 2010

Upgrading MOSS 2007 to SharePoint Server 2010

Upgrade and Migration for SharePoint Server 2010

SharePoint Server 2010 Virtual Labs

SharePoint 2010 Architecture Overview

Saturday, March 12, 2011

Understanding SharePoint Architecture

  Source:

  1. http://media.techtarget.com/searchSAP/downloads/05_Jamison_ch04.pdf
  2. http://msdn.microsoft.com/en-us/library/bb892189(v=office.12).aspx 

Operating System
MOSS 2007 is built on top of WSS 3.0, which, in turn, is built on top of the technologies and services provided by Microsoft Windows Server 2003.  The core platform services use the Microsoft .NET 2.0 Framework. This combination of Windows and .NET provides SharePoint the following technologies:


  • Internet Information Services 6.0 (for hosting Web applications)
  • ASP.NET 2.x and above master pages, content pages (Web part pages), Web parts, personalization, membership, and navigation
  • Windows Workflow Foundation (part of .NET 3.0)

Database Services
Microsoft SQL Server (either SQL 2000 SP4 or SQL 2005) is the relational database used for storing all content, data, and configuration information used by Office SharePoint Server 2007. Yes, that means that all content (including large documents) is stored in the database and not as files in the file system. Other relational databases, such as Oracle or MySQL, do not work and are not supported. If a separate database is not specified during installation, a specialized version of SQL Server 2005 Express is installed locally. The SharePoint-specific version of SQL Server 2005 Express has a database limit of 4GB and cannot be managed directly by SQL Enterprise Manager. For this reason, most organizations install MOSS in a farm configuration and specify a separate SQL Server machine for the database server.


Windows SharePoint Services
Windows SharePoint Services 3.0 builds on the operating system and database services to add additional features, such as team sites and collaboration features. Specifically, WSS 3.0 provides the following platform
capabilities:

  • Storage. Through content databases, which are literally SQL databases managed by SharePoint to accommodate the pages, data, and documents stored in the various portals, team sites, and workspaces
  • Management. Administration pages with deep configuration options
  • Deployment. Web farms, physical servers, and roles
  • Site Model. Web application, site collection, and sites
  • Extensibility. Features, Web parts, and templates

    
WSS provides more than just these core technology services. Microsoft decided to make WSS a powerful application out-of-the-box and thus provides the core collaboration features for MOSS:

  • Document collaboration—check-in/out and versions
  • Wikis and blogs
  • RSS support
  • Project task management (lightweight functionality, which should not be confused with Office Project Server 2007, also built on WSS 3.0)
  • Contacts, calendars, and tasks
  • E-mail integration
  • Integration with Office client applications



Basically, Windows SharePoint Services is the solution that enables you to create Web sites for information sharing and document collaboration.




Office SharePoint Server 2007: Applications and Services

Office SharePoint Server is built on top of WSS to provide a few additional capabilities such as: 


  • Portal. Templates, people, audience targeting
  • Search. Search center, cross-site search
  • Content management. Authoring, publishing, records management
  • Business process. Forms server, line of business (LOB) integration
  • Business intelligence. Excel services, Key Performance Indicator (KPI) lists, Report Center (not to be confused with Business Scorecard Manager and Office PerformancePoint Server 2007, which both provide additional BI capabilities)





Shared Services


Shared services provide the features that are used by multiple applications in MOSS 2007. What does that mean? Let’s use an example—user profiles.  You might want to use the user profile feature, which provides an out-ofthe-
box employee directory, including basic information (name and phone number, for example), along with some custom properties and a photograph.  You might also want to create several different portals within your
organization—for example, an Internet presence, an employee intranet site, and a collaboration portal for self-service team site use. You wouldn’t want to create and manage three separate profile databases. In this case,
the user profile service can be shared across the various portals—hence a shared service. Specifically, the following features are provided by shared services in MOSS 2007:



  • User profile store
  • Audiences
  • Search services
  • Usage reporting
  • Excel services
  • Business Data Catalog (BDC)
  • Notification service for generating alerts
  • Single sign-on services


So what exactly do shared services support? They support the fundamental element of SharePoint: sites. Some of a site’s services are site-specific, while others are shared and provided by a Shared Services Provider (SSP)


Sites and Site Collections



At the highest level, you have a physical server running Internet Information Server (IIS). Within IIS, you have a Web application, which maps to a URL (such as http://myportal), a port (such as 80), and an IP address (such as
192.168.1.4). Once a Web application is extended with SharePoint functionality, one or more top-level sites can be created. Each top-level site can contain one or more child sites. The collection of sites that includes a toplevel
site and all of its descendants down to the leaf site(s) is called a site collection. This is important given that much of SharePoint administration (quotas, backup and restore, permissions, Web part access, and so on) is based on the site collection concept.


A site collection is a hierarchical set of sites that can be managed together. Sites within a site collection have common features, such as shared permissions, galleries for templates, content types, and Web parts, and they often share a common navigation. All sites in a site collection are stored together in the same SQL database. A portal site is often implemented as a site collection with the top-level Web site as the portal’s homepage.




some features do not work
 
Content Types. How common documents, forms, and other content are normalized in your organization.
Content by Query Web Part. This Web part aggregates information from across sites but does not work across site collections.
Workflow. When you deploy workflow, it is accessible only within the site collection it is deployed in.
Information Management and Retention Policies. Records management policies are set at the site collection level, forcing organizations to deploy the same policy multiple times for large enterprises.
Quotas. You should absolutely define quotas so that users are used to limited storage from day one; also configured at the site collection level, which means that you will need to configure quotas separately at each top-level site.


IIS Web Sites and Virtual Directories

Both ASP.NET and Windows SharePoint Services rely on IIS 6.0 to supply the underlying listening mechanism to process incoming HTTP requests and supply a management infrastructure for launching and running worker processes on the Web server. Your understanding of how all of the pieces fit together should start with the basic concepts of an IIS Web site and virtual directories.

An IIS Web site provides an entry point into the IIS Web server infrastructure. Each IIS Web site is configured to listen for and process incoming HTTP requests that meet certain criteria. For example, an IIS Web site can be configured to handle requests coming in over a specific IP address or port number or can be routed to the Web server by using a specific host header, such as http://extranet.litwareinc.com/.

IIS automatically creates and configures an IIS Web site named Default Web Site that listens for HTTP requests coming in over port 80 on any of the IP addresses supported on the local Web server. It is also possible to create and configure additional IIS Web sites by using the IIS Administration tools.

Each IIS Web site defines a specific URL space. For example, the standard Default Web Site defines a URL space to handle any incoming request whose URL maps to the following pattern: http://www.Litwareinc.com/*. As you can imagine, an unlimited number of URLs can be created within this URL space. IIS processes incoming requests targeted to one of these URLs by routing them to the Default Web Site.

Each IIS Web site is configured to map to a root directory, which is a physical directory on the file system of the hosting Web server. For example, standard configuration for IIS maps the Default Web Site to a root directory located at C:\Inetpub\wwwroot. In the most straightforward routing scenarios, IIS maps incoming HTTP requests to physical files inside the root directory. For example, IIS will respond to a request for http://www.Litwareinc.com/page1.htm by simply loading the contents of the file located at c:\Inetpub\wwwroot\page1.htm into memory and streaming it back to the client.

One important aspect of an IIS Web site is that it controls whether incoming requests require authentication and, if so, which authentication protocols to use. For example, the Default Web Site might be intended as a public-facing Web site for Internet users. As such, it might be configured to allow anonymous access and to support Basic Authentication. A secondary IIS Web site intended exclusively for employee use within the corporate LAN might be configured to disallow anonymous access and to support Integrated Windows Authentication instead of Basic Authentication.

In addition to IIS Web sites, IIS supports the creation and configuration of virtual directories. A virtual directory is an entity that defines a child URL space nested within the URL space of its parent IIS Web site. Like an IIS Web site, a virtual directory is configured with a root directory on the file system of the hosting Web server. IIS provides the flexibility of defining the root directory for a virtual directory at any location. For example, you could create a virtual directory within the Default Web Site with a URL space such as http://www.Litwareinc.com/Sales. When you create this virtual directory, you can configure its root directory as a file system directory such as C:\WebApps\Site1.

Notice that IIS tracks configuration information about its IIS Web sites and virtual directories in a repository known as the IIS metabase. The IIS metabase lives on the file system of each front-end Web server running IIS. For example, when you create and configure an IIS Web site using the IIS administration utility, IIS tracks these changes by writing entries to the local IIS metabase.





Search. Certain features of search are configured at the site collection level.
across site collections. This is important because a large deployment of SharePoint will dictate multiple site collections. The following features do not work across site collections:

Wednesday, February 23, 2011

All about Feature.xml

Understanding Scope of a Feature

 Courtesy/Reference/Credits:

SharePoint Features can be scoped to the Farm, Web Application, Site Collection, and Web Site level depending on the purpose of the feature. The Feature scope is determined by the setting of the Scope attribute in the Feature element defined in the feature.xml file.
A sample Feature element tag is given below:
<Feature Id="F62C96CF-79FD-44be-8882-E9BFBD199184" 
    Title="Feature Title" 
    Description="Feature Description" 
    Version="1.0.0.0" 
    Scope="Site" 
    Hidden="false"> 
</Feature> 


Web Site scoped Feature (Scope="Web"):
A Web Site scoped Feature is one that can be activated only at the individual Web site level. List templates, list instances, custom actions, event receivers, etc are the some common elements for web site scoped features. Web Site scoped features can be activated by using one of the following two methods:
  • Run the following STSADM command:
    stsadm -o installfeature -name FeatureFolderName –url http://servername/site/subsite

  • Open the Site Features page in the SharePoint site (Site Actions -> Site Settings -> Modify All Site Settings -> Site Features) and click the Activate button.

Site Collection scoped Feature (Scope="Site"):
A Site Collection scoped Feature is one that can be activated at the site collection level and contains items that apply to the site collection as a whole (for example, content types that are shared across the site collection), as well as items that can be activated per site (for example, list instances, etc). Site Collection scoped features can be activated by using one of the following two methods:
  • Run the following STSADM command:
    stsadm -o installfeature -name FeatureFolderName –url http://servername/site/sitecollection

  • Open the Site Features page in the SharePoint site (Site Actions -> Site Settings -> Modify All Site Settings -> Site Collection Features) and click the Activate button.

Web Application scoped Feature (Scope="WebApplication"):
A Web Application scoped Feature is one that can be activated at the web application level and contains items like administrative web application links, delegate control registrations, feature/site template association, document form registrations, etc. A farm Feature can contain, for example, links to /_layouts pages and files, /_admin pages, and other elements. Web Applicationscoped features can be activated by using one of the following two methods:
  • Run the following STSADM command:
    stsadm -o installfeature -name FeatureFolderName -url http://servername

  • Open the "Manage Web Application Features" page in the Central Admin application (SharePoint Central Administration -> Application Management -> Manage Web Application Features) and click the Activate button.

Farm scoped Feature (Scope="Farm"):
A Farm scoped Feature can be activated at the server farm level. A farm Feature contains a number of elements that are critical for implementing applications and logic anywhere within a deployment. A farm Feature can contain, for example, links to /_layouts pages and files, /_admin pages, and other elements. Farm scoped features can be activated by using one of the following two methods:
  • Run the following STSADM command:
    stsadm -o installfeature -name FeatureFolderName

  • Open the "Manage Farm Features" page in the Central Admin application (SharePoint Central Administration -> Operations -> Manage Farm Features) and click the Activate button.
Note: Farm scoped feature is activated automatically once it is installed on the server farm.


SharePoint Element Types for Features:
The following table describes various element types for Features and shows their possible settings for scope.

Element Description Scope
Content Type Contains a schema definition you can reuse and apply to multiple list definitions.
Site
Content Type Binding Content type binding enables you to provision a content type on a list defined in the Onet.xml schema. Lists defined in the Onet.xml schema cannot be modified directly.
Site
Control A delegate control contains a registration for a well-known control installed on a Web page. This lets you replace existing controls, such as the Windows SharePoint Services search control, with another control.
Farm, WebApplication, SiteWeb
Custom Action You can define the following kinds of custom actions:
·         Content type links for the content type settings page
·         Drop-down menu actions for the drop-down menu that appears for an item
·         Form toolbar buttons for New, Edit, or Display form toolbars.
·         Site Settings link for the Site Settings page.
Farm, WebApplication, SiteWeb
Custom Action Group Defines a group of custom actions.
Farm, WebApplication, SiteWeb
Document Converter Contains the definition of a document converter. A document converter is a custom executable file that takes a document of one file type, and generates a copy of that file in another file type.
WebApplication
Feature/Site Template Association Binds a Feature to a site definition configuration so that created sites are provisioned with the Feature.
Farm, WebApplication, Site
Field Contains a field definition that can be reused among multiple lists.
Site
Hide Custom Action Hides a custom action that has been added through another custom action.
Farm, WebApplication, SiteWeb
List Instance Provisions a SharePoint site with a specific list of data.
SiteWeb
List Template Contains a list definition or template, which defines a list that can be provisioned in a SharePoint site.
SiteWeb
Module Contains a set of files with which to provision sites.
SiteWeb
Receiver Contains an item event receiver registration.
Web
Workflow Contains the definition for a workflow in a list.
Site

Understanding Features

Features are mainly used for deployments of Site Columns, Content Types, Web Parts etc.

Features can be deployed at the following scopes:
  • Farm
  • Web Application
  • Site Collection
  • Web (Site)
Feautres allow the administrators to install/uninstall components/functionality with ease.  Basically provides plugable attribute to the components of SharePoint.

They reduce the complexity of customizations in SharePoint site.

Location: C:\Program Files/Common Files/Microsoft Shared/Web Server Extensions/12

Each feature must contain one manifest file name Feature.xml which defines the high level attributes of the feature such as Title, Description, Scope etc.  The feature can contain any number of supporting files such as aspx, css etc.

In an Onet.xml file, the Feature element is used within a site definition configuration to contain a reference to a Feature instance and default property values. The Configuration element specifies lists and modules to use when creating SharePoint sites. For information about the format and elements used in site definitions, see Site Schema.
SharePoint Foundation activates Features specified within the Onet.xml file in the order that they are listed. Consequently, you must specify Features that are depended upon before Features that depend upon them.


Courtesy/Reference/Credits: