In The Mix

As a SharePoint architect I have the business behind me and the Developers and IT Pro on my shoulders.

OneNote and SkyDrive November 28, 2009

Filed under: Office 2010 — fmuntean @ 5:03 pm
Tags: ,

[Update: 2010-06-10] The service is up and running. Now you can store and edit your OneNote Notebooks on Office.Live.com. You can easily create Onenote workbooks using OneNote by specify the location as Web.

[Update: 2010-06-07] (Added a work around for  getting an OneNote workbook created on SkyDrive.)

I am a big fan of OneNote application. currently I am storing my notes in SharePoint thus having them accessible everywhere I need them.

In the OneNote there is a new option to share your notes: Windows Live SkyDrive.

This option was not available in the Private Beta of Office 2010 and is still not functional in the Public Beta or the RTM version, see the picture:

OneNote_SkyDrive

However currently seems that the Live service supporting this feature is not available or enabled.

I will keep you posted when I get it working as this will improve my current sharing approach as I will not need to make sure that the notes are synced when I am home and I will be able to get to my notes, anywhere I want, anytime I want.

Microsoft have started the beta program for Office Online application on Live.com however OneNote is not available there either.

OnNoteSkyDriveOnline

[Update: 2010-06-07]

Mike Plate have found found a way to access SkyDrive folders using WebDav which gives us the possibility to store the OneNote workbooks on the SkyDrive. You can read more about his approach here: http://www.mikeplate.com/how-to-connect-to-skydrive-with-webdav/

Another way to get the WebDav Url is to use Word or Excel then use “Share & Send” => Send to web to connect to SkyDrive. Select the SkyDrive folder then when you click “Save As” button the dialog will open using the WebDav url for the selected folder which you can copy in the clipboard.

image

In OneNote use File –> New –> Network. Then on the Network Location paste the WebDav url for the SkyDrive folder. This will create a workbook on SkyDrive.

image

Good luck and happy sharing!

Let’s hope that Microsoft will soon support sharing the OneNote workbooks on Live SkyDrive.

 

InfoPath Task Forms Made Easy Part 2 November 27, 2009

Filed under: InfoPath,SharePoint — fmuntean @ 9:52 pm

In a previous post I have talked about an approach of transferring complex data between the workflow and the InfoPath task form.

Now in this post I will give you the implementation described before and give you instructions on how to install and use it.

Download the following IPTaskFormsMadeEasy.zip and extract it on your development machine. It contains all the necessary files to follow the steps described here.

General Description:

The idea here is to bypass the ItemMetadata.xml file and send the xml that the form will de-serialize and display.

For this I have created a new Content Type derived from the Out Of the Box InfoPath Content Type. The ID for this Content Type is “0x01080100C9C9515DE4E24001905074F980F93161”. When used this content Type will open the InfoPath Task Form but instead of processing the ItemMetadata.xml will read a special key value pair ("IPFormDataXML”) from ExtendedProperties that will contain the xml for that task. Once this task form gets closed the xml data for this task gets serialized back into the special key value pair to be read by the Workflow.

By using this approach we can pass quite complex data, as repeating tables, between the workflow and the task form without passing every value separately using the ItemMetadata.xml. Another benefit would be that you can now validate the data types using the task xsd and have data type safety when transferring information between the Workflow and the task form.

Installation:

Is quite simple to install this in your farm and does not affect any existing workflows as we are using our own content type.

Inside the zip file you will find the MFDWorkflowIPTask.wsp  SharePoint solution that you will need to install and deploy into your farm using the STSADM and or Central Admin site.  This will install a site collection feature that will enable a new content type (MFD.WorkFlowIPTaskCtype ContentType)
Now enable the MFD.WorkFlowIPTaskCtype feature on the site collection where you will be using Workflows that needs this content type and your done with the installation.

After this nothing actually happen until you are using the new content type into your workflow.

Developer Instructions:

Each time when this content type is used in Workflows the _layouts/MFD/WrkTaskIP.aspx page will be used instead of the OOB one (_layouts/WrkTaskIP.aspx).

I am not going to show here how you use the ItemMetadata.xml file to pass data between the workflow and the task form but I have included a demo with source code into the zip file, ApprovalWF1 project, that shows how to use the ItemMetadata.xml and ExtendedProperties. The demo uses just a single task form but imagine that you might have a complex workflow with over 10 or 20 tasks and you can see how hard is to maintain that code as changes are needed to the Task Forms.

The ApprovalWF2 demo project shows you how to use the new approach by passing the full xml to the task form and again being a demo I am just showing you how to implement it for a single task.

This Approval workflow deal with an Expense Report that contains complex data including repeating tables. Think about the following requirement where you are asked  that your workflow tasks needs to contain all the data from the original expense report so that the approver does not need to open the original report and the approvers can’t see other approvers notes during the approving process. If you want to know why you can’t use the Expense Report form and just add fields for each approver and just let them deal with that form drop me a line.

So now for the solution on how you implement this requirement.

First the forms, Expense Report Form and the the Task Form are both InfoPath forms. There are two ways of building InfoPath forms:

  1. Just start adding the fields as needed: very good for POC or if you don’t need much control over the fields namespace, schema and types.
  2. Start by thinking of the InfoPath like you do for you DB starting with the schema first by manually building your xsd files and then attach them to your InfoPath forms. This will let you control everything including the sharing of data types between multiple forms. This is how I recommend of building any Enterprise level InfoPath Form.

Under the Forms folder you have both, the Expense Report Form and ExpenseReportApproveTaskForm2, including the schema files. To include all the fields from the Expense Report Form (ERF) into the Task Form all you need to do is add the following tags:

   <xsd:import namespace="http://schemas.microsoft.com/office/infopath/2003/expXSD"
            schemaLocation="ExpenseReport.xsd"/> this will include all the fields defined into the ExpenseReport.xsd that is used by the Expense Report Form;

<xsd:element ref="exp:expenseReport" minOccurs="0"/> that will create an element into the ExpenseReportApproveTask2 Form for all the data included in the Expense Report Form.

Now having the xsd schema files for both of the forms we can actually generate two classes that will match that schema using:

        xsd.exe ExpenseReport.xsd ExpenseReportApproveTask.xsd /c
             /namespace:MFD.SharePoint.WorkFlow.Expenses.FormData

We will be using those two classes to serialize and de-serialize the xml data for both the Expense Form and Task Form.

Reading Expense Report Form inside workflow:

  • Reading Expense Report Form inside workflow:

    [NonSerialized]
    private expenseReport _expense;
    public expenseReport Expenses
    {
      get
      {
        if (_expense == null)
        {
          //Read the Form into memory
          XmlSerializer serializer = new XmlSerializer(typeof(expenseReport));
          using (Stream stream =  
                        this.workflowProperties.Item.File.OpenBinaryStream())
          { _expense = serializer.Deserialize(stream) as expenseReport; }
        }
      return _expense;
      }
    }

  • Create the Task:

    private void CreatingApproveTask(object sender, EventArgs e)
    {
      ApproveTaskId = Guid.NewGuid();
      ApproveTaskProperties.AssignedTo =
                 Expenses.manager.managerEmailAddress;
      ApproveTaskProperties.SendEmailNotification = true;
      ApproveTaskProperties.Title = string.Format("Approval for: {0}",
                  Expenses.employee.name);
      expenseReportApproveTask task = new expenseReportApproveTask();
      task.Decision = string.Empty;
      task.Notes = string.Empty;
      task.expenseReport = this.Expenses;
      ApproveTaskProperties.TaskType = 0;
      ApproveTaskProperties.ExtendedProperties[IPFormDataXMLTag] = 
                   Utility.Serialize(task);
    }

  • Read the Task:

    private void ApproveTaskChanged(object sender, ExternalDataEventArgs e)
    {
      string IPFormDataXML = this.ApproveTaskAfterProperties.ExtendedProperties 
                   [IPFormDataXMLTag] as string;
      expenseReportApproveTask task = Utility.Deserialize(IPFormDataXML);
      string taskDecision = task.Decision;
      isFinished = !string.IsNullOrEmpty(taskDecision);
      if (isFinished)
      {
        ApproveTaskOutcome = taskDecision;
      }
    }

This should give you an idea on how easy and clean is the code now. You will not have to change this code just because somebody else decided to the rename one of the fields in the Expense Report Form or even added a new field. The code will be the same what changes are the generated classes that will need to be refreshed but that is a recompilation matter not a code change.

The other thing that you should observe here is that we do not use strings anymore to pass data but the class itself which is strong typed so there is no more need of parsing the string into another type like Boolean and hope that nobody change the type on you.

Adding new Task Form, no problem, they follow the same pattern so adding another 10 or 20 forms to the Workflow is a breeze and reduce the spaghetti code needed to wire those up as you will have a different generated class for each.

The only thing that I did not show yet is how to use the new content type and that is easy, just modify the elements.xml for the workflow to specify that the tasks should use the new content type using the:
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93161"

As you are going to deploy this is production i would recommend to add the MFD.WorkFlowIPTaskCtype feature as a dependency to your workflow feature by adding the following tag inside the Feature tag.
        <ActivationDependencies>
           <ActivationDependency FeatureId="33cf18b1-e091-46c2-9f52-114516731db7"/>
        </ActivationDependencies>

By doing this the system will automatically activate the dependency feature and will fail to activate your feature if the required feature is missing.

Hope this helps to clarify this approach but if not or need more info don’t hesitate to contact me or leave a comment.

 

Installing SharePoint 2010 on Windows 7 November 26, 2009

Filed under: SharePoint 2010 — fmuntean @ 1:03 pm

Installing SharePoint 2010 on Windows 2008 is a breeze with the new included Farm Setup Wizard, however installing it under Windows 7 is another story.

I approached SharePoint 2010 the old way, try and see, planning to write a post on how to install SharePoint 2010 on Windows 7, and then realized that Microsoft have promised that with this version the documentation will be here so I tried the MSDN and there it is, a step by step instruction available here: http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx

The following steps are based on the public beta for SharePoint 2010. So in short what you need to do is:

  1. Extract the SharePoint files into a folder.
  2. Modify the config.xml to be able to install it on Windows 7 by including the <Setting Id="AllowWindowsClientInstall" Value="True"/> tag.
  3. Install prerequisites:
  4. Enable all the necessary windows features using this script.
  5. Reboot your computer (this step is very important don’t skip it otherwise you might get errors when running the configuration wizard).
  6. Install SharePoint 2010 from the extracted folder.
  7. When you are prompted to run the Configuration Wizard, don’t.
  8. Install SQL Server 2008 KB 970315 x64.
  9. Install FIX FOR: WCF: SharePoint Shared Services Roll-up
  10. Now you can run the Configuration Wizard.
  11. Install Visual Studio 2010 Beta 2 Professional.
  12. Download and install the Microsoft SharePoint 2010 SDK.

If you plan to install the Office Web Application again you will need to extract the files then modify the config.xml to allow the Windows 7 installation by including <Setting Id="AllowWindowsClientInstall" Value="True"/> tag.

 

Developer Dashboard

Filed under: SharePoint 2010 — fmuntean @ 12:46 am

A new developer and QA feature available in SharePoint 2010

You can easily turn on the developer dashboard, a way for the developer to check the performance of the page, by running a simple stsadm command (yes I am still using it):

There are 3 states: on, off or ondemand and here’s the syntax:

stsadm -o setproperty -pn developer-dashboard -pv ondemand

stsadm -o setproperty -pn developer-dashboard -pv on

stsadm -o setproperty -pn developer-dashboard -pv off

 

Off = Always off, usually used in production.

On = Always On, for development purposes, however I would say that is annoying to see it on all the pages and not recommended for production.

OnDemand = The user has the possibility to turn it on or off as needed using the small icon to the upper right hand corner of the page; you click the icon to toggle the dashboard on and off.

Developers will be able to write performance information into this Dashboard using the new SPMonitoredScope class

For more great info about this new feature you can read this post: http://blogs.technet.com/speschka/archive/2009/10/28/using-the-developer-dashboard-in-sharepoint-2010.aspx

The OnDemand option gives you the best flexibility and is safe to be used in production during the investigation process.

[Update] If you get “Access Denied!” error on Windows 7 then just run the Command Prompt as Administrator and will succeed.

 

Why Boot from VHD is not virtualization November 25, 2009

Filed under: Uncategorized — fmuntean @ 11:59 pm

Because of the marketing and the current buzz about virtualization many people think that Boot from VHD means that virtualization is used and thus a performance hit will be on your system.

Let me explain how Boot from VHD really work:

Any operating system has a boot loader that will need to recognize the file system and start loading the bits for your OS. This is the first software that is starting after the BIOS is completed.

The boot loader uses either BIOS calls or special drivers to load all the files from the OS and what Microsoft have done here is to include not only support for NTFS file system but for the VHD format too. So the boot loader can locate the VHD file then read the data from inside as needed.

Once the OS is started another driver, this time a windows driver, is used to continue and read the files and Microsoft have implement here a special disk driver that recognizes the VHD file format.

VHDDriverSo there is no virtualization involved here, all is involved is another layer of redirection until getting to the real data on the disk. What the driver does is to locate the location of the file inside the  VHD file then map that location on the host NTFS file system to be able to read the data for the real HDD. Now there is know for years already that there is actually even another redirection inside the HDD itself too, and the reason there is to be able to hide the bad sectors by remapping them.

There are few types of VHD formats:

  • Fixed VHD: This one allocates the entire size on the physical HDD and is the fastest. I would recommend to always use this type when
  • Dynamic VHD: The space gets allocated on demand however when booting from VHD is enabled the boot loader will enlarge this to the maximum specified size thus making a little bit slower because of the time that it takes to enlarge the file during boot and then resize it back when shutting down. The other problem with this type when used for boot from VHD is that  if there is not enough space you get an error and you can’t boot from it until you make the required space available. There is no much gain from using this type to boot from and lots of pain so I recommend using this type only for Hyper-V VMs.
  • Differential VHD: This type introduce yet another  redirection to a base VHD as it only contains the modified bits from the parent. This is very useful if you have multiple VHD that have small differences between them. One problem with it is that you can’t just path the parent VHD and have it propagated to all the rest. The parent VHD  should be treated as a read only and replacing it will require to replace of the differential ones too.   I don’t see much use for it in our situation as usually your VHDs are very different from each other, however in a QA environment there is much to gain from it.

In conclusion Boot from VHD is a great technology that was finally implemented in Windows (this is available in Linux for decades now). The main performance impact is actually because of the old fragmentation issue both inside VHD file and outside on the host NFTS file system. My recommendation would be to use the fixed size VHD and don’t try to gain a little bit of space by using Dynamic or Differential VHD as it does not worth the headache.

 

SharePoint 2010 Installation options

Filed under: SharePoint 2010 — fmuntean @ 10:08 pm

Starting with the new release of SharePoint 2010 The Developer has more options on how to run it. And yes I said “The Developer” as SharePoint on Windows 7 will not be supported as a production platform.

  Physical Virtual
Windows 7 x64    
Windows 2008 R2 x64    

So now you will end up in one of this boxes. I will describe what each means for you based on my own experience in this post.

I have choose only Windows 7 and Windows 2008 R2 because of few things:

  • If you still have Vista then upgrade to Windows 7 now.
  • Windows 2008 R2 has a better Hyper-V.
  • Both have support for boot to VHD

Now let me describe my current setup:

I have a laptop with multi boot using Boot to VHD with the following operating systems:

  • Windows 7 with SharePoint 2010 for development
  • Windows 2008 R2 with Hyper-V; having following VMs inside:
  • Windows 7 and all the software necessary for office work (no Visual Studio or SharePoint here)
  • One or more Windows 2008 R2 with SharePoint for development and testing purposes.

This setup lets me have the full flexibility on what am I running and when. However it comes with a price. Windows 2008 does not have Hibernate or anything like this so every day I have to shut it down and power it up in the morning. Another issue that I am experiencing is that the wireless driver stops working from time to time and a reboot is needed to fix it.

Booting inside Windows 7 environment requires me to mix the SharePoint development with the office work and application thus making that more unstable at times. However the hibernate and suspend mode are working here.

Installing Windows 2008 and SharePoint on my laptop directly does not give me much benefit as again I will need to mix the office and development together.

Currently I am trying all the four possibilities for SharePoint 2010 and on a later post I will let you know which one I choose to go with.

One advantage of using Hyper-V is that I can choose how much memory to allocate to each of my VMs giving me an easy way to test for how much memory I really need when working with SharePoint.

Let me know which approach do you prefer yourself and why.

 

SP2010 and Office 2010 Public Beta now Available November 17, 2009

Filed under: Conference,Office 2010,SharePoint 2010 — fmuntean @ 12:02 pm

Starting today the public betas for SharePoint 2010 and Office 2010 are available for MSDN subscribers, as many of you have correlate the announcement during the SPC2009 keynote of releasing them during the month of November with PDC2009, and you were right.