In The Mix

Not just another WordPress weblog

SPTraceView v1.0 Released June 28, 2011

Filed under: SharePoint — fmuntean @ 7:42 pm
Tags:

Yesterday we finally released the version 1 for the SharePoint Trace View tool available on CodePlex.

SPTraceView analyses in real time the ULS trace messages coming from all SharePoint components and can notify you using a balloon-style tray bar messages when something of interest happens. This functionality is targeted mainly for people that develop and/or test custom SharePoint applications. It could be also useful to administrators to diagnose and troubleshoot their SharePoint farm.

As soon as you run it, SPTraceView will start receiving all messages from SharePoint.

 

Features:

  • Receives messages directly from the ETW logging system.
  • Easily enable/disable processing of the messages.
  • Process them and filter based on different criteria.
  • Balloon-style real time notification.
  • Log to xml files.
  • Trace to the Debug View for further filtering and processing.
  • Monitor entire Farm remotely.
  • Automatic update notification.

 

You can download the current version from here: http://sptraceview.codeplex.com/releases

Also a version supporting SharePoint 2010 is available too and work is done to release a stable version soon.

 

SharePoint for Project Managers March 11, 2011

Filed under: Uncategorized — fmuntean @ 8:23 pm

We are currently using SharePoint for many things like collaboration, portal, custom solutions, requirements gathering and project management.

As our current usage of SharePoint for project management is not public and process heavy I looked around and find a good blog about how to use SharePoint for Project Management. The following posts are not only doing that, but actually they provide a great step by step introduction to the world of PMs.

So if you are a beginner and want to learn more about PM or you are an expert in using Microsoft Project  but want to learn how SharePoint can help you to make others understand the complex plan that you put together follow the recipe for a simple and transparent way of managing projects.

 

PM Guide – (1) Initiate the Project

  • (i) Get the Project Approved and Resources Allocated
  • (ii) Decide the Project Management Process
  • (iii) Create a Collaborative Project Site

PM Guide – (2) Plan and Setup the Project

  • (i) Plan the Project
  • (ii) Desk Check the Project Plan
  • (iii) Notify the Team of their Responsibilities

PM Guide – (3) Work on the Project

  • (i) Find Work
  • (ii) Do Work
  • (iii) Update Progress on work

PM Guide – (4) Track and Re-Plan the Project (continuously until project closure)

  • (i) Check and understand the project’s progress
  • (ii) Find and Manage Exceptions (e.g. issues, risks and change requests)
  • (iii) Re-Plan the project

PM Guide – (5) Close the Project

  • (i) Run Project Post-Mortem and Track Lessons Learnt
  • (ii) Close out the Project site
  • (iii) Capture any useful modifications made to the project site for use on future projects

And he does not stop here but continues with the guide into the depths of Project Management:

 

PM Guide – (6) Project Management and Your Leadership Style

They even provide you with the templates (for a price) or you can actually build your own.

 

PM Guide – (7) Collaborative Project Management Sites

PM Guide – (8) Exercise – Build Your Own Project Management Approach

 

Hope this will help people understand how they can use SharePoint for Project Management as for sure if you read this blog you already have SharePoint.

Not sure if you are aware but if you one of the very experienced Project Managers out there Microsoft Project (Server) does integrates nicely with SharePoint Server.

 

I recommend SharePoint for project management for one single reason(ok two): Visibility & Transparency.

 

Want to dig deeper into this world?

Book cover of SharePoint for Project Management

SharePoint for Project Management

How to Create a Project Management Information System (PMIS) with SharePoint

By Dux Raymond Sy
Publisher: O’Reilly Media
Released: October 2008
Pages: 256
 

Correctly Handling the Silverlight OOB Update when hosted inside WCF December 28, 2010

Filed under: Silverlight — fmuntean @ 10:54 pm

On a project that I was working on lately I had to use Silverlight OOB (Out Of the Browser) and the xap file was actually not hosted in IIS but rather in a custom application (read either console app or Windows Services for the scope of this post).

The architectural approach is:

image

On the server side we have a console application running that host a WCF REST Service which will deliver, using WebGet, the files needed to run the Silverlight application. In other words the WCF service takes the place of IIS.

This is so that the user easily go to a web page then install the Silverlight application locally.

Now let’s see the implementation for this approach:

First the Service interface:

  1. [ServiceContract]
  2.     public interface ISilverlightHost
  3.     {
  4.         [OperationContract]
  5.         [WebGet(UriTemplate = "")]
  6.         Stream GetHtml();
  7.  
  8.         [OperationContract]
  9.         [WebGet(UriTemplate = "clientaccesspolicy.xml")]
  10.         Stream GetPolicy();
  11.  
  12.         [OperationContract]
  13.         [WebGet(UriTemplate = "SLPlayer.xap")]
  14.         Stream GetXap();
  15.  
  16.         [OperationContract]
  17.         [WebGet(UriTemplate = "Silverlight.js")]
  18.         Stream GetJavaScript();
  19.  
  20.     }

And the implementation:

  1. public class SLService : ISilverlightHost
  2. {
  3.     public Stream GetHtml()
  4.     {
  5.         return new FileStream(“SLPlayer.html”, FileMode.Open, FileAccess.Read);
  6.     }
  7.  
  8.     public Stream GetJavaScript()
  9.     {
  10.         return new FileStream(“Silverlight.js”, FileMode.Open, FileAccess.Read);
  11.     }
  12.  
  13.     public Stream GetXap()
  14.     {
  15.         var request = WebOperationContext.Current.IncomingRequest;
  16.         var response = WebOperationContext.Current.OutgoingResponse;
  17.  
  18.         //we need to manually implement a way to correctly update the xap file when running OOB
  19.         DateTime? modifiedSince = request.IfModifiedSince;
  20.         if (modifiedSince!=null)
  21.         {
  22.             var fileInfo = new FileInfo(“SLPlayer.xap”);
  23.             if (fileInfo.LastWriteTime < modifiedSince)
  24.             {
  25.                 response.StatusCode = HttpStatusCode.NotModified;
  26.                 return null;
  27.             }
  28.         }
  29.         response.ContentType = “application/x-silverlight”;
  30.         return new FileStream(“SLPlayer.xap”, FileMode.Open, FileAccess.Read);
  31.     }
  32.  
  33.     public Stream GetPolicy()
  34.     {
  35.         SetResponseContentType(“text/xml”);
  36.         return new FileStream(“clientaccesspolicy.xml”, FileMode.Open, FileAccess.Read);
  37.     }
  38.  
  39.     private static void SetResponseContentType(string contentType)
  40.     {
  41.         if (WebOperationContext.Current != null)
  42.         {
  43.             WebOperationContext.Current.OutgoingResponse.ContentType = contentType;
  44.         }
  45.     }
  46. }

 

Now lets explain the code a little bit:

1. The user open the web url for this application using a web browser the WCF will intercept the request and get return the html file stored locally see GetHtml method.

2. The browser parse the html and loads the Silverlight.js and the xap file.

3. The clientaccesspolicy.xml is provided in case there are other WCF services hosted under this url.

Now let’s talk about the OOB update of the application:

The process of upgrading a Silverlight application is described here:

Silverlight 3 Out-of-browser Update Model by Tim Heuer (the same applies for Silverlight 4 in case you are wondering)

As described in Tim’s post the Silverlight PlugIn send a request to the original web location of the Silverlight application using a special header, If-Modified-Since which IIS interprets it and respond correctly to it. However our WCF service will not know what to do with it by default so it is up to us to correctly handle this (see GetXap method).

The main idea here is that each time when the Silverlight app is either installed or upgraded some metadata is stored locally including a timestamp of the last update. when calling  Application.Current.CheckAndDownloadUpdateAsync(); the plugin will check if the file was modified after the last time stamp and the expectation is that the server will respond with a status code of 304 Not Modified and an empty body when there was no update. However when the file is newer then  regular response is expected including the xap file and a status code of 200 OK.

There were plenty of posts out there explaining how to host Silverlight inside WCF but none talked about the issue with the update. Hope this post will be helpful to people who will wonder why their application always reports update available even when there is none.

 

Getting Build Date and Time from Assembly Version December 28, 2010

Filed under: .NET,Silverlight — fmuntean @ 10:43 pm

When you use the following format for Assembly Version Attribute 
[assembly: AssemblyVersion("1.0.*")] the build number and revision are automatically generated for you when building the application.

It turns out that that a formula based on DateTime.Now is used to generate those numbers.

So to get the DateTime time stamp when the assembly was build all you have to do is:

Code Snippet
  1. Version v = ParseVersionNumber(Assembly.GetExecutingAssembly());
  2.            return new DateTime((v.Build – 1) * TimeSpan.TicksPerDay + v.Revision * TimeSpan.TicksPerSecond * 2).AddYears(1999);
 

BCS Model Receiver August 27, 2010

Filed under: BCS,SharePoint 2010 — fmuntean @ 2:11 pm
Tags:

BCS is now available in SharePoint 2010 at the Foundation level.
However seems that some people inside SharePoint team and Visual Studio team did not got the memo :)

The code to install the BCS model is only available inside a dll that is installed with the Standard/Enterprise edition of SharePoint 2010 Server.

I have just published a new project on CodePlex: http://bcsmodelreceiver.codeplex.com/ that will install the missing code as a Farm feature and will permit to install your BCS Model feature correctly on any platform. It is a Farm feature that will ease the pain of deploying BCS Models inside SharePoint 2010 especially the Foundation.

The code used in this project was actually published by Microsoft at: http://code.msdn.microsoft.com/BDCSPFoundation The only thing I have done is to put it together as a reusable feature so you do not have to cut and paste the code in each of the project.

Now, to use this feature, there is a small tweak that the developer has to do in Visual Studio, and that is to reference the BCS Model Feature Class from this project.

 
How To Install:
Install the BCSmodelReceiver.wsp into the SharePoint 2010 Farm.
The BCSModelReceiver Feature will be automatically activated and ready for use.
image
 
 How to use it:
Now in Visual studio you have to change the Feature Receiver used for your Model under the properties:
 
image
Replace the existing value for the Feature Receiver property with: MFD.SharePoint.BDCModelReceiver.ImportModelReceiver, MFD.BCSModelReceiver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e1e7a9e7f1c01c11
Now just build the WSP and deploy it in the FARM. It will automatically use this event receiver.
Plus optionally on the feature settings you can make your Model Feature depended on the BCSReceiver Feature ID=c1b3a659-a86e-4353-aad3-efe46cbbb4eb
NOTE: Once you  use this receiver you will have to deploy this feature in the Farm even if you are using SharePoint 2010 Standard/Enterprise.
 

Serialization inside SandBox Solutions June 29, 2010

Filed under: SharePoint 2010 — fmuntean @ 4:27 pm
Tags:

When creating a Web Part in SharePoint 2010 that will store configuration/data inside the SP Hierarchical Store at the SPWeb  level, using automatic serialization of an object, I got into the following error: System.Runtime.Serialization.SerializationException was unhandled Message=Unable to find assembly ‘MFD.SandBoxWebPart, Version=1.0.0.0, Culture=neutral ….’

Now to explain in more details the problem and how I choose to resolve it.

The configuration class is nothing else than a DTO class containing the configuration items as public properties and the [Serializable] attribute and be as simple as this example:

  1. [Serializable]
  2. public class MyConfig
  3. {
  4.     public string Config1 { get; set; }
  5.     public long Config2 { get; set; }
  6. }

I got the previous error when adding an instance of this class into the SPWeb Properties as in the following example (the exception gets thrown at line 5):

  1. SPWeb web = SPContext.Current.Web;
  2. {
  3.     var config = new MyConfig()
  4.                     {Config1=“Value1″,Config2=123};
  5.     web.AddProperty(“Key”,config);
  6. }

Now there is nothing wrong with accessing the SPWeb properties inside the Sandbox solutions as the following code will work just fine:

web.AddProperty(“Key”,”Value”);

The problem is that the serialization mechanism inside .NET requires to load the assembly for reflection. The SandBox assembly can’t be found because it is not saved in the GAC or any of the SharePoint folders as it only resides in memory and on the Content Database.

A work around for this to create your own serialization to xml/string using custom methods that will save/restore your data using one of the .NET classes (that can be serialized because they live in GAC).

An example of new MyConfig class will look like this:

  1. [Serializable]
  2. public class MyConfig
  3. {
  4.     public string Config1 { get; set; }
  5.     public long Config2 { get; set; }
  6.     public static MyConfig FromXML(string xml)
  7.     {
  8.         XElement doc = XElement.Parse(xml);
  9.         return new MyConfig()
  10.         {
  11.             Config1= doc.Element(“Config1″).Value,
  12.             Config2 = long.Parse(doc.Element(“Config2″).Value)
  13.         };
  14.     }
  15.      public string ToXml()
  16.         {
  17.             XElement xml = new XElement(“MyConfig”,
  18.                 new XElement(“Config1″,this.Config1),
  19.                 new XElement(“Config2″,this.Config2));
  20.             return xml.ToString();
  21.         }
  22. }

Now all you have to do to store the config in SPWeb properties is to:

  1. SPWeb web = SPContext.Current.Web;
  2. {
  3.     var config = new MyConfig()
  4.                     {Config1=“Value1″,Config2=123};
  5.     web.AddProperty(“Key”,config.ToXML());
  6. }
 

Moving your boot from VHD to a bigger drive June 27, 2010

Filed under: Uncategorized — fmuntean @ 4:46 pm
Tags:

The most important thing when using boot to VHD is that all your system files are located into a single VHD file on your physical HDD. This will let us easily upgrade the HDD by copying the VHD file from one to another then fix the boot for the new HDD.

Following are the detailed steps to accomplish this:

Attach the new HDD as an external one or as a second one if your computer permits.

Server Manager -> Storage -> Disk Management

New Simple Volume (format NFTS, quick) mount as f:

Mark Partition as Active

Command prompt

Bcdboot c:\windows /s f:

Bcdedit /export f:\backup.bcd

Reboot

Boot from Win7 or Windows 2008R2 DVD

After "windows loading files…" message when the initial setup screen is displayed press SHIFT+F10 for command prompt

Copy vhd file from old disk to new one (you need to find the drive letters again as they might not match)

Usually

C: is the internal HDD

D: is the DVD

E: is the external HDD

Xcopy /J c:\win2k8R2.vhd e:\ (wait… it will take a while)

NOTE: Or you can copy now the entire hard drive including the hidden folders using xcopy /H

I am only copy the vhd so I can get my computer up and running faster then I will copy the rest of the file later in background.

Close command prompt -> cancel installation (ALT+F4) -> shutdown the machine

Remove old hard drive and replace with the new one.

Start computer.

Boot from install DVD again and start the command prompt

Bcdedit /import c:\backup.bcd

Fix the entry

Bcdedit /set {default} device vhd=[LOCATE]\win2k8R2.vhd

Bcdedit /set {default} osdevice vhd=[LOCATE]\win2k8R2.vhd

Reboot and

Voala!

 

No SharePoint Conference in 2010 ? June 8, 2010

Filed under: Conference — fmuntean @ 6:25 pm

Today I have got an email announcing the SharePoint  Conference which I attended for the last few years now. I got so exited and tried to register but for my surprise the conference starts only in October of 2011.

Hmm. What is going on?

Microsoft ships SharePoint 2010, which is a big improvement over the “old”  MOSS 2007, but skips the most important conference for SharePointers this year?

I was prepared to attend all the 400 level sessions available, to gain as much knowledge as I can from the experts. I have been part of the SharePoint 2010 Ignite training and been to SPC2009 in October of last year, and I still consider that there is a lot more for me to learn about this new platform.

image

If you are interested into getting more info in a certain area of SharePoint please feel free to contact me and maybe we can have our own mini-conference. 

 

Where should I keep my Configuration May 29, 2010

Filed under: SharePoint — fmuntean @ 8:15 pm

This is one of the though questions when talking about custom SharePoint applications. Out of the box there is no specialized service to provide configuration API for your application. However being a platform SharePoint  provides many places that you can use to keep your configuration. Let’s see what are your options and some pro and cons about each.

1. Web.Config:

If you are an ASP.NET developer then usually your first place to use would be the web.config. The problem is that most likely you production SharePoint uses multiple servers and manually changing the web.config is a nightmare and unadvisable. The only acceptable way to change the web.config is to use SPWebConfigModification class and a feature to install and uninstall your modifications.

2. SPPersistedObject.Properties:

There are many places inside the SharePoint Object Model that you can use to store your configuration. All the objects derived from the SPPersistedObject have a Properties HashTable where you can store configuration. The exist at all levels: SPFarm, SPWebApplication, SPWeb, SPFeatureDefinition just to name a few. At the same time you can create your own Persisted Object that you can use as your configuration object as part of the Farm.

3. XML File:

There is nothing to stop you to load a configuration file in SharePoint and load it inside your application. However you might want to encrypt this file if you have sensitive data that you don’t want to be in clear.

4.SPList:

While for all other places you will need to build some kind of UI to deal with setting the configuration  values by using SharePoint Lists you get that for free. To read the values just use CAML Queries from your code.

 

SharePoint Saturday Boston 2010 February 27, 2010

Filed under: Conference,Presentations,SharePoint 2010 — fmuntean @ 1:55 pm

Thanks everybody for attending my session on SharePoint 2010.

I have uploaded the presentation on Slide Share for you to have, including the speaker notes. Feel free to drop me a line if you have any questions.

As you learn more about SharePoint 2010 you will see that there is a lot that I have to let out due to the time allowed for the presentation. There was no rule on that so if you want more talks or info on a specific feature drop me a line.

I will go over the evaluations once I get them back from the organizers and will update this post or add more to answer all your questions as promised.

 

 
Follow

Get every new post delivered to your Inbox.