Monday, 15 December 2008

Adding Site Collection Administrators programatically

One of my team mates had a question whether we can add site collection Administrators to the site through object model.
Its fairly simple and easy.
code chunks:
****************************************************************************
SPSite _site = null;
SPUser user = null;
SPWeb _web = null;
try
{

SPSecurity.RunWithElevatedPrivileges(delegate()
{

_site = new SPSite("siteURL");

_web = _site.OpenWeb();
_web.AllowUnsafeUpdates = true;
_web.SiteUsers.Add(@"mossbox\user1", "user1@email.com", "user1", "Added via object model");
_web.Update();
user = _web.SiteUsers[@"mossbox\user1"];
_site.SecondaryContact = user;
user.Update();
_web.AllowUnsafeUpdates = false;
});
}
catch (Exception ex)
{

MessageBox.Show("Error in Adding Site Collection Administrators " + ex.Message.ToString());


}
finally
{
if (_site != null)
{
_site.Dispose();
}
if (_web != null)
{
_web.Dispose();
}

}


}

****************************************************************************

Thursday, 28 August 2008

Host ASP.NET UserControls in MOSS

I got an interesting change request from my client manager, where they want to host the ASP.NET user control as is in MOSS(This has DLL available). I googled around and found five different ways to do and one mukiway(my way)
1. Deploy the Usercontrol using Smart Part
2. Wrap the UserControl with webpart
3. Modify the UserControl as Webcontrol and deploy the control
4. Recreate this UserControl as new Webpart
5. Deploy this control into 12 hive controltemplates folder along with .cs file

Mukiway:
1. Copy the control and its files into _Layouts/MukiControl/
2. Create a test page in ASP.NET and host the UserControl in that test page
<% Register src="UserControl.ascx" tagname="mukicontrol" tagprefix="muki" %>
In the body tag
<muki:UserControl ID="UserControl" runat="server"/>
save this page as test.aspx

3. GAC the UserControl DLL
3. Mark that DLL as safe entry in web.config file of the hosting site collection
4. Perform IISReset.
5. Add a PageViewer Webpart
6. Select Web Page as option and in the URL field give /_Layouts/MukiControl/test.aspx

Cheers! you are done.

Friday, 15 August 2008

Prevent users from viewing Application Pages

As a part of security measure, we have been asked to restrict the people accessing the default application pages like /Forms/Allitems.aspx,/_layouts/mcontent.aspx, Userdisp.aspx.
I ve heard about viewlockdownfeature but also heard that there are some issues with that. So I thought we can do this task by a custom http handler.
In order to make this handler configurable instead of hardcoding the URL's I made an entry in node of web.config file and redirect those URL's to desired page.
The code for Http Handler goes like this :

******************************************************************
// Description:
// This HTTP handler redirects the Application pages to desired page defined in <AppSettings>node in web.config file
//
// Implementation :
//<httpModules>
//<add name="ReRoutePages" type="muki.ReRouteAppPages, ForceSSL,Version=1.0.0.0, Culture=neutral,PublicKeyToken=XXXXX" />
//</httpModules>
//<appsettings>
//<add key ="ApplicationPages" value="/Forms/AllItems.aspx,/_layouts/settings.aspx"/>
//<add key ="AdminPagesReRoutedURL" value ="http://servername/Pages/DontSeethosePages.aspx"/>
//</appsettings>

*******Code begins***********************
namespace muki
{
class ReRouteAppPages : System.Web.IHttpModule
{
#region IHttpModule Members

public void Dispose()
{
throw new NotImplementedException();
}

public void Init(System.Web.HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}

#endregion
void context_BeginRequest(object sender, EventArgs e)
{
ReRoutePages(System.Web.HttpContext.Current.Request.Url.PathAndQuery);
}
public void ReRoutePages(string pageURL)
{
//check for the current page exists in the group of pages requiring ReRouting
//if page is found in ReRoute group then redirect page to desired page as per web.config entry
try
{
bool found = false;
string AppPages = System.Configuration.ConfigurationSettings.AppSettings["ApplicationPages"];
string destURL = System.Configuration.ConfigurationSettings.AppSettings["AdminPagesReRoutedURL"];
char[] separator;
separator = new char[] { ',' };
string[] pages;
pages = AppPages.Split(separator);

for (int i = 0; i < pages.Length; i++)
{
if (pageURL.ToLower().Contains(pages[i].ToLower()))
{
found = true;
break;
}
}
if (found)
{
HttpContext.Current.Response.Redirect(destURL);
}

}
catch (Exception ex)
{

HttpContext.Current.Response.Write("An error has occured in ReRouting Application Pages" + ex.InnerException.ToString());
}

}
}
}

******************************************************************

2.Strong Name the assembly and GAC it.
3.Refer the Implementation
4.Perform IISReset.

We are done right!

Wednesday, 6 August 2008

Restrict access to MOSS Web Services

As a part of Security measure, we need to block the access to MOSS Web Services.
Every MOSS Developer knows how to access the exposed web services of MOSS.
http://servername/_vti_bin/Lists.asmx ...
This would open up the entire webservice and available methods in that.

In order to restrict that we can add an entry in web.config file of that Site Collections web application.

Add the following block

<location path="_vti_bin">
<system.web>
<authorization>
<allow users="mossserver\Myuser" />
<deny users="*" />
</authorization>
</system.web>
</location>

Its blocked!! Right?

*** But beware, you cannot open the Site in SharePoint designer if you block webservices for all users. So please allow atleast one account for accessing webservices.**

Restrict Access to MOSS Customizations

If we need to make sure that a user is logged in before accessing our customizations in MOSS and then redirected back after login, I found a inbuilt way

Microsoft.SharePoint.Utilities.SPUtility.EnsureAuthentication();
This will redirect unauthenticated users to the login screen and show users access denied screens if applicable.

It's that simple.

Friday, 25 July 2008

Enable SSL for selected Pages in MOSS

An article on automatically switching between HTTP and HTTPS protocols without hard-coding absolute URLs

I came across a change request of my client who wants to enable SSL on selected pages in MOSS site collection. we all know that we can create SSL enabled web application from scratch. But here the requirement is unique and client requirement says he should be able to Enable SSL on pages of his choice. So it should be configurable and at same time we should be able to maintain session state across http and https. Amazingly MOSS has that ability to support session state when switching across HTTP and HTTPS. I followed the steps below and was able to achieve result
1) Wrote a custom HTTP handler which redirects http to https for selected pages.

2) The page list is read from web.config file.
****** Source code for HTTP handler************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;
using System.Diagnostics;

namespace muki.ForceSSL
{
public class ForceSSL : System.Web.IHttpModule
{
#region IHttpModule Members

public void Dispose()
{
throw new NotImplementedException();
}

public void Init(System.Web.HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);

}

#endregion

void context_BeginRequest(object sender, EventArgs e)
{
RedirectSSL(System.Web.HttpContext.Current.Request.Url.PathAndQuery);
}
public void RedirectSSL(string pageURL)
{
//check for the current page exists in the group of pages requiring SSL
//if page is found in ssl group then redirect using https:// otherwise redirect with http://
bool found = false;
string sslPages = System.Configuration.ConfigurationSettings.AppSettings["SSLPages"];
char[] separator;
separator = new char[] { ',' };
string[] pages;
pages = sslPages.Split(separator);
for (int i = 0; i < pages.Length; i++)
{

if( pageURL.ToLower().Contains(pages[i].ToLower()))
{
found = true;
break;
}
}
if (found)
{
if (System.Web.HttpContext.Current.Request.Url.Scheme.ToString() == "http")
{
string sURL = System.Web.HttpContext.Current.Request.Url.ToString();
sURL = sURL.Replace("http://", "https://");
System.Web.HttpContext.Current.Response.Redirect(sURL);

}
}
else
{
if (System.Web.HttpContext.Current.Request.Url.Scheme.ToString() == "https")
{
string sURL = System.Web.HttpContext.Current.Request.Url.ToString();
sURL = sURL.Replace("https://", "http://");
System.Web.HttpContext.Current.Response.Redirect(sURL);
}
}

}
}



}
**********************************Source code for Http handler ends**************
4) Sign this assembly and GAC it.

5) Add this line <httpmodules> section and see that this line is first among all
<add name="ForceSSL" type="muki.ForceSSL.ForceSSL, ForceSSL,Version=1.0.0.0, Culture=neutral,PublicKeyToken=xxxxxxxx" />
Add key in Appsettings of web.config file like this.
<add key="SSLPages" value="/SitesWithSSL/Pages/SSL1.html,/subsite/Pages/SSL1.aspx" />
we can add as many pages we need for this. All these pages would be SSL enabled.

6)Now come to IIS-->WebApplication which needs SSL enabling for selected pages

7)Navigate to Properties--Directory Settings--Secure Communications--Server Certificate-->Assign the existing certificate.
More Details on SSL enabling

8)Assign port 443 for SSL ( we can choose port of our choice, but we should be aware that 443, 80 doesnt require ports to be mentioned in URL, otherwise we have to tweak our code settings to read through those ports)

9)Please be sure that in Directory settings-->SecureCommunications-->Edit-->Require Secure Channel is NOT SELECTED.

10)Now come back to Central Administration-->Operations-->Alternate Access Mappings

11)Add the new URL via internal URL's link.
https://servername//.

12)Perform IISReset-->Now Browse Application..
we can see our selected pages(as specified in web.config) are over SSL mode and the rest are under normal HTTP.

Cheers! we are done

Monday, 23 June 2008

Debugging in MOSS application

If you're building a new Web Part, in order to debug it,
1)You have to manually attach the Visual Studio debugger to the W3SVC.EXE process
2)Select Debug -> Attached to Process...
3)And then selecting one or more instances of the W3SVC.EXE process, and click Attach.

Some times this throws error message saying "Cannot load symbols" and our code lines are not hit by debugger.
Then in that case we have to point the debugger to symbols in following way.
1)Copy the PDB file we have with our application and move to put the debugging symbols in the same location as the assembly.
2)Start » Run then type in run command prompt "%systemroot%\assembly\gac "
This will open the GAC folder. Now select your file of choice which is in following format
[assembly file name -.DLL extention]\[assembly version in format of #.#.#.#]__[assembly public key token].

3)Copy the PDB file to that folder and then attach the debugger.

Friday, 20 June 2008

How to Identify the Search Settings for the Farm

Steps to Identify the Search Settings for farm
1) Open command prompt
2) stsadm -o spsearch action list..
This details the primary information about the search settings of the farm.

To identify the search settings of SSP.
1) Open central admin
2) Navigate to "Manage this farms Shared services"
3) Right click the SSP Name for its "Edit Properties" link.

Tuesday, 10 June 2008

Calculate difference between two dates

Today I had a cute requirement which is pretty small. The user want to see the time difference between two different time stamps.
Steps to do this
1) Create a column Date1 of DateTime
2) Create a column Date2 of DateTime
3) Create another column of Datatype Calculated type.
then enter the following formula in that column settings
=TEXT([DATE2]-[DATE1],"H:MM").

then you are done

Thursday, 22 May 2008

Some windows Run Commands

I knew this is deviation from MOSS. Since am fond of the windows commands, I prefered to share with my technical siblings across.


To Access
Run Command
Accessibility Controls access.cpl
Add Hardware Wizard hdwwiz.cpl
Add/Remove Programs appwiz.cpl
Administrative Tools control admintools
Automatic Updates wuaucpl.cpl
Bluetooth Transfer Wizard fsquirt
Calculator calc
Certificate Manager certmgr.msc
Character Map charmap
Check Disk Utility chkdsk
Clipboard Viewer clipbrd
Command Prompt cmd
Component Services dcomcnfg
Computer Management compmgmt.msc
Date and Time Properties timedate.cpl
DDE Shares ddeshare
Device Manager devmgmt.msc
Direct X Control Panel (If Installed)* directx.cpl
Direct X Troubleshooter dxdiag
Disk Cleanup Utility cleanmgr
Disk Defragment dfrg.msc
Disk Management diskmgmt.msc
Disk Partition Manager diskpart
Display Properties control desktop
Display Properties desk.cpl
Display Properties (w/Appearance Tab Preselected) control color
Dr. Watson System Troubleshooting Utility drwtsn32
Driver Verifier Utility verifier
Event Viewer eventvwr.msc
File Signature Verification Tool sigverif
Findfast findfast.cpl
Folders Properties control folders
Fonts control fonts
Fonts Folder fonts
Free Cell Card Game freecell
Game Controllers joy.cpl
Group Policy Editor (XP Prof) gpedit.msc
Hearts Card Game mshearts
Iexpress Wizard iexpress
Indexing Service ciadv.msc
Internet Properties inetcpl.cpl
IP Configuration (Display Connection Configuration) ipconfig /all
IP Configuration (Display DNS Cache Contents) ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) ipconfig /flushdns
IP Configuration (Release All Connections) ipconfig /release
IP Configuration (Renew All Connections) ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) ipconfig /registerdns
IP Configuration (Display DHCP Class ID) ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) ipconfig /setclassid
Java Control Panel (If Installed) jpicpl32.cpl
Java Control Panel (If Installed) javaws
Keyboard Properties control keyboard
Local Security Settings secpol.msc
Local Users and Groups lusrmgr.msc
Logs You Out Of Windows logoff
Microsoft Chat winchat
Minesweeper Game winmine
Mouse Properties control mouse
Mouse Properties main.cpl
Network Connections control netconnections
Network Connections ncpa.cpl
Network Setup Wizard netsetup.cpl
Notepad notepad
Nview Desktop Manager (If Installed) nvtuicpl.cpl
Object Packager packager
ODBC Data Source Administrator odbccp32.cpl
On Screen Keyboard osk
Opens AC3 Filter (If Installed) ac3filter.cpl
Password Properties password.cpl
Performance Monitor perfmon.msc
Performance Monitor perfmon
Phone and Modem Options telephon.cpl
Power Configuration powercfg.cpl
Printers and Faxes control printers
Printers Folder printers
Private Character Editor eudcedit
Quicktime (If Installed) QuickTime.cpl
Regional Settings intl.cpl
Registry Editor regedit
Registry Editor regedit32
Remote Desktop mstsc
Removable Storage ntmsmgr.msc
Removable Storage Operator Requests ntmsoprq.msc
Resultant Set of Policy (XP Prof) rsop.msc
Scanners and Cameras sticpl.cpl
Scheduled Tasks control schedtasks
Security Center wscui.cpl
Services services.msc
Shared Folders fsmgmt.msc
Shuts Down Windows shutdown
Sounds and Audio mmsys.cpl
Spider Solitare Card Game spider
System Configuration Editor sysedit
System Configuration Utility msconfig
System File Checker Utility (Scan Immediately) sfc /scannow
System File Checker Utility (Scan Once At Next Boot) sfc /scanonce
System File Checker Utility (Scan On Every Boot) sfc /scanboot
System File Checker Utility (Return to Default Setting) sfc /revert
System File Checker Utility (Purge File Cache) sfc /purgecache
System File Checker Utility (Set Cache Size to size x) sfc /cachesize=x
System Properties sysdm.cpl
Task Manager taskmgr
Telnet Client telnet
Te7SQL Client Configuration cliconfg
User Account Management nusrmgr.cpl
Utility Manager utilman
Windows Firewall firewall.cpl
Windows Magnifier magnify
Windows Management Infrastructure wmimgmt.msc
Windows System Security Tool syskey
Windows Update Launches wupdmgr
Windows XP Tour Wizard tourstart
Wordpad write

Thursday, 8 May 2008

How to redirect the user from userdisplay page to MySite page

Today I came across a strange request from client. They want the users to be redirected to My Profile page of MySite of individual users when they click on user name.
Eg:Contact : abc. Clicking on abc should be redirected to abc profile page instead of regular MOSS page http://servername/userdisp.aspx.

I found a way for this after some explore:
1. Go to Site Actions--Site Settings
2. Go to PortalConnections under Site Collection Administration tab.
3. Give the URL like http://URL of Mysite/personal.aspx.

you are done.
pretty simple right?

Wednesday, 30 April 2008

Tips & Tricks for using STSADM command

To save the output of STSADM Command into a text file use the following :
eg:stsadm -o addsolution -filename MySoln.wsp >>output.txt 2>&1
(Dont remove 2>&1--these are standard dos error handlers.)

If we are using -immediate or -time or -local (Asynchronous commands) with STSADM command, then next STSADM command would fail. Like:
stsadm -o retractsolution -name Mysolution.wsp -immediate
stsadm -o deletesolution -name Mysolution.wsp
The second command should execute after the first command has executed completely. But here it would fail.In order to avoid that we have two solutions
Solution One:
  • echo some text pause

  • Solution Two:
  • Execadmsvcjobs command.But this should be used very carefully because it would execute all the administrative jobs immediately
  • Tuesday, 29 April 2008

    STSADM Command Line Tool

    To use STSADM command line
    • You must be a member of the local Administrators group on the server. When you invoke Stsadm.
    • You supply an operation and a set of command-line parameters in the form: -operation OperationName -parameter value
    • For more additional Information : STSADM Operations

    For more tips and tricks with STSADM refer this link


    STSCOMMANDDescription
    Activatefeature Activates a feature in the feature collection.
    AddalternatedomainAdds an internal URL and maps it to one of the five URL zones of a Web application or external resource.
    AddcontentdbCreates a new content database or adds a database that needs to be upgraded when the url and databasename parameters are specified.
    AdddataconnectionfileAdds a new DataConnectionFile to the DataConnectionFiles collection for InfoPath Forms Services.
    Add-ecsfiletrustedlocationLets an administrator add a file to the trusted location list.
    Add-ecssafedataproviderLets an administrator add a supported provider type to the safe provider list.
    Add-ecstrusteddataconnectionlibraryAdds a trusted data connection to a library.
    Add-ecsuserdefinedfunctionAdds a user defined function.
    AddexemptuseragentAdds a user agent, which is typically in the form of a search bot, to receive the XML file that contains the data of the form for indexing instead of the HTML rendering of the form.
    AddpathAdds a managed path inclusion to a Web application.
    AddpermissionpolicyAdds a user to a policy role for the Web application based on the specified permission level name and corresponding zone.
    AddsolutionAdds a solution file to the solution store.
    AddtemplateAdds a site template to the template gallery.
    AdduserAdds a user account to the specified site collection and assigns it to the specified site group.
    AddwppackAdds a Web Part package to the server Web Part gallery.
    AddzoneurlConfigures the public URL and maps it to one of the five URL zones of a Web application or external resource.
    AllowuserformwebserviceproxyDetermines whether a user form template (that is, a non-administrator deployed form template published to a content type or a document library) can use the proxy.
    AllowwebserviceproxyTurns on or off the Web service proxy for the specified Web application.
    AuthenticationAuthentication provides the user identity input to the authorization process which determines what actions the current user is allowed to perform on a given object.
    BackupDescribes how to back up a site collection, an individual database, a Web application, or an entire farm.
    BackuphistoryDisplays a history of backup and restore operations that have been run.
    BinddrserviceRegisters a data retrieval service adapter.
    BlockedfilelistEnables an administrator to add or delete a file type to the blocked file types list for a Web application.
    ChangepermissionpolicyUpdates the Web application policy level for a user to enable a change to specific permission levels the user is assigned.
    CopyappbincontentCopies Web application–specific files, such as page resource (*.resx) files from their respective locations in the 12\CONFIG folder to the correct location in each Web application on the computer.
    CreateadminvsDisplays the port number to the SharePoint Central Administration Web site.
    CreatecmsmigrationprofileCreates a migration profile by providing a profile name, database server name, database name, and database user name.
    CreategroupLets site collection administrators create new groups from any site collection.
    CreatesiteCreates a site collection at the specified Uniform Resource Locator (URL) with the specified user as site collection owner and site collection administrator.
    CreatesiteinnewdbCreates a site at the specified Uniform Resource Locator (URL) and creates a new content database using the user name and password you specify.
    CreatesspCreates a new Shared Services Provider (SSP) in the farm.
    CreatewebCreates a subsite at the specified Uniform Resource Locator (URL).
    DatabaserepairDetects and removes orphaned items from content databases in Windows SharePoint Services.
    DeactivatefeatureDeactivates a feature in the feature collection.
    DeleteadminvsUnprovisions the SharePoint Central Administration Web site from the local machine.
    DeletealternatedomainDeletes an internal URL from a URL zone.
    DeletecmsmigrationprofileDeletes the named migration profile.
    DeleteconfigdbUnprovisions the local machine from the farm and deletes the configuration database (but does not drop the configuration database).
    DeletecontentdbDetaches a content database when the Web application, database name, and database server are specified.
    DeletegroupDeletes a group created in Microsoft Office SharePoint Server 2007.
    DeletepathRemoves an included path from the list of paths managed by Windows SharePoint Services.
    DeletepermissionpolicyDeletes a permission policy for a user from the site collection by specifiying the URL name and user login.
    DeletesiteDeletes the site collection with the specified URL from the Web application.
    DeletesolutionRemoves a Windows SharePoint Services Solution Package (*.wsp) from the solution store.
    DeletesspDeletes a Shared Services Provider (SSP) in a Web application when the title parameter is specified.
    DeletessptimerjobDeletes all of the timer jobs in the Shared Services Provider (SSP).
    DeletetemplateDeletes a specified site template from the site template gallery.
    DeleteuserDeletes a user account from the specified site collection and specified site.
    DeletewebDeletes a subsite using the specified Uniform Resource Locator (URL).
    DeletewppackRemoves the Web Parts in a Web Part package from a virtual server.
    DeletezoneurlDeletes a public URL and the zone to which it is mapped.
    DeploysolutionDeploys files related to a solution from the configuration database to individual front-end Web servers in the farm.
    DeploywppackDeploys a Web Part package.
    DisablesscDisables Self-Service Site Creation for the specified Web application.
    DisplaysolutionDisplays specific solution or Web Part information in a solution store.
    EditcmsmigrationprofileEdits a migration profile by providing a profile name, database server name, database name, and database user name.
    EditcontentdeploymentpathEdits and manages a content deployment path.
    EditsspAllows the site collection administrator for the Shared Services Administration site to perform the following functions:
    Change the databases that a Shared Services Provider (SSP) uses.
    Change the SQL credentials associated with the SSP databases.
    Modify the service account credentials.
    Rename an SSP.
    EnablecmsurlredirectActivates the Uniform Resource Locator (URL) redirection feature for URLs in Microsoft Content Management Server 2002.
    EnablesscEnables Self-Service Site Creation for the specified Web application.
    EnumalternatedomainsLists the internal URLs and specifies the URL zones and public URLs to which they are mapped.
    EnumcontentdbsEnumerates all content databases in the Web application.
    EnumdataconnectionfiledependantsEnumerates all form that are dependent on the specified data connection file.
    EnumdataconnectionfilesEnumerates all of the DataConnectionFiles in the collection in alphabetical order.
    EnumdeploymentsEnumerates all pending and active deployments in the farm.
    EnumexemptuseragentsReturns the rendering content of the form as an XML instead HTML.
    EnumformtemplatesLists the administrator-deployed form templates on the farm.
    EnumgroupsLists all the groups in Microsoft Office SharePoint Server 2007.
    EnumrolesLists the site groups that are available for use in a particular site or subsite.
    EnumservicesLists all the services in the Web application within a farm.
    EnumsitesDisplays a list of sites that are hosted in a Web application. To find the sites that need to be upgraded, use the redirectedsites parameter.
    EnumsolutionsEnumerates the list of Windows SharePoint Services Solution Package (*.wsp) and Web Part packages located in the solution store of the farm.
    EnumsspLists all the details of the Shared Services Providers (SSPs) in the farm or of a single SSP.
    EnumssptimerjobsEnumerates all of the timer jobs in the Shared Services Provider (SSP).
    EnumsubwebsLists the subsites that have been created immediately below a particular site.
    EnumtemplatesLists the site templates that have been submitted to the global site template catalog.
    EnumusersLists the users of a particular site collection or subsite.
    EnumwppacksLists the Web Part packages currently in the server Web Part gallery.
    EnumzoneurlsLists all of the public URL and the zones to which they are mapped.
    EmailSets the e-mail configuration settings for your server.
    ExecadmsvcjobsPermits a user to run any administrative service job in which the Windows SharePoint Services Administration (SPAdmin) service has been disabled.
    ExportExports site and subsite data from your Microsoft Office SharePoint Server 2007 installation.
    ExtendvsExtends a Windows SharePoint Services 3.0 Web application and creates a new content database.
    ExtendvsinwebfarmExtends a Windows SharePoint Services 3.0 Web application for use in a server farm
    ForcedeletelistAllows a user to delete a list that might appear to be in a corrupted state.
    FormtemplatequiescestatusDisplays the status of the quiesce process of a form template.
    GetadminportReturns the administration port for Windows SharePoint Services.
    GetdataconnectionfilepropertyDisplays the file property of each data connection file in the store of InfoPath Forms Services.
    GetformtemplatepropertyRetrieves properties on individual InfoPath Form Services templates.
    GetsitedirectoryscanscheduleDisplays the current schedule of all site directory links scan jobs to be run.
    GetsitelockRetrieves the lock status of a site.
    ImportImports site and subsite data from your Microsoft Office SharePoint Server 2007 installation.
    InstallfeatureInstalls a feature.
    ListlogginglevelsLists the current event log and trace log logging levels for each diagnostic logging category that is registered in a farm.
    ListregisteredsecuritytrimmersLists all registered security trimmers in the farm.
    LocalupgradestatusDisplays the farm and local server components that need to be upgraded.
    ManagepermissionpolicylevelEnables an administrator to manage the policy levels for a Web application.
    MergecontentdbsPermits a site collection to be moved from one content database to another when the souredatabasename and destinationdatabasename parameters are specified.
    MigrateuserMigrates a user account in Windows SharePoint Services 3.0 to a new user name and binary ID.
    OsearchManages the Office SharePoint Server Search service.
    OsearchdiacriticsensitiveEnables or disables the diacritic sensitivity setting.
    Peoplepicker-getsiteuseraccountdirectorypathRetrieves the user account directory path setting for the site collection.
    Peoplepicker-setsiteuseraccountdirectorypathSets the site user account directory path to a specific Organizational Unit (OU) in the same domain when the url and path parameters are specified.
    PreparetomovePrepares sites and content databases before moving to a new Web application by setting up the profile and membership synchronization service.
    ProfilechangelogMaintains a change log that records the changes made to the user profiles.
    ProfiledeletehandlerGives an administrator a chance to run a workflow when a user is about to be deleted.
    ProvisionserviceStarts or stops the SPService on the local computer or a custom service.
    QuiescefarmTemporartily suspends the farm’s ability to accept new sessions that are essential to rendering infopath forms on a server.
    QuiescefarmstatusDisplays the quiesce status of the server farm.
    QuiesceformtemplateTemporarily takes a form template offline.
    ReconvertallformtemplatesUpgrades the form template cached data to run on the upgraded server.
    RefreshdmsRefreshes the Directory Management Service if a database is restored or moved to a location where the incoming e-mail settings are not correct.
    RefreshsitedmsPerforms the same function as the Refreshdms operation but on a site collection level.
    RegistersecuritytrimmerEnterprise Search in Microsoft Office SharePoint Server 2007 performs security trimming of search results at query time.
    RegisterwsswriterEnables the Windows SharePoint Services VSS Writer service (known as WSS Writer service) on any front-end Web server.
    RemovedataconnectionfileRemoves all DataConnectionFiles from the DataConnectionFiles collection.
    RemovedrserviceRemoves a data retrieval service from the list of data retrieval services.
    Remove-ecsfiletrustedlocationLets an administrator remove a file from the trusted location list.
    Remove-ecssafedataproviderLets an administrator remove a supported provider type to the safe provider list.
    Remove-ecstrusteddataconnectionlibraryRemoves a trusted data connection from a library.
    Remove-ecsuserdefinedfunctionRemoves a user-defined function from Excel Calculation Services.
    RemoveexemptuseragentRemoves a user agent, which is typically in the form of a search bot, from the ExemptUserAgent collection.
    RemovesolutiondeploymentlockRemoves the solution deployment lock for the specified server or all servers from the back-end database.
    RenameserverChanges the name of the specified server in the configuration database.
    RenamesiteChanges a URL of a host-named site collection to a new URL.
    RenamewebChanges the URL of a subsite.
    RestoreExplains how a restoration of a site collection, an individual database, a Web application, or an entire farm is performed.
    RestoresspCreates a Shared Service Provider using a restored database.
    RetractsolutionRetracts the specified solution’s deployment, and removes files from the front-end Web server.
    RetractwppackRetracts the deployment of a specified Web Part package.
    RuncmsmigrationprofileRuns a named migration profile. The profile name is the only required parameter.
    RuncontentdeploymentjobRuns a named deployment job.
    ScanforfeaturesScans for new features in the file system, and if new features are present, installs them.
    SetadminportChanges the default zone Uniform Resource Locator (URL) and/or application pool located on the SharePoint Central Administration Web site.
    SetbulkworkflowtaskprocessingscheduleSets the schedule for when tasks are processed by using the Process all tasks option.
    SetconfigdbCreates a new configuration database in a farm or joins the local computer to an existing farm's configuration database.
    SetcontentdeploymentjobscheduleEnables the user to create an advanced schedule to run a deployment job.
    SetdataconnectionfilepropertySets a file property to a data connection file in the store of InfoPath Forms Services.
    SetdefaultsspSets a Shared Services Provider (SSP) as the default SSP in a farm.
    Set-ecsexternaldataLets an administrator set an external data connection to Excel Calculation Services.
    Set-ecsloadbalancingLets an administrator define load balancing for Excel Calculation Services.
    Set-ecsmemoryutilizationLets an administrator determine memory allocation for Excel Calculation Services.
    Set-ecssecurityLets an administrator set security settings for Excel Calculation Services.
    Set-ecssessionmanagementLets an administrator set session management settings for Excel Calculation Services.
    Set-ecsworkbookcacheLets an administrator set workbook cache settings on disk and in memory for Excel Calculation Services.
    SetformtemplatepropertySets the properties of an individual form template.
    SetholdscheduleSets the schedule to process all records that are on hold (records whose retention schedules are suspended).
    SetlogginglevelSets the Windows event log and trace log logging level for one or more diagnostic logging categories registered in the farm.
    SetpolicyscheduleSets the schedule for processing changes to a policy on the items that are impacted by that policy.
    SetrecordsrepositoryscheduleSets the schedule to process all records that have been submitted to Records Center sites in the farm.
    SetsearchandprocessscheduleSets the schedule for when the search and process timer job runs.
    SetsitedirectoryscanscheduleSets a schedule for a job to run the site directory links scan.
    SetsitelockSets a value that specifies whether the site collection is locked and unavailable for read or write access.
    SetsspportUpdates the port or ports for the shared Microsoft Internet Information Services (IIS) Web site, "Office Server Web Services", which used by Microsoft Office SharePoint Server 2007 Web services.
    SetworkflowconfigEnables or disables the workflow settings.
    SiteownerSets the primary or secondary administrator of a site collection.
    SyncConfigures the Windows SharePoint Services 3.0 synchronization job. Normally, this operation is used in conjunction with the preparetomove operation
    SyncsolutionPerforms a synchronization of the Windows SharePoint Services Solution Package (WSP) solutions stored in the configuration database with the files stored on disk.
    TzmoveAllows an administrator to update data that is affected by a change in the start and/or end of Daylight Saving time (DST).
    UnextendvsRemoves Windows SharePoint Services 3.0 from a particular Web application.
    UninstallfeatureRemoves the specified feature definition from the collection of feature definitions in the farm.
    UnquiescefarmResumes the farm’s ability to accept new sessions that are essential to rendering InfoPath forms on a server.
    UnquiesceformtemplateRestores a specific form template for use on the server.
    UnregistersecuritytrimmerUnregisters a custom security trimmer when the ssp and id parameters are specified.
    UnregisterwsswriterDisables the Windows SharePoint Services VSS Writer service (known as WSS Writer service) on any front-end Web server.
    UpdateaccountpasswordUpdates the Web application pool passwords.
    UpdatefarmcredentialUpdates the Web application pool for the SharePoint Central Administration Web site and the Windows SharePoint Services Timer service (SPTimer).
    UpgradeUpgrades the specified site collection during a gradual upgrade.
    UpgradesolutionUpgrades an existing solution. The solution to be upgraded could be either deployed or not deployed; however, the immediate or time parameters apply only if the solution has been deployed.
    UpgradetargetwebapplicationPrepares the environment for the gradual upgrade of a specific version 2.0 Web application by moving the existing version 2.0 Web application to a new URL and making a new version 3.0 Web application that is based on the existing version 2.0 Web application and associated settings.
    UserroleAdds or deletes permission levels to site groups.
    VerifyformtemplateVerifies that the form template can be browser-enabled.
    Properties
    Property nameDescription
    Alerts-enabledTurns alerts on or off.
    Alerts-limitedSpecifies the number of alerts to which a user can create.
    Alerts-maximumSpecifies the maximum number of alerts a user can create.
    AvallowdownloadSpecifies whether users can download infected documents to their local computers.
    AvcleaningenabledSpecifies whether antivirus cleaning is enabled or disabled.
    AvdownloadscanenabledSpecifies whether documents are scanned when they are downloaded.
    AvnumberofthreadsSpecifies the number of threads to use for antivirus processes.
    AvtimeoutSpecifies how long to wait before an antivirus process times out.
    AvuploadscanenabledSpecifies whether documents are scanned when they are uploaded.
    Change-log-expiration-enabledSpecifies whether change logs are deleted after the time span defined in the Change-log-retention-period: Stsadm property (Office SharePoint Server) property.
    Change-log-retention-periodSpecifies the amount of time to preserve change logs
    Command-line-upgrade-runningSpecifies whether the upgrade process has already been started.
    Data-retrieval-services-enabledTurns data retrieval services on or off.
    Data-retrieval-services-inheritSpecifies whether the Web application inherits data retrieval service settings that are located on the SharePoint Central Administration Web site.
    Data-retrieval-services-oledb-providersObsolete.
    Data-retrieval-services-response-sizeSpecifies the response size of the data source that is returned to the data retrieval service.
    Data-retrieval-services-timeoutSpecifies the request time out setting.
    Data-retrieval-services-updateTurns the support for update queries on or off.
    Data-source-controls-enabledTurns the data source controls on the server on or off.
    Database-command-timeoutRetrieves or sets the wait time before terminating the attempt to execute a command and generating an error.
    Database-connection-timeoutRetrieves an open connection or sets a connection to a Microsoft SQL Server database.
    Days-to-show-new-iconSpecifies the number of days to display the "New" icon for items added to a Web site.
    Dead-site-auto-deleteTurns on or off the setting to delete the site collection
    Dead-site-notify-afterSpecifies the number of days to wait before sending notifications
    Dead-site-num-notificationsSpecifies the number of notifications to send
    DefaultquotatemplateSpecifies the default quota template to be used when creating new site collection on a specified Web application.
    DefaulttimezoneSpecifies the time zone for sites that are created in a Web application.
    Delete-web-send-emailDeletes the site collection if use is not confirmed
    IrmaddinsenabledSpecifies a rights management platform other than Windows Rights Management Server.
    IrmrmscertserverSpecifies the location of the Windows Rights Management Services server.
    IrmrmsenabledControls whether the server should use the Windows RMS infrastructure instead of another rights management platform.
    IrmrmsuseadSpecifies that Microsoft Office SharePoint Server 2007 should use the location of the RMS server that is stored in Active Directory, rather than an administrator manually specifying the location of the Windows RMS.
    Job-ceip-datacollectionSpecifies the time schedule for when Customer Experience Improvement Program (CEIP) data is collected.
    Job-change-log-expirationSpecifies the time schedule when the change log timer job occurs.
    Job-config-refreshSpecifies the schedule for the configuration refresh job.
    Job-database-statisticsSpecifies the time schedule when database statistics are collected.
    Job-dead-site-deleteSpecifies the frequency interval and time range to delete unused Web sites automatically, for example, "Weekly at Sat 0:00:00".
    Job-immediate-alertsSpecifies the frequency to check for alerts that are to be sent immediately.
    Job-recycle-bin-cleanupSpecifies the time schedule for a cleanup of the Recycle Bin to occur.
    Job-usage-analysisLets an administrator set the time interval for usage processing.
    Job-watson-triggerDisplays the time schedule of the Windows SharePoint Services Watson Upload job.
    Job-workflowSends the workflow events that have been queued and delivers them to workflows.
    Job-workflow-autocleanSpecifies the time schedule for when a scan occurs to delete workflow instance data.
    Job-workflow-failoverSpecifies a schedule for restarting workflow operations that fail because of external reasons.
    Large-file-chunk-sizeSpecifies the amount of data that can be read from the server running Microsoft SQL Server at one time.
    Max-file-post-sizeSpecifies the maximum allowable size for a single upload of content to any site.
    Peoplepicker-activedirectorysearchtimeoutConfigures the timeout when a query is issued to Active Directory.
    Peoplepicker-distributionlistsearchdomainsRestricts the search of a distribution list to a specific subset of domains.
    Peoplepicker-nowindowsaccountsfornonwindowsauthenticationmodeSpecifies not to search Active Directory when the current port is using forms-based authentication.
    Peoplepicker-onlysearchwithinsitecollectionDisplays only users that are members of the site collection.
    Peoplepicker-searchadcustomfilterEnables a farm administrator to specify a unique search query.
    Peoplepicker-searchadcustomqueryPermits the administrator to set the custom query that is sent to Active Directory.
    Peoplepicker-searchadforestsPermits a user to search from a second one-way trusted forest or domain.
    Peoplepicker- serviceaccountdirectorypathsEnables a farm administrator to manage the site collection that has a specific organizational unit (OU) setting defined.
    PresenceenabledAllows users of a SharePoint site to see if other users are online and send instant messages to them.
    Recycle-bin-cleanup-enabledSpecifies whether a cleanup to the recycle bin occurs.
    Recycle-bin-enabledTurns the Recycle Bin on or off.
    Recycle-bin-retention-periodSpecifies the retention period, in days, of deleted items in the Recycle Bin.
    Second-stage-recycle-bin-quotaSpecifies how much hard disk space is available to a second stage Recycle Bin as a percentage of the quota allotted to the Web application.
    Token-timeoutSpecifies the amount of time before a user token times out.
    UsageprocessingenabledConfigures whether the usage analysis process is turned on or off.
    Workflow-cpu-throttleObsolete.
    Workflow-eventdelivery-batchsizeSpecifies the maximum number of work items that will be paged in to a processing timer job.
    Workflow-eventdelivery-throttleThe number of workflows that can be processed (that is, using the processor, not idle) at the same time across all Web front-end computers.
    Workflow-eventdelivery-timeoutThe time value a workflow job must run without the job timing out.
    Workflow-timerjob-cpu-throttleObsolete.
    Workitem-eventdelivery-batchsizeThe paging size for events delivered to a single workflow instance.
    Workitem-eventdelivery-throttleSpecifies the maximum number of work items that can be obtained on a given query for runnable work items

    How to Identify the SPFile.Properties hash table collection

    using Microsoft.Sharepoint;
    using System.Collections;


    SPSite _site = new SPSite("http://servername");
    SPFile _file = _site.OpenWeb().Folders("/Pages").File[1];
    Hashtable ht = _file.Properties;
    StringBuilder sb = new StringBuilder();
    sb.AppendLine("**The Properties of " + _file.Name.ToString()+" are as follows**");
    foreach(DictionaryEntry de in ht)
    {
    sb.Appendline("The key is " + de.Key.ToString() + " ; Value is " + de.Value.ToString() );

    }

    MessageBox.Show(sb.ToString());

    To Identify whether page is ghosted or not use SPFile.CustomizedPageStatus.

    Wednesday, 23 April 2008

    How to avoid your MOSS WebSite Breaking - Part-2

    This time we will see how the contributors group work.
    -- (will continue this shortly,now am moved to SSRS integration with MOSS)


    These are some of the videos from Microsoft on usage of SharePointDesigner(SPD)


    Opening the Sharepoint designer via Command line with the required page.
    1. Go to windows--Run
    2. Type in "spdesign.exe /n http://servername/sitename/page.aspx".
    • This opens the sharepoint designer with a copy of page of our choice.
    ..
    Happy SPD'ing

    Tuesday, 22 April 2008

    How to avoid your MOSS WebSite Breaking

    Very often we work with with various groups such as Web designers or content authors who are working on different aspects of a Web site. With so many groups working simultaneously, you are probably worried that somebody might inadvertently break a site — for example, by changing the design of the home page, modifying the style sheet, saving files in a wrong location, or breaking the site navigation or search functionality. If you are concerned, then I have a good news, We can avoid these scenarios by using Contributor Settings to turn on and configure Contributor mode in Microsoft Office SharePoint Designer 2007.

    Let us see what are these Contributor groups and how they are related to MOSS/SPD.
    1. Contributor mode is enabled by default, and there is no required setup for the site manager or administrator. Only an administrator can turn Contributor mode on or off.

    2.With Contributor Settings, a site manager can define Contributor groups in an organization, and then define exactly what tasks they can or cannot do in Office SharePoint Designer 2007.

    3.This means that you can use the Contributor Settings to set different editing restrictions for different groups.

    • For example, you can allow Web designers to create new styles but restrict content authors from doing the same.

    • Or you can allow content authors to create new pages from a master page but restrict the same for a different group.

    • Site managers can configure Contributor groups so that users have access to only those commands and features in Office SharePoint Designer 2007 that they need to complete their tasks.


    The features that you can access in Office SharePoint Designer 2007 depend on your role in the organization. See the following table for more details.
    The features that you can access in Office SharePoint Designer 2007 depend on
    your role in the organization.
    If you are a Site Manager
    If your SharePoint permission level gives you full control, you can:

    • Create Contributor groups and assign them editing restrictions.
      Insert content regions on a master page and specify the type of content that is allowed in that region.

    • Restrict areas outside of content regions on a master page from being edited.
      Control how and what types of pages are created and where content is saved.

    • Prevent users from modifying the default home page, master page, or any other page included in the site definition.

    • Allow full, unrestricted use of Office SharePoint Designer 2007 to only the groups you choose.


    If you are User such as a Web Designer or a Content Author (or any restricted user)
    Depending on the editing restrictions for your Contributor group, you can:

    • Create new pages

    • Apply styles and formatting to existing pages.

    • Insert images and media files

    • Work with SharePoint content such as Web Parts and Data Views



    Contributor Settings is not a security feature
    Important
    1)Contributor Settings is not a security feature. Contributor mode is a limited access mode for users who open and edit SharePoint sites in Office SharePoint Designer 2007.
    2)Contributor mode is designed to be used in an environment where site managers are confident of their users’ intentions.
    3)Contributor mode helps to guide users in a particular direction to carry out their tasks, and this guidance prevents accidental changes to the Web site.

    Understanding the Anatomy of MOSS

    I found a cute article which provides the dissected view of MOSS.
    Go through this link : MOSS Anatomy

    Friday, 4 April 2008

    Using DataFormWebPart to render the List

    1. Open the page in Sharepoint Designer
    2. Insert the DataformWebpart
    3. Select the required list
    4. Switch to code pane of SPD.

    Replace the entire XSL
    <xsl>
    <?xml:namespace prefix = xsl />
    <xsl:stylesheet version="1.0" x="http://www.w3.org/2001/XMLSchema" d="http://schemas.microsoft.com/sharepoint/dsp" prefixes="xsl msxsl ddwrt" ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" asp="http://schemas.microsoft.com/ASPNET/20" __designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xsl="http://www.w3.org/1999/XSL/Transform" msxsl="urn:schemas-microsoft-com:xslt" sharepoint="Microsoft.SharePoint.WebControls" ddwrt2="urn:frontpage:internal">

    <xsl:output indent="no" method="html"></xsl:output>
    <xsl:decimal-format nan=""></xsl:decimal-format>
    <xsl:param name="dvt_apos">'</xsl:param>
    <xsl:variable name="dvt_1_automode">0</xsl:variable>
    <xsl:template match="/">
    <xsl:call-template name="dvt_1"></xsl:call-template>
    </xsl:template>
    <xsl:template name="dvt_1">
    <xsl:variable name="dvt_StyleName">Table</xsl:variable>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"></xsl:variable>
    <table cellspacing="0" cellpadding="2" width="100%" border="0">
    <tbody><tr valign="top">
    <xsl:if test="$dvt_1_automode = '1'" cf_ignore="1">
    <th class="ms-vh" width="1%"></th>
    </xsl:if>
    <th class="ms-vh">Title</th>
    </tr>
    <xsl:call-template name="dvt_1.body">
    <xsl:with-param name="Rows" select="$Rows"></xsl:with-param>
    </xsl:call-template>
    </tbody></table>
    </xsl:template>
    <xsl:template name="dvt_1.body">
    <xsl:param name="Rows"></xsl:param>
    <xsl:for-each select="$Rows">
    <span class="ms-acclink">
    <xsl:text escaping="yes">&nbsp;</xsl:text>
    <xsl:text></xsl:text>
    <xsl:text escaping="yes">&nbsp;</xsl:text>
    </span>

    <a>
    <xsl:attribute name="href"><xsl:value-of select="@NavigateURL"></xsl:value-of></xsl:attribute>
    <xsl:attribute name="title"><xsl:value-of select="@Location"></xsl:value-of>-- <xsl:value-of select="@WorkCity"></xsl:value-of></xsl:attribute>
    <xsl:value-of select="@Title"></xsl:value-of>
    </a>

    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet></xsl>
    <parameterbindings>
    <parameterbinding name="ListName" defaultvalue="TopNavigation" location="None">
    <parameterbinding name="WebURL" defaultvalue="/" location="None">
    <parameterbinding name="dvt_apos" location="Postback;Connection">
    <parameterbinding name="UserID" defaultvalue="CurrentUserName" location="CAMLVariable">
    <parameterbinding name="Today" defaultvalue="CurrentDate" location="CAMLVariable">
    </parameterbindings>

    Wednesday, 2 April 2008

    Getting user full name from Login information in MOSS

    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.Office.Server.UserProfiles;
    using Microsoft.Office.Server;





    SPSite _site = new SPSite("http://server/");
    ServerContext scontext = ServerContext.GetContext(_site);
    SPUser memb = _site.OpenWeb().CurrentUser;
    UserProfileManager upm = new UserProfileManager(scontext);
    UserProfile up = upm.GetUserProfile(memb.LoginName);
    MessageBox.Show(up["FirstName"].ToString() + up["LastName"].ToString());




    Hope this will help.

    we can get from Active directory also.

    In this we are accessing only sharepoint user profile store

    Wednesday, 12 March 2008

    Creating Page Layouts

    STEPS TO CREATE PAGE LAYOUTS
    1#.Page layouts are templates that define content structure for a page and are always associated with a content type.
    2#.A content type contains a document template, data columns, workflows, and other information that completely define a document.
    3#.The publishing feature of MOSS uses a single root content type for publishing called Page.
    4#.All of the page layouts inherit from this base. Here’s how to create a new page layout in MOSS.

    STEP 1: Define Site Columns
    The individual content elements that appear in a page layout are derived from site columns. When you create a page layout, you can use any of the site columns already defined or define your own.

    STEP 2: Define a Content Type
    Page layouts have a direct relationship to a content type defined within the site. The content type is a collection of site columns, a page template, workflows, and other information that determine the appearance and behavior of a page layout. In order to create a page layout, you must create a new content type that derives from the existing Page content type. Inheriting the Page content type allows the new page layout to function correctly within the MOSS content management Feature.

    STEP 3: Create the Page Layout
    Page layouts are stored in Master Page and Page Layout Gallery. From this gallery, you can create a new page layout and associate it with a content type.This process makes the site columns that are defined for the content type available to the page layout as field controls that you can place on the page with the SharePoint Designer.

    STEP 4: Edit the Page Layout in SharePoint Designer
    Once you have created the new page layout, you must open it in the SharePoint Designer so that you can add the desired field controls. The site columns you defined as part of the content type become available in the SharePoint Designer as field controls that you can place on the page layout.

    STEP 5: Publish the New Page Layout
    Once the page layout is created, you must publish and approve it so that it becomes available for content authors. This process is essentially the same as publishing any item in MOSS. First the document is checked in, then it is published, and finally it is approved.

    STEP 6: Create a New Page
    Once the page layout is published and approved, content authors may use it to create new pages. This is done in the normal way by selecting the Create Page item from the Site Actions menu. After the page is created, the field controls may be edited to develop the actual page content.

    Monday, 10 March 2008

    Preparing a WSP to deploy a webpart as a feature

    Steps in creating a WSP
    1. After the webpart is built and compiled.

    2. Create a folder "Deployment"

    3.Prepare manifest.xml with the following content
    <?xml version="1.0" encoding="utf-8"?>
    <Solution xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    SolutionId="60AB14A4-975F-4ddc-9314-A4E95BD68B0D" xmlns="http://schemas.microsoft.com/sharepoint/">
    <FeatureManifests>
    <FeatureManifest Location="MyWebPart9\feature.xml" />
    </FeatureManifests>
    <Assemblies>
    <Assembly Location="MyWebPart9.dll" DeploymentTarget="GlobalAssemblyCache">
    <SafeControls>
    <SafeControl Assembly="MyWebPart9, Version=1.0.0.0, Culture=neutral, PublicKeyToken=72d040bf09bc4e29" Namespace="MyWebPart9" TypeName="*" Safe="True" />
    </SafeControls>
    </Assembly>
    </Assemblies>

    <ApplicationResourceFiles>
    <ApplicationResourceFile Location="MyWebPart9.dll" />

    </ApplicationResourceFiles>
    <RootFiles>
    <RootFile Location="TEMPLATE\IMAGES\MyWebPart9\muki.jpg" />
    </RootFiles>
    <Resources>
    <Resource Location="MyWebPart9\MyWebPart9.webpart" />

    </Resources>
    </Solution>

    4.Create folder "MyWebPart9"in Deployment folder -- this should have same name as webpart file.
    (Deployment folder should contain the DLL)

    5.Prepare feature.xml in same folder with following content
    <?xml version="1.0" encoding="utf-8" ?>
    <Feature xmlns="http://schemas.microsoft.com/sharepoint/"
    Id="{B8E5AEC5-8DD4-46b2-B066-CDD8651BEBB7}"
    Title="My Web Part"
    Description="My Web Part getting deployed with a WSP"
    Scope="Site"
    ImageUrl="muki.jpg"
    >

    <ElementManifests>
    <ElementManifest Location="webpartsmanifest.xml"/>
    </ElementManifests>

    </Feature>


    6. Create "webpartmanifest".xml file with following content in the \Deployment\MyWebPart9 folder
    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="MyWebPart9" List="113" Url="_catalogs/wp">
    <File Url="MyWebPart9.webpart" Type="GhostableInLibrary">
    <Property Name="Group" Value="muki"></Property>
    </File>
    </Module>

    </Elements>

    7. Create "MyWebPart9.webpart" in the same folder with the following content
    <?xml version="1.0" encoding="utf-8"?>
    <webParts>
    <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
    <type name="MyWebPart9.MyWebPart9"/>
    <importErrorMessage>Cannot import this Web Part. </importErrorMessage>
    </metaData>
    <data>
    <properties>
    <property name="Title" type="string">MyWebPart9 Web Part</property>
    <property name="Description" type="string">Sample Web Part that display label.</property>
    </properties>
    </data>
    </webPart>
    </webParts>

    8.Copy the Image to this same folder, which serves as a Icon to our feature in the activation screen

    9.Create "MyWebPartDeploy.ddf"file in the Deployment folder with the following content
    ;
    .OPTION EXPLICIT ; Generate errors
    .Set CabinetNameTemplate=MyWebPart9.wsp
    .set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
    .Set CompressionType=MSZIP;** All files are compressed in cabinet files
    .Set UniqueFiles="ON"
    .Set Cabinet=on
    .Set DiskDirectory1=Package
    ;
    ; ** CAB Root
    manifest.xml
    MyWebPart9.dll
    ;
    ; ** MyWebPart9
    .Set DestinationDir=MyWebPart9
    MyWebPart9\Feature.xml
    MyWebPart9\webpartsmanifest.xml
    MyWebPart9\MyWebPart9.webpart
    ;
    ; ** MyImages
    .Set DestinationDir=TEMPLATE\IMAGES\MyWebPart9
    MyWebPart9\muki.jpg

    10. Execute the following command
    makecab.exe -f DEPLOYMENT\MyWebPartDeploy.ddf

    11. Execute the following command to add the WSP to solution store in portal
    stsadm -o addsolution -filename MyWebPart9.wsp

    12. Execute the following command to deploy the wsp to portal
    stsadm -o deploysolution -name MyWebPart9.wsp -url http://servername:portnumber-immediate -allowGacDeployment