Archive

Archive for June, 2011

Preparing the VHD file using Windows Server 2008 Hyper-V

If you have Windows Server 2008 running Hyper-V, launch the virtual machine running Windows 7 or Windows Server 7 aka Windows Server 2008 R2 and the run the following command

c:\windows\system32\sysprep>sysprep /generalize /shutdown

 note: you can skip this step, if the system administrator already run the previous command. You need to check this  with him.

 

After running the above command in the virtual machine, this will launch the System Preparation Tool 3.14. Select the checkbox for ‘Generalize’ and click on OK.

Once the sysprep is completed the virtual machine will be shutdown and ready for booting. You can copy that VHD now.

 

Setting up your Windows Boot Menu to boot to an Existing VHD

If you have an existing Win 7 VHD already, or perhaps you’ve taking your Windows 7 installation Disc and “syspreped” a VHD image. Now, from an Administrator Command Prompt, you need to tell the Windows Boot Manager that there’s another option. You go:

C:\>bcdedit /copy {current} /d “My New VHD Option”

This will return a GUID. Select it using the Mark command by right-clicking in the Command Prompt and copy it to the clipboard.

Now, using that {guid}, type these commands:

C:\>bcdedit /set {guid} device vhd=[driveletter:]\<directory>\<vhd filename>
C:\>bcdedit /set {guid} osdevice vhd=[driverletter:]\<directory>\<vhd filename>
C:\>bcdedit /set {guid} detecthal on

See the [driveletter:] stuff in brackets? It’s NOT obvious, but you need to include those, so:

bcdedit /set {guid} device vhd=[C:]\win7\win7.vhd

You can confirm it’s setup with bcdedit /v:. You’ll see something like this. The interesting part is at the bottom.

Windows Boot Manager
——————–
identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device                  partition=C:
description             Windows Boot Manager
locale                  en-US
inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
default                 {34433bb7-628f-11dc-a941-001a6bcd5d3a}
resumeobject            {34433bb8-628f-11dc-a941-001a6bcd5d3a}
displayorder            {34433bb7-628f-11dc-a941-001a6bcd5d3a}
{280ffa1e-f8a9-11dd-b0a9-001c26fdc6b4}
toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout                 30
custom:45000001         1

Windows Boot Loader
——————-
identifier              {34433bb7-628f-11dc-a941-001a6bcd5d3a}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  en-US
inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence        {280ffa1b-f8a9-11dd-b0a9-001c26fdc6b4}
recoveryenabled         Yes
testsigning             Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {34433bb8-628f-11dc-a941-001a6bcd5d3a}
nx                      OptIn
custom:42000002         \system32\winload.exe
custom:45000001         2
custom:47000005         301989892
3

Windows Boot Loader
——————-
identifier              {280ffa1e-f8a9-11dd-b0a9-001c26fdc6b4}
device                  vhd=[C:]\VMs\Win7\Win7.vhd,locate=custom:12000002
path                    \Windows\system32\winload.exe
description             Win 7 VHD – Dev10
locale                  en-US
inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence        {280ffa1b-f8a9-11dd-b0a9-001c26fdc6b4}
recoveryenabled         Yes
testsigning             Yes
osdevice                vhd=[C:]\VMs\Win7\Win7.vhd,locate=custom:22000002
systemroot              \Windows
resumeobject            {34433bb8-628f-11dc-a941-001a6bcd5d3a}
nx                      OptIn
detecthal               Yes
custom:42000002         \system32\winload.exe
custom:45000001         2
custom:47000005         301989892
3

If it doesn’t work, you can always run bcdedit /delete {guid} /cleanup and try again.

Here’s what my Boot Manager (pressing F8 when I start up my machine) looks like now:

Now, I can boot up with my VHD mounted. Am I running a Virtual machine? No. I’m running Windows, on the hardware, with only the DISK Virtualized. I don’t work for that team, but I’m guessing I’m losing 3-5% (that number came out of my butt) on the disk side – and nothing anywhere else. How do I know? Well, Windows Experience is smart enough to keep me from checking (although I could use another disk tester tool, but I’ll leave that as an exercise to the Reader.).

I notice that Disk Management still gives me access to my was-C: drive, even though the VHD is now my C. My hardware C: drive got moved down, and it’s E: now. Nice than I can still see it!

What does the Device Manager say? It says the Msft Virtual Disk SCSI Disk Drive is there! That’s the only “virtual” thing going on here. Notice I’ve still got my actual Video Drivers (running multiple monitors across multiple display drivers). All my stuff is there, because I’ve got, forgive me, less virtual and more machine.

Hey, are those my four processors and my 8 gigs or RAM? Ah, yes, they are.

Love it. I’m going to use the hell out of it.

A few caveats. One, I haven’t figured out how boot off a VHD that is on USB or External Drive. I’m looking into it. It may be because there’s no drive letter assigned yet, or that I’m an idiot. We’ll see. Second, doing this makes your VHD less portable, because if you move it inside Virtual PC or to another machine, all the devices will freak out and try to reinstall (or maybe just not work) so be aware of that.

That said, I’m running Visual Studio 2010 Beta 1 without fear on my awesome hardware with hardware-speeds. Shiny.

Related Links

Advertisements
Categories: Uncategorized

Best Practices for developing Web Content Management (WCM) Portals using SharePoint 2010

June 28, 2011 1 comment

Best Practices to consider while developing Web Content Management (WCM) portals using SharePoint 2010:

1. Prepare wired-frame diagrams for depicting screen layouts, developing a Proto-type in SharePoint is even better. It gives tremendous clarity to all the stakeholders and it becomes easy to communicate to your developers as well. Use Visio for this purpose.

2. Plan your web application topology well in advance. Identify when to use a site collection and when to use a subsite.

3. Define your taxonomies/folksonomy, use the SP 2010 managed metadata services.

4. Maintain separate content databases per site collection, whenever you feel that your site collection can grow beyond 50 GB of data, move it into a separate content database, it becomes easier to manage and take back-ups and restore your web-application. SP 2010 recommended limit for content databases is a maximum of 100GB per site collection.

5. Always use content types, site columns for all your applications. Avoid creating columns directly in list/library.

6. Always limit the number of items in a List View using Filters.

7. Keep a very simple and a neat user interface with a user friendly navigation scheme.

8. Deploy your custom web parts, user controls, delegate controls, custom workflows as a feature solution package

9. Always prefer inheriting permissions for child sites, since they can be broken later.

10. Rigorously monitor your Application health using the new SP 2010 Developer dashboard for page response, memory leaks etc. ULS Diagnostic logging for errors etc.

11. Monitor your Content database size so that it does not exceed 100GB per site collection.

12. Use the new SP 2010 Folder Partitioning rules when your Document Library View items exceed the recommended 5000 item limit.

13. Always use Power Shell scripts to perform Solution installation, Backup/Restore operations, Content database attach/detach, creating/deleting site collections and other Admin related operations.

14. Have at least one Indexed column in your Lists for a performance reasons.

15. For moving content from staging to production environment, prefer using the new SQL Server 2008 Enterprise edition, Database snapshot technique which takes a quick snapshot of the Production farm and then ships it to the Destination farm.

16. You might convert your existing site collection to a solution file using SPD 2010 and open the solution using a Visual Studio 2010. And enhance it further. This is a faster way to build site definitions.

17. You can edit all List forms using InfoPath 2010, provided you have Enterprise edition of SP 2010. In this way you will be able to modify your New/Edit/Display forms using InfoPath 2010.

18. Use the advanced Record Management Rules for archiving, moving or marking documents as records. Alternatively InPlace records management is also available for declaring documents as records.

19. Prefer creating a Visual Web part for better control over layout and ease of programming.

20. Prefer Creating Site Columns and Content Types programmatically over Features, the reason is when you add/update site columns in your custom content type, newly added/modified columns do not become immediately visible in the List/Page Content Type from the Parent Site Content Type.
References:-

http://www.sharepointfix.com/2010/10/best-practices-for-developing-web.html

Reusable and Globally Reusable Workflows in SharePoint 2010

 

As we know, we’ve had workflows in SharePoint designer 2007, but we cannot move created workflow into another site or list somewhere else.

Now, there is a feature called “reusable workflows” in SharePoint Designer 2010 which gives us the capabilities of applying the created workflow on another list and move the workflow to other lists.

But we have to Differentiate between the terms “Reusable Workflows” and “Globally Reusable Workflows”

When you create a Reusable workflow in SharePoint Designer 2010, it’s by default reusable within the site it has been created in, which means that it can be attached to any list within this site. But what if you want your workflow to be reusable in the whole site collection? Well, this is the definition of “Globally Reusable Workflows”. You can easily convert your workflows to be available anywhere in your site collection by opening your workflow and clicking on “Convert to Globally Reusable” from the ribbon as shown below.

Also it’s worth mentioning that only the workflows created at the root level of the site collection can be converted to be Globally Reusable but other ones created in sub sites cannot. Try to create a workflow in a sub site, open it and note that the Conversion button is dimmed.

Another important question is what if I want to take my workflow and give it to somebody else in a different site collection? There’s another button in the ribbon called “Save as Template”, this takes the workflow, put it in a wsp file and save it to the ‘Site Assets” library. You can export this file and deploy it to other site collection and what’s really cool is that you can import this wsp into Visual Studio and extend it over there.

Refernces:http://www.codeproject.com/KB/sharepoint/ReusableWFsSharePoint2010.aspx

Categories: WorkFlows

Fast search 2010 for SharePoint 2010 Installation and Configuration

June 19, 2011 1 comment

Using WSPBuilder and SharePoint solution generator for Creating a List Instance in MOSS2007

June 17, 2011 12 comments

In this post I am going to explain how we can make use of WSPBuilder for creating a List instance.
First we need to install SharePoint Solution Generator. You can download the same from here
http://download.microsoft.com/download/4/0/b/40b62080-6295-4d63-b396-d779fb9b4449/VSeWSSv12.exe
Now follow the steps for generating List Definition. Here I am going to create a List Definition of a List named “Configurations”
Start SharePoint solution generator

Select List Definition and click on Next button


Specify the Site Url where the list is present and click Next


Select the List and click Next


Provide a project name and path, then click Next

Click Finish

Before clicking Exit, click “Click here to open the generated solution” and click Exit

You can see the “Configurations” folder. Let it be opened. Now open visual studio and create a WSPBuilder project

Once the project is created, add a new blank feature

Now, copy the folder “Configurations” and paste it under the feature folder as shown below

Open the ListDefinition.xml file and copy the following content


Once the content is copied, paste it in the elements.xml file as shown below and delete the file “ListDefinition.xml” from visual studion project

You can also see ListInstance, make a similar entry in your elements.xml file. Also replace the FeatureId with the FeatureId specified in the feature.xml file
Now build the wsp, deploy it and activate the feature. This will add the list to the site.
Hope this was helpful!!!

comparison between the capabilities offered by the Visual Studio 2010 Workflow Designer and Microsoft SharePoint Designer 2010

The following table offers a detailed comparison between the capabilities offered by the Visual Studio 2010 Workflow Designer and Microsoft SharePoint Designer 2010, and the workflows you can create with each.

Visual Studio 2010 Workflow Designer SharePoint Designer
Can write workflows for SharePoint Foundation 2010 Can write workflows for SharePoint Foundation 2010
Code-behind file enables developer to write custom Microsoft Visual C# or Microsoft Visual Basic code to express business logic No code behind; workflow rules file declaratively encapsulates business logic instead
Generates workflow markup file Generates workflow markup file
Workflow is authored as a template, which can be associated with multiple sites and lists Workflow is authored against and data-bound to specific list at design timeWorkflows can also be created as site workflows which make them reusable across multiple sites.
Workflow markup file, or markup and code-behind files, compiled into workflow assembly Workflow markup, workflow rules, and supporting file are stored, uncompiled, in a specific document library on the site
Workflow template must be associated with each list on which it is to be available. Association happens when the workflow is authored against the specific list; no later association is necessary or possible
Workflow template can be associated with a site content type. Cannot author workflows against content types.
Can use any forms technology. For example, Microsoft ASP.NET forms for SharePoint Foundation 2010 workflows. Uses the Forms Web Part.
Can include workflow modifications Workflow modifications are not available
Can author custom activities for inclusion in workflows Must use activities provided in the user interface. However, custom activities can be exposed to the design surface by modifying the ACTIONS files which contain the list of activities that can be used.
Package workflow assembly and workflow definition as a SharePoint Feature, and deploy to the site Automatically handles deployment to specific list
Can use Initiation form to gather information from the user when they start the workflow Can use Initiation form to gather information from the user when they start the workflow
Can use custom forms for users to interact with tasks in SharePoint Foundation 2010 Can use custom forms for users to interact with SharePoint Foundation 2010 tasks
Visual Studio debugging available No step-by-step debugging available
Can author both sequential and state workflows Can author only sequential workflows

Refernces:-

http://msdn.microsoft.com/en-us/library/ms461944.aspx

Create an Ajax Web Part for MOSS2007


For creating Ajax Web part in MOSS2007, firstly we need to enable Ajax in SharePoint 2007. We need to edit web.config of the web applications of SharePoint 2007 to support AJAX.

We will add multiple sections in web.config file as the following

1-      Add the following entries under  <configSections> 

<sectionGroup name=”system.web.extensions”type=”System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>     

 

<sectionGroup name=”scripting”type=”System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35″>       

 

<section name=”scriptResourceHandler” type=”System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” /> 

 

<sectionGroup name=”webServices” type=”System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″>

 <section name=”jsonSerialization” type=”System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”Everywhere” /> 

 

<section name=”profileService” type=”System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” /> 

 

<section name=”authenticationService” type=”System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ requirePermission=”false” allowDefinition=”MachineToApplication” />

 

</sectionGroup>

</sectionGroup>

</sectionGroup

 

2-      Add the following entries under <pages>

<controls>

<add tagPrefix=”asp” namespace=”System.Web.UI”assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

</controls> 

 

 

 

 

3-      add the following entries under <compilation><assemblies>

<add assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

 

4-    add the following entries under <httpHandlers>

<add verb=”*” path=”*.asmx” validate=”false”type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />     

 

<add verb=”*”path=”*_AppService.axd” validate=”false”type=”System.Web.Script.Services.ScriptHandlerFactory, SSystem.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />     

 

<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” />

 

5-    add the following entries under <httpModules>

<add name=”ScriptModule” type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

 

6-    at the end of the web.config and before <configuration> add the following:

<system.web.extensions>

    <scripting>     

       <webServices>        <!– Uncomment this line to enable the authentication service. Include requireSSL=”true” if appropriate. –>        <!–        <authenticationService enabled=”true” requireSSL = “true|false”/>      –>        <!– Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes.–>        <!–      <profileService enabled=”true”                      readAccessProperties=”propertyname1,propertyname2″                      writeAccessProperties=”propertyname1,propertyname2″ />      –>     

</webServices>

 <!–<scriptResourceHandler enableCompression=”true” enableCaching=”true” /> –>   

</scripting> 

</system.web.extensions> 

<system.webServer>   

<validation validateIntegratedModeConfiguration=”false” />

<modules> 

<add name=”ScriptModule” preCondition=”integratedMode”type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>

</modules>

<handlers> 

<removename=”WebServiceHandlerFactory-Integrated” /> 

 

<addname=”ScriptHandlerFactory” verb=”*” path=”*.asmx”preCondition=”integratedMode”type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

<addname=”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″ />

<addname=”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″ /> 

</handlers> </system.webServer> 

7-    add the following entry under <SafeControls> section

<SafeControl Assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″Namespace=”System.Web.UI” TypeName=”*” Safe=”True” />