Showing posts with label MOSS. Show all posts
Showing posts with label MOSS. Show all posts

Wednesday, December 9, 2009

MOSS Governance considerations

Here are some of my key deployment considerations to governance & management.

  • Quota - to encourage storage management, if not manage your disk space and search relevancy
  • Usage Policies - what is ok, SharePoint Designer, Custom web parts, SQL data sources in dataviews, what types of sites do you provision, who can own a site?
  • Data/Site Retention policies - How long does data that isn't accessed or categorized or even used for a couple of years stick around?
  • Web Part/Development policies - Ownership, support, deployment?
  • Meta Data Capture & Content Types - How can you get the best data out of your users?
  • Managed Approach to deployment (top down) - What is our enterprise search story, what is our browse, site map and site directory story... What do the departments in my company use for aggregation?
  • Self Service approach to deployment (bottoms up) - how can I keep Help desk from being a bottleneck to information worker productivity
  • Montoring Plan - Is there a 24/7 plan with a MOM console? What application packs or web services verifications and synthetic transactions for verifiying uptime.
  • Global Considerations - Shared Services, WAN and end user performance levels, enteprise search considerations
  • Cost Model or Charge Back Model for recapture of IT Costs - who pays for all this?
    Solutions Deployment packaging best practices and rules to live by - How can we consistently deploy web parts, site definition changes
  • Branding - how can we consistently have a good experience for our end users and keep the sense of company ownership
  • Stakeholder and ownership - who should be involved in these decisions
  • SSP Delegation models - Who owns Search and relevancy (best bets), who owns the profiles (company directory), who owns the BDC (business data catalog) connections to our SAP, who get's safe locations for Excel published charts, spreadsheets
  • Operational & Service SLAs -
    Backup and Restore/Recovery & Business Continuance SLAs
    Uptime
    Downtime windows
    Performance SLAs
  • Communications plan - who do we communicate to, when and how often and what? Is there a Communications website where we communicate this list of info?
  • End User Education Plan - Is there an FAQ, training materials, brown bags, web sites?

I recommend going through this list, and adding more of your own, then building a governance worksheet or "Green book" that helps bring the stakeholders together.

~ Gangadhar Kotu

Features of MOSS 2010

SharePoint 2010 is the business collaboration platform for the Enterprise and the web that enables you to contact and empower people through an integrated set of rich features. SharePoint 2010 helps you cut costs with a unified infrustructure while allowing you to rapidly respond to business needs.
Features of the new SharePoint 2010
  • New User Interface including the new Ribbon - A streamlined new user interface including the Ribbon is an intuitive and contextual web user interface that makes users more effective. reduces training, provides better performance and lowers cost.
  • Web Edit - Web Edit allows users to easily customize a site, making it possible to respond more quickly than ever to changes in your dynamic business environment.
  • Silverlight Web Part - The Silverlight Web Part allows you to fully integrate Silverlight applications within your SharePoint site for a more interactive user experience.
  • Rich Theming - Combined with Web Edit, rich theming allows you to skin your SharePoint site using your favorite office client themes. Change the colors and fonts to customize just as you like it.
  • Multiple Browser Support - SharePoint 2010 will now support not only MS Internet Explorer, but now FireFox and Safari will also be fully supported.
  • Visio Services - Visio will now be fully supported. You can link diagrams in real time, with high-fidelity in a consistant matter so that everyone can stay up to dat. Even those who do not have Visio.
  • New SharePoint Designer - SharePoint Designer comes with a new User Interface with enhanced modeling capabilities and improved workflows.
  • Business Connectivity Services (The Business Data Catalog) - Business Connectivity Services (BCS) allows you to connect to Line-of-business applications, web services and databases in a user friendly way enabling users to interact and update it easily in both web and office clients.
  • SharePoint Workspace - Formally named Groove, SharePoint Workspace is a rich client for SharePoint that lets you take your SharePoint lists and libraries off-line, including the ability to update content and sync it back when you re-connect.
  • Rich Media Support - Silverlight and PowerPoint presentation capabilities are easily integrated with the new SharePoint 2010. Your information and presentations will come to life in new and dynamic ways with ShjarePoint 2010.

Tuesday, September 29, 2009

SharePoint Disaster Recovery

It’s Sunday night, and you just got an urgent call from the office: Your Microsoft SharePoint server is down. After some investigation, you find that the disk array in your only front-end web server is dead. You groan, wishing that you'd implemented a complete farm backup from within SharePoint. However, all is not lost. You know that SharePoint stores all its content in a separate SQL Server machine, and that server is fine. You spring into action, trying to get the environment back up before Monday morning. You ask yourself, What steps do I take? What settings will I lose? Will I get any sleep tonight?
This article will answer these questions and more. The recovery I discuss is based on the two-server farm I've mentioned, but the principles also apply to larger farms. The first (crashed) server is running all your SharePoint services (or roles), and the second server is a dedicated SQL Server system. For the purposes of this article, I'm assuming that you're running Microsoft Office SharePoint Server (MOSS) 2007, but most will also apply to Windows SharePoint Services (WSS). I also assume you’re using Windows authentication and Active Directory (AD). Of course, your environment is likely to vary in some way, so these steps won't be applicable to all situations. Toward the end of the article, I’ll also provide you with some recovery recommendations that you can use today to better protect your SharePoint investment.

Recovery Overview

SharePoint stores all content and most of its configuration in SQL Server databases. However, some configuration settings are stored only in Microsoft IIS and various web.config files. Custom code is often stored within the 12 Root (by default, C:\Program Files\Common Files\Microsoft Shared\web server extensions\12) or the global assembly cache. As you’ll see, performing only a SQL Server backup isn't enough to ensure a smooth farm recovery. Perhaps the most significant drawback is that even with many configuration settings stored in a configuration database, this is not recoverable without a SharePoint-based farm backup. (To learn more about SharePoint farm backups, see "Back up a farm by using built-in tools " at technet.microsoft.com/en-us/library/cc263298.aspx.) Nonetheless, you still have recovery options, so let’s start by reviewing what you'll need.

Assess Your Inventory

Let’s review the items you’ll need to proceed with your recovery. Here are the primary items you should identify:

  • You’ll need all your content databases (not including the one for central administration), your Shared Services Provider (SSP) service database, and your search database. All other databases will be re-created.
  • Identify your web applications and the settings that were in use. This should include your portal web application(s), your SSP web application, and your MySites web application, if applicable. Ensure that you know which content database(s) each web application was using. This is a critical reason why basic documentation for your SharePoint environment is so important. If you don’t know or have this, try to remember and document as much as you can; during the recovery, you might experience some trial and error to fit everything back together.
  • Determine your farm's build version, which will tell you what service packs or other updates that have been applied. To get this information when your farm is down, open a query window on your SQL Server system. In the SharePoint config database, run a Select * From Versions command. In the results window, look for the highest value in the version column. Common build numbers are 12.0.0.4518 Original release (RTM), 12.0.0.6219 SP1, 12.0.0.6318 Infrastructure Update, and 12.0.0.6421 SP2.
  • Identify the SharePoint domain service accounts and passwords that were in use. If you’re uncertain what accounts you have, you can obtain them from your SQL Server system's Logins folder. (Note that you might have other login accounts in addition to SharePoint, and you’ll also need to specify which account is used for which service.) If you don’t know the passwords, you can reset them in AD. Here are the domain accounts and a naming convention I often use: setup/admin account (MOSS.Admin); server farm account, aka the database access account (MOSS.Farm); application pool accounts (MOSS.PortalAppPool, MOSS.SSPAppPool); SSP Service account (MOSS.SSPService); Farm Search Service account (MOSS.Search); and Crawler account (MOSS.Crawler).
  • Identify the SharePoint domain service accounts and passwords that were in use. If you’re uncertain what accounts you have, you can obtain them from your SQL Server system's Logins folder. (Note that you might have other login accounts in addition to SharePoint, and you’ll also need to specify which account is used for which service.) If you don’t know the passwords, you can reset them in AD. Here are the domain accounts and a naming convention I often use: setup/admin account (MOSS.Admin); server farm account, aka the database access account (MOSS.Farm); application pool accounts (MOSS.PortalAppPool, MOSS.SSPAppPool); SSP Service account (MOSS.SSPService); Farm Search Service account (MOSS.Search); and Crawler account (MOSS.Crawler).
    Identify any third-party applications and SharePoint Solutions (.wsp files) that will need to be reinstalled.
  • Identify the new physical or virtual server that you'll use as your front-end web server.
  • Ensure that you have your MOSS installation media and license key.

Recovery Steps

Now that you’ve made an inventory of all the necessary components, let’s proceed with the suggested recovery steps. (When you're entering the service accounts in the steps below, I recommend that you precede the accounts with the domain name—for example: domain\MOSS.Farm.)

  1. Install the original OS version on your new server, and don’t be tempted to upgrade the OS at this point. It’s technically possible but adds another level of complexity to your recovery effort. Keep all other settings (e.g., server name, IP address) the same, if possible.
  2. Add the MOSS.Admin account to the local administrators group on the new server. Make sure this account also has logon permissions to your SQL Server system and is a member of the Sysadmin server role.
  3. Remove the previous computer account from AD, join the new server to the domain, and reboot.
  4. Install IIS.
  5. Install the same .NET Framework version that you had on the previous server. At a minimum, this would be version 3.0. If you don’t know, install the latest version, which is version 3.5 SP1, as of this writing.
  6. Install MOSS. Start by logging on as your administrative account (MOSS.Admin). Run the MOSS setup program from your installation media. As with all SharePoint installations, the recommendation is to use the Advanced and then Complete options. These options give you the most flexibility, letting you have this SharePoint server run any roles needed (e.g., Web Application, search) You can install a slipstreamed version provided it isn’t newer than the build you had previously.
  7. Before creating the farm, install all updates to match your previous build version. When doing this, make sure you apply the individual WSS update first and the MOSS update second. For example, to get to build 6318, install in this sequence: WSS SP1, MOSS SP1, WSS Infrastructure Update, MOSS Infrastructure Update. After each update, the SharePoint Products and Technologies Configuration Wizard will start. When it does, simply cancel it.
  8. Once you've applied the updates, you’re ready to create the server farm. Start by launching the SharePoint Products and Technologies Configuration Wizard, which you can access in the Microsoft Office Server group on the Start menu. When prompted, create a new server farm. Next, specify the name of your SQL Server system and the name of your SharePoint config database. If you're using the same database name that you used in your old farm, you must delete the old database first. For the username, enter the name of your server farm account (MOSS.Farm). Click Next, then enter the desired port for the Central Administration Web application and set the proper form of authentication (i.e., NTLM or Kerberos). When you see the summary screen, review it and click Next to create the farm.
  9. Start the Search service. After the farm is created, the Central Administration web site should automatically appear. If the system prompts you to log on, use your MOSS.Admin credentials. To start the search service, first go to the Operations tab and choose Services on server. In the list of services, click Start next to Office SharePoint Server Search. In the resulting dialog box, select both check boxes at the top to make the server an index and query server. For the Farm Search Service Account, enter the appropriate account (e.g. MOSS.Search).
  10. Start any additional services that are in use, such as Excel Calculation Services. For MOSS, you might not need the WSS Search service because it’s used only to index the Help collection.
  11. Re-create each of your Web applications. You’ll need to do this for your SSP Web application, your MySites Web application (if applicable), and each additional Web application that your farm was using. For each one, follow these steps: Go to the Application Management tab, choose Create or extend Web application, then select Create a new Web application. Enter the port and host header. In most cases, you can keep the path as the default. If this web application was using SSL, specify that here. Enter the application pool credentials. In most cases, each web application should use a separate application pool with unique credentials. For example, for the SSP web application, you would use a logon such as MOSS.SSPAppPool. Finally, and most important, enter the name of your SQL Server system and one of the content databases used for this web application. SharePoint will recreate this website in IIS, register it in the new config database, and link it to your existing content database. If you previously extended any of your Web applications (e.g., configured an intranet for extranet access), you should reapply this now.
  12. Associate remaining content databases with your web applications. This step is necessary only if you have multiple content databases for your web applications. Go to the Application Management tab, access Content databases, and select Add a content database. Ensure that you've selected the correct web application at the top, then specify each additional database name.
  13. Restore your SSP. In navigation menu on the left inside Central Administration, click Shared Services Administration, then Restore SSP. For SSP Name, enter in the name of your SSP such as SharedServices1. For Web application, select the Web application that you just created for your SSP. If you were using a separate Web application for My Sites, clear the use existing location check box. If you get warnings here, just acknowledge them and then select the Web application used for My Sites. Next, enter in the SSP Service Credentials (e.g. MOSS.SSPService). Enter in the name of the SSP Database and then the name of the Search Database. Finally, set the desired folder for the index file location. This should be on a drive letter that has plenty of space, so the C: default is not usually a good choice.
  14. Reset IIS. The easiest way to do so is to click Start, Run, and type iisreset.
  15. Reinstall any third-party applications or SharePoint Solutions. These can include custom IFilters (e.g., to index PDF files), custom web parts, and so on. For more information about SharePoint Solutions, see the "Solutions Overview" at msdn.microsoft.com/en-us/library/aa543214.aspx.
  16. Apply any additional configurations. This is the most problematic area because SharePoint changes might occur in a number of ways. Here are some common areas where you might need to make modifications: alternate access mappings (AAM), web.config changes to your web applications, code deployed to bin folders or global assembly cache, IIS settings (e.g., reloading and binding your SSL certificate), changes to 12 Root (e.g., Features or Site Definitions), web application policy settings, and incoming/outgoing email—in general, anything on the Operations tab in Central Administration.
  17. Issue a full crawl of all your content sources, which will recreate SharePoint’s search index. Because your index files were lost on the old server, you must re-crawl. Within your newly restored SSP, click Search settings, then Content sources and crawl schedules. For each content source, select Start Full Crawl from the context menu. Depending on the amount of content, the full crawl can take from minutes to days to complete.
  18. Last, but definitely not least, fully test your SharePoint websites to validate your work. Errors could range from minor web-part problems on pages to full sites not displaying at all. The cause of errors is most likely configuration settings or missing files.

Recommendations

As you can see, not having a SharePoint-specific backup makes the recovery process much more painful, and you run the real risk of ending up with one or more inoperable components. Here are some recommendations that can mitigate this risk and ensure that your recovery is quick and easy.

  • Perform regular SharePoint-specific farm backups. You can do this manually through Central Administration (on the Operations tab, select Perform a backup) or by using the stsadm.exe command-line utility. One advantage to stsadm.exe is that you create a Windows scheduled task to run on a recurring basis. Here's the basic syntax for a full farm backup using stsadm.exe: stsadm -o backup -directory -backupmethod full
  • You must run this command from one of your SharePoint servers, preferably running as your SharePoint admin account. Also, the service account running the MSSQLServer service on your SQL Server system must have Modify permissions to this UNC share and the underlying NTFS folder.
  • Because a farm backup doesn’t include everything, you should also back up your inetpub\wwwroot folders, your 12 Root folder hierarchy, and IIS (for Windows Server 2003, use iisback.vbs; for Windows Server 2008, use appcmd.exe.)
  • For more powerful and granular recovery options, consider third-party backup software such as AvePoint's DocAve, a popular and respected app.
  • When you upgrade the farm (e.g., install SP2), perform a farm backup before and after the upgrade. Creating a backup following an upgrade is recommended because you'll now be at a newer build and previous backups are more difficult to restore.
  • Maintain a configuration change log. This can be a simple document that describes the updates that were made to the farm—for example, upgrading to SP2, installing a custom application, or manually changing a web.config setting. For obvious reasons, don't store this file in SharePoint.
  • For environments that can’t afford downtime, you should build a recovery farm and configure it through step 7 above. (For more information about building a recovery farm, see "Create a recovery farm" at technet.microsoft.com/en-us/library/cc288425.aspx.) Doing so will speed up the recovery. Also, consider an additional web front end and cluster or mirror SQL Server to add additional fault tolerance to your farm. Incidentally, SharePoint is supported in a virtual environment, and it’s common to have a recovery farm in either VMware or Hyper-V.
  • Perform trial restores to your test/recovery farm. Doing so will ensure that your backups are working and that you know how to perform a restore. You really don’t want to learn how to perform a recovery during a disaster on a Sunday night.
  • When deploying custom code to your farm, use SharePoint Solutions. SharePoint Solutions are the best way to deploy custom updates to your farm. If your organization has a development team that is building SharePoint software, insist that they also create a solution package to deploy it.
  • Keep your content databases small. The larger your content databases are, the longer they will take to restore. In general, I recommend keeping each content database under 200GB.
  • Use an intuitive naming convention for your databases. As you can see, you might need to map your content databases to your web applications. Using a naming convention will make that much easier.

Earn Some Rest We've now walked through a SharePoint recovery using only SQL Server databases. Remember that you won’t be able to recover all your configuration settings; however, now that you understand how this kind of recovery works, you should be able to get your farm online within a few hours. Knowing the limitations of a database-only recovery should encourage you to consider additional backup options, along with my other recommendations. Only then can you be sure to get home in time to get some sleep.

Source is here. Happy hours...!!!

~ Gangadhar Kotu (గంగాధర్ కోటు)

Wednesday, September 23, 2009

CAML Queries - Cannot complete action

The Collaborative Application Markup Language (better known as CAML) is an XML-based query language that helps you querying, building and customizing Web sites based on Windows SharePoint Services. The XML elements define various aspects of a WSS site.

The Ground Rule should be either or join operators can only validate two expressions. Once it has more than two expressions in a single or join operator, it cannot be evaluated and throws a strange exception to the users. So, split them in to multiple expressions as below.

General (small example) would throw 'Cannot complete this action' exception:
< "Where" >
< "Or" >
< "Eq" >< name="'Country'/">< type="'LookUp'">India< /Value >< /Eq >
< "Eq" >< name="'Country'/">< type="'LookUp'">China< /Value >< /Eq >
< "Eq" >< name="'Country'/">< type="'LookUp'">Germany< /Value >< /Eq>
< "Eq" >< name="'Country'/">< type="'LookUp'">USA< /Value >< /Eq >
< /Or >
< /Where >

Optimized and to be working:
< "Where" >
< "Or" >
< "Or" >
< "Or" >
< "Eq" >< name="'Country'/">< type="'LookUp'">India< /Value >< /Eq >
< "Eq" >< name="'Country'/">< type="'LookUp'">China< /Value >< /Eq >
< /Or >
< "Eq" >< name="'Country'/">< type="'LookUp'">Germany< /Value >< /Eq>
< /Or >
< "Eq" >< name="'Country'/">< type="'LookUp'">USA< /Value >< /Eq >
< /Or >
< /Where >

In the above working example, you could observe that the join operator has only two expressions at any point of time.

** "Where" should be replaced with Where and "Or" should be replaced with Or. And also spaces shouldn't be there after and before the less than and greater than symbols. As blogger has a limitation, had to place like that.

So, should be very careful while writing CAML query with more values.

Microsoft has to keep an eye on throwing the right error message to the users.

You could also find the above info here

Other Sources:

Happy Coding...!!

~ Gangadhar Kotu

Friday, September 18, 2009

Asset Picker field type

In one of my project, I had to create a field type in MOSS with Asset picker functionality. Custom field types are very useful when you are creating custom functionality in MOSS 2007. The following example shows how to provide a functionality to select the document/list item/ from the site. The would be helpful to the user selecting the URL rather typing everything (there is a possibility of typos :) ). We are going to use 'AssetUrlSelector' class from Microsoft.SharePoint.Publishing.WebControls namespace for the purpose.

Create a custom field class by inheriting from SPFieldText class.

public class RelationshipField : SPFieldText {
// Methods

public RelationshipField(SPFieldCollection fields, string fieldName) : base(fields, fieldName) {}

public RelationshipField(SPFieldCollection fields, string typeName, string displayName) : base(fields, typeName, displayName)

{}

// Properties

public override BaseFieldControl FieldRenderingControl

{

get

{

BaseFieldControl control = new RelationshipFieldControl();

control.FieldName = base.InternalName;

return control;

}

}

}

Create a control class by inherting from BaseFieldControl class. and also need to include the following namespaces.

using Microsoft.SharePoint;

using Microsoft.SharePoint.Publishing.WebControls;

using Microsoft.SharePoint.WebControls;

Here is how the control creation goes:

public class RelationshipFieldControl : BaseFieldControl

{

protected AssetUrlSelector urlSelector;
protected override void OnLoad(EventArgs e)

{

base.OnLoad(e);
// Set the value if this is a postback.

if (this.Page.IsPostBack && base.ControlMode == SPControlMode.Edit)

{

this.ListItemFieldValue = urlSelector.AssetUrl;

}

}
protected override void CreateChildControls()

{

base.CreateChildControls();
// Add the asset picker when in edit mode.

if (base.ControlMode == SPControlMode.Edit)

{

urlSelector = new AssetUrlSelector();

this.Controls.Add(urlSelector);

}

}
protected override void Render(HtmlTextWriter output)

{
// If this is edit mode and has a value, set the picker.

if (base.ControlMode.Equals(SPControlMode.Edit)

&& this.ListItemFieldValue != null)

{

this.urlSelector.AssetUrl = this.ListItemFieldValue.ToString();

}

base.Render(output);

}

}



To register the custom field created above, you need to create a field type definition file as show below. And this xml file needs to be copied to 12\TEMPLATE\XML directory to recognize by MOSS.



asdf

asd

fa

sdf

afwasre

asraqer







Happy Coding... !!




~ Gangadhar Kotu

Wednesday, August 26, 2009

AJAX in MOSS Master pages

Hi,

The procedure is very simple to add <asp:scriptmanager> in Moss master pages.
  1. Add assembly info in SafeControls tag of the respective web.config. If this needs to used across the server farm, then enter in Machine.config. (** not recommended.)
  2. Register assembly in the master page headers before tag.
  3. <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" Namespace="System.Web.UI" TagPrefix="asp" %>
  4. Add the following after the form tag in body tag.

That's it. You are ready for AJAX development in MOSS.

~ Gangadhar Kotu

Monday, August 3, 2009

Sharepoint Interview Questions

• What is the relationship between Microsoft SharePoint Portal Server and Microsoft Windows Services?
Microsoft SharePoint Products and Technologies (including SharePoint Portal Server and Windows SharePoint Services) deliver highly scalable collaboration solutions with flexible deployment and management tools. Windows SharePoint Services provides sites for team collaboration, while Share Point Portal Server connects these sites, people, and business processes-facilitating knowledge sharing and smart organizations. SharePoint Portal Server also extends the capabilities of Windows SharePoint Services by providing organizational and management tools for SharePoint sites, and by enabling teams to publish information to the entire organization.

• What is a SharePoint Feature? What files are used to define a feature?
A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, scope of which are defined as
1. Farm level 2. Web Application level 3. Site level 4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is
Installing, Uninstalling, Activated, or Deactivated.

The element types that can be defined by a feature include
menu commands, link commands, page templates, page instances, list definitions, list instances,
event handlers, and workflows.

The two files that are used to define a feature are the feature.xml and manifest file(elements.xml). The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.

• Workflow can be applied to what all elements of SharePoint ?
Workflow associations are often created directly on lists and libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list. In short, it can be applied ...
At the level of a list/library
At the level of a content type defined at site scope
At the level of a content type defined at list scope

• What are the types of input forms that can be created for a workflow ?
You can create four different types of input forms including
1. An association form
2. An initiation form
3. A modification form
4. A task edit form.

Note that these forms are optional when you create a workflow template.

• What are ways to create input forms for workflow ?
Two
1. You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)
2. Using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

• What is the difference between method activity and event activity in WorkFlow ?
A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.

• What are content types?
A content type is a flexible and reusable WSS type definition (or we can say a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.
• Can a content type have receivers associated with it?
Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

• What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?
There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

• What is an ancestral type and what does it have to do with content types?
An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

• Can a list definition be derived from a custom content type?
Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

• When creating a list definition, how can you create an instance of the list?
You can create a new instance of a list by creating an instance.XML file

• What is a Field Control?
Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

• What base class do custom Field Controls inherit from?
This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

• Can multiple SharePoint installs point to the same DB?
Multiple SharePoint installs can use the same database server. Not literally the same database on that server. That server must be SQL Server 2000 or SQL Server 2005. It cannot be Oracle or another vendor.

• How to create links to the mapped network drives?
Creating links to mapped drives in WSS v3 or MOSS 2007 can be done via
the new content type for .lnk files.

• While creating a Web part, which is the ideal location to Initialize my new controls?
Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.
• 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.0 WebPart base class.
When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure

• What are the differences between the two base classes and what are the inherit benefits of using one over another?
The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure
ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

• What is the WebPartManager sealed class? What is its purpose?
The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

• What does AllowUnsafeUpdates do ?
If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property.

• What does RunWithElevatedPrivileges do?
There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.
• What does SPWeb.EnsureUser method do?
Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.
e.g SPUser usr = myWeb.EnsureUser("hitenders");

• What is a SPSite and SPWeb object, and what is the difference between each of the objects?
The SPSite object represents a collection of sites (site collection [a top level site and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

• What does a SPWebApplication object represent?
The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

• Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

• How do you return SharePoint List items using SharePoint web services?
In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.
Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

• When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?
In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

• What is CAML, and why would you use it?
CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.

• What is impersonation, and when would you use impersonation?
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

• What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

• Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?
Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.
Each custom property that you have must have the appropriate get and set accessor methods.

• What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?
ClassResources 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 wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

• What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?
A SharePoint solution file is essentially a .cabinet file with all a developers custom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:
allows deployment to all WFE’s in a farm
is highly manageable from the interface allowing deployment, retraction, and versioning
Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.
Can provide Code Access Security provisioning to avoid GAC deployments
And much more..

• What is a .ddf file and what does it have to do with SharePoint Solution creation?
A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

• What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?
The solution Manifest.XML file.

• What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

• What are event receivers?
Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

• When would you use an event receiver?
Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

• What base class do event receivers inherit from?
Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

• If I wanted to not allow people to delete documents from a document library, how would I go about it?
You would on the ItemDeleting event set: properties.Cancel= true.

• What is the difference between an asynchronous and synchronous event receivers?
An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding


Some items to look at as a developer..
General info on WSS 3.0 development.
http://msdn2.microsoft.com/en-us/library/bb530302.aspx

Application page. Allows the use of inline custom code. Application pages or "_layout" pages are stored on the SharePoint Web server and made available via a Microsoft Internet Information Services (IIS) virtual directory. Though application pages behave much like other ASPX pages and allow the use of inline custom code, they differ from content pages in that they cannot be used to host SharePoint features such as dynamic Web Parts and Web Part zones. For more information, see Creating an Application Page in Windows SharePoint Services 3.0.

WebParts.
http://blogs.tamtam.nl/mart/CreateASharePoint2007WebpartStepByStep.aspx

Server Controls. User Controls on creation and how to install / deploy them.

Content type. A reusable collection of settings to apply to a certain category of content such as documents and folders. Content types are designed to help users organize their SharePoint content in a more meaningful way. For more information, see Introduction to Content Types.

Custom action. Represents a link, toolbar button, menu item, or any control that can be added to a toolbar or menu that appears in the UI. You define custom actions by using a custom action element within a feature definition file. You can bind custom actions to a list type, content type, file type, or programmatic identifier (ProgID). For more information, see Custom Action Definitions.

Event receiver. Evaluator of an event and definer of the behavior of an application. Windows SharePoint Services 3.0 allows you to define event handlers within libraries, lists, and sites. Event receivers can be defined by using a receiver element within a feature definition file. For more information, see Event Registrations.

Feature. A package of Windows SharePoint Services elements that can be activated for a specific scope and that helps users accomplish a particular goal or task. Windows SharePoint Services 3.0 introduces this inherently portable and modular functionality, which simplifies modification of sites through site definitions. For more information, see Working with Features. -- Inside Microsoft Windows Sharepoint Services 3.0

Master page. Pages that provide a consistent layout and appearance (look and feel) for SharePoint sites. They allow you to factor out layout, structure, and interface elements such as headers, footers, navigation bars, and content placeholders. Master pages in ASP.NET 2.0 and master pages in Windows SharePoint Services work in the same way. For more information, see Building Simple Master Pages for Windows SharePoint Services 3.0.

Module. A file or collection of file instances that define the location where the files are installed during site creation. Modules are frequently used to implement a Web Part Page in the site. You can define modules by using a module element within a feature definition file. For more information, see Modules.

Object Model. what is the architecture of sharepoint and how is it represented programmatically. You have to create a webapplication as the first step.. and specify a port number if the default port 80 is already taken. This is not accessible as yet for browsing.. but you can see that a new website is created in the IIS. Next step would be to create a SiteCollection (multiple sitecollection can be created in a single website). Creating a site collection creates a default root site. This root site is accessible through the browser. you can go ahead to create multiple child sites under the root site.
This was the administrative terms used. but for programming, to access the SiteCollection we have to use SpSite and for the Sites we have to use SpWeb.

SharePoint site: A Web site hosted in a virtual URL. A SharePoint site is a place for collaboration, communication, or content storage. Depending on your business needs, you can create sites such as team sites, blog sites, wiki sites, and others. You can customize a site's appearance, users, user permissions, galleries, and site administration by using the Site Settings administration pages.

SharePoint site collection: A collection of SharePoint sites that share common administration pages and site settings. Site collections allow you to share content types, site columns, templates, and Web Parts within a group of SharePoint sites.

SharePoint Web farm: A group of Office SharePoint 2007 servers that share the same configuration database. All site content and all configuration data is shared for all front-end Web servers in a server farm.

Custom List Definition.
http://ari.provoke.co.nz/archive/2007/04/18/creating-a-custom-sharepoint-2007-list-definition.aspx

Site definition. A set of files that includes a master XML configuration file that is stored on all front-end Web servers. A site definition provides the basic blueprint for how sites look, what lists they include, their default navigational structures, and so on. For more information, see Working with Site Templates and Definitions.

Site template. A package containing a set of differences and changes from a base site definition that is created through the UI or through implementation of the object model. The site template package is stored as a .cab-based file that can be downloaded or uploaded to site collections by users with the appropriate rights. Site templates offer a measure of portability to SharePoint applications. For more information, see Working with Site Templates and Definitions.

Solution. A file that is a bundling of all the components for extending Windows SharePoint Services in a particular way. A solution file has a .cab-based format with a .wsp extension. A solution is a deployable, reusable package that can contain a set of Features, site definitions, and assemblies that apply to sites, and that you can enable or disable individually. You can use the solution file to deploy the contents of a Web Part package, including assemblies, class resources, and other package components. For more information see, Solution Overview.

Theme. A group of files (CSS, images) that allow you to define the appearance (look and feel) of Web pages. Themes in ASP.NET 2.0 and themes in SharePoint Products and Technologies work in the same way. Themes are used to help organizations to brand their portals and team sites. Office SharePoint Server 2007 includes a set of predefined themes. However, as a developer, you can create custom themes for your company. For more information, see How to: Customize Themes.

Others
Code Access Security -- general info. (http://msdn.microsoft.com/en-us/library/ms916855.aspx -- SPS 2003 but gives overall info)

HTTPHandlers in Sharepoint.
http://msdn.microsoft.com/en-us/library/bb457204.aspx

Programming Jobs in Sharepoint.
http://msdn.microsoft.com/en-us/library/cc427068.aspx

WWF
Custom Webservices. http://msdn2.microsoft.com/en-us/library/ms464040.aspx .

~ Gangadhar Kotu

Friday, February 13, 2009

Creating a SharePoint Solution Package (.wsp) in 5 steps



The following helps you to create .wsp (webpart solution package) for MOSS development without having WSP builder. Follow the below steps to generate wsp file.
  1. Create DeploymentFiles folder in your project. Have a folder structure in the project as given below.
  2. Create the file manifest.xml and the following is the sample content.
    xml version="1.0" encoding="utf-8" ?>
    <
    Solution xmlns="http://schemas.microsoft.com/sharepoint/"
    SolutionId="412ACEA2-48D9-42f2-9794-4715258BB6F0"ResetWebServer="FALSE">
    <
    Assemblies> <Assembly DeploymentTarget="GlobalAssemblyCache" Location="WSPCreationApp.dll"> <SafeControls> <SafeControlAssembly="WSPCreationApp, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=d42377719d795a18" Namespace="WSPCreationApp"TypeName="*" Safe="True" /> 
    SafeControls>
    Assembly>
    Assemblies>
    <
    TemplateFiles>

    <
    TemplateFile Location="XML\TestFile.xml" />
    TemplateFiles>
    Solution>
  3. Create the file BuildSharePointPackage.ddf and the following is the sample content.
    .Set DiskDirectoryTemplate=CDROM
    .Set CompressionType=MSZIP
    .Set UniqueFiles=Off
    .Set Cabinet=On
    .Set CabinetFileCountThreshold=0
    .Set FolderFileCountThreshold=0
    .Set FolderSizeThreshold=0
    .Set MaxCabinetSize=0
    .Set MaxDiskFileCount=0
    .Set MaxDiskSize=0
    ;**************************************************
    DeploymentFiles\manifest.xml
    %BuildDir%\WSPCreationApp.dll
     
    .Set DestinationDir=XML
    RootFiles\TEMPLATE\XML\TestFile.xml
  4. Create the file BuildSharePointPackage.targets and the following is the sample content.
    xml version="1.0" encoding="utf-8" ?>
    <
    Project DefaultTargets="BuildSharePointPackage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <
    PropertyGroup>
    <
    MakeCabPath>"MAKECAB.EXE"MakeCabPath>
    PropertyGroup>
    <
    Target Name="BuildSharePointPackage">
    <
    Exec Command="$(MakeCabPath) /F DeploymentFiles\BuildSharePointPackage.ddf /D CabinetNameTemplate=$(MSBuildProjectName).wsp /D DiskDirectory1=wsp\$(Configuration) /D BuildDir=$(OutputPath) "/>
    <
    Exec Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"Command="$(MakeCabPath) /F DeploymentFiles\BuildSharePointPackage.ddf /D CabinetNameTemplate=$(MSBuildProjectName).cab /D DiskDirectory1=wsp\$(Configuration) /D BuildDir=$(OutputPath) "/>
    Target>
    Project>
  5. Create the file WSPCreationApp.Bat and the following is the sample content.
    Rem Retracted Solution
    stsadm -o retractsolution -name WSPCreationApp.wsp -allcontenturls -immediate
    Rem Deleted Solution
    stsadm -o deletesolution -name  WSPCreationApp.wsp -override
    Rem Added Solution feature
    stsadm -o addsolution -filename WSPCreationApp.wsp
    Rem Deployed Solution
    stsadm -o deploysolution -name WSPCreationApp.wsp -url http://learning -immediate -allowgacdeployment -force
  6. Modify the .CSProj /.VBProj file with the following entries.
    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

    <
    Import Project="DeploymentFiles\BuildSharePointPackage.Targets" />
    <
    Target Name="AfterBuild">
    <
    CallTarget Targets="BuildSharePointPackage" />
    Target>
  7. Build the project. You should be having a wsp folder gets created with .cab  and .wsp inside it.
You are done! Happy Coding.!!
Gangadhar Kotu