Thursday, June 17, 2010

PowerShell for SharePoint

Windows PowerShell is a task-based command-line shell and scripting language designed especially for system administration. Built on the .NET Framework, Windows PowerShell™ helps IT professionals and power users control and automate the administration of the Windows operating system and applications that run on Windows.
Built-in Windows PowerShell commands, called cmdlets, let you manage the computers in your enterprise from the command line. Windows PowerShell™ providers let you access data stores, such as the registry and certificate store, as easily as you access the file system. In addition, Windows PowerShell™ has a rich expression parser and a fully developed scripting language.

With SharePoint 2010 developers and administrators will have full access to the SharePoint API from the PowerShell Command line. Stsadm will continue to be supported and users will be able to continue using it however it will be depreciated over time. PowerShell is a lot more flexible and powerful.
More Details

Thursday, May 27, 2010

Global - Page inheritance in ASP.NET 2.0


The web.config file in ASP.NET 2.0 allows all pages to inherit from a specific base page class (instead of just using the default System.Web.UI.Page class in all pages).

To import the same set of namespaces on every page, just add them to an Imports sections under the pages element.
I hope this was not possible in 1.1 V.

Friday, April 16, 2010

“Client-only Framework subset” in Visual Studio 2008

The .NET Framework Client Profile setup contains just those assemblies and files in the .NET Framework that are typically used for client application scenarios. For example: it includes Windows Forms, WPF, and WCF. It does not include ASP.NET and those libraries and components used primarily for server scenarios. Approx. 26MB in size, and it can be downloaded and installed much quicker than the full .NET Framework setup package. For more info Click here

Thursday, April 8, 2010

SilverLight WebPart

To Develop Silverlight WebPart
1.Create a Silverlight Application first, compile it to get the .XAP file.
2.Create a WebPart project add the Silverlight .XAP file like this
Example

protected override void CreateChildControls()
{
//base.CreateChildControls();
System.Web.UI.SilverlightControls.Silverlight myMediaCtrl = new System.Web.UI.SilverlightControls.Silverlight();
myMediaCtrl.ID = "RajMediaPlayer";
myMediaCtrl.Source = "http://rajwss.com/rajss1/monkDocumentLib/RajMediaPlayer.xap";// media files can be uploaded to this same Document Library.
myMediaCtrl.Width = new System.Web.UI.WebControls.Unit(900);
myMediaCtrl.Height = new System.Web.UI.WebControls.Unit(650);

this.Controls.Add(myMediaCtrl);

}
3.Compile it and deploy to the server.
Server Side changes

1.Install Silverlight SDK on the Sharepoint Server.
The Silverlight SDK can be downloaded from : http://www.microsoft.com/downloads/details.aspx?FamilyID=8D933343-038F-499C-986C-C3C7E87A60B3&displaylang=en
After the SDK has been installed make sure the System.Web.Silverlight.dll assembly has been registered in the GAC.
i also installed Silverlight.exe(V 3.0) in the server(not required though)
2. Make the following changes to the SharePoint Site web.config file
Add the following to the configuration (copy to NotePad Replace lt; to < & gt; to > )

Add the following to the lt;configurationgt;lt;configSectionsgt; xml:

lt;sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"gt;
lt;sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"gt;
lt;section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"gt;
lt;section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /gt;
lt;section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;/sectionGroupgt;
lt;/sectionGroupgt;
lt;/sectionGroupgt;

Add the following to the lt;configurationgt;lt;Sharepointgt;lt;SafeControlsgt; xml:

lt;SafeControl Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" /gt;
lt;SafeControl Assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.SilverlightControls" TypeName="*" Safe="True" /gt;

Add the following to the lt;configurationgt;lt;system.webgt;lt;httpHandlersgt; xml:

lt;remove verb="*" path="*.asmx" /gt;
lt;add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /gt;

Add the following to the lt;configurationgt;lt;system.webgt;lt;compilationgt;lt;assembliesgt; xml:

lt;add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /gt;
lt;add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /gt;
lt;add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /gt;
lt;add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;

Add the following to the lt;configurationgt;lt;system.webgt;lt;pagesgt; xml:

lt;controlsgt;
lt;add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;/controlsgt;

Add the following to the lt;configurationgt;lt;runtimegt;lt;assemblyBindinggt; xml:

lt;dependentAssemblygt;
lt;assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" /gt;
lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /gt;
lt;/dependentAssemblygt;
lt;dependentAssemblygt;
lt;assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" /gt;
lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /gt;
lt;/dependentAssemblygt;

Add the following to the lt;configurationgt; xml:

lt;system.webServergt;
lt;validation validateIntegratedModeConfiguration="false" /gt;
lt;modulesgt;
lt;remove name="ScriptModule" /gt;
lt;add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;/modulesgt;
lt;handlersgt;
lt;remove name="WebServiceHandlerFactory-Integrated" /gt;
lt;remove name="ScriptHandlerFactory" /gt;
lt;remove name="ScriptHandlerFactoryAppServices" /gt;
lt;remove name="ScriptResource" /gt;
lt;add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;/handlersgt;
lt;securitygt;
lt;authorizationgt;
lt;add accessType="Allow" users="" /gt;
lt;add accessType="Allow" users="?" /gt;
lt;/authorizationgt;
lt;/securitygt;
lt;/system.webServergt;

3.To add the Silverlight XAP to the IIS MIME-Type complete the following steps:
Open IIS
Open up the properties for the IIS Web Server
Click MIME Types...
Click New...
Enter ".xap" for the Extension
Enter "application/x-silverlight-app" for the MIME type
Click Ok, Ok, Apply
4. Restart IIS.

5.Add the deployed WebPart to the page.

For the complete code check
http://www.vbforums.com/archive/index.php/t-557072.html

Saturday, March 13, 2010

XSL,XSLT,XSL-FO

The eXtensible Stylesheet Language(XSL) is divided into two sub-languages: eXtensible Stylesheet Language Transformations (XSLT) and eXtensible Stylesheet Language - Formatting Objects (XSL-FO).

XSLT documents are well-formed XML documents that describe how another XML document should be transformed. For XSLT to work, it needs an XML document to transform and an engine to make the transformation take place. In addition, parameters can be passed in to XSLTs providing further instructions on how to do the transformation.

1. XSLT - XSL Transformation
2. XPath - for selecting precise nodes
3. XSL-FO - XSL Formatting Objects

XSL-FO is more powerful. Normally for XML to XML or XML to HTML etc using templates XML or HTML format results are omitted. XSL-FO is used for generating WORD Documents, RTF Documents, PDF, txt, etc.

Commonly