The value of old data

Recently in one of my projects we had a vendor that would deliver code that they swore they tested and passed all validation tests only to have it fail on the first couple of tests every time.  This was frustrating for us, since we were paying this company to test the code before sending it, and for them, since their reputation was getting hurt with each “bad” release.  After they tested the code again and we tested the code again and we each received different answers, we decided to have a web conference to try to figure out what was going on.  They started by creating a new entry and showed how everything worked fine and then we showed them our entry and how the code bombed with the first test.


I could see some lightbulbs go off when they realized we were using entries that were created with an old version of the software.  I won’t go into much detail about some of their suggestions other than to say that completely wiping out our database and starting over is not an option each time a new version of the software comes out (which is what they did before testing). So while they tested with entries created with that version and it worked great, they never tested against legacy entries.   Imagine if everytime Microsoft released a new version of Windows you had to start over from scratch! <cough>Windows8 RT</cough> :)


The moral of this story (and it builds upon an earlier post about knowing your customer) is know your customer’s data and make sure legacy data works as well.  They may not like the idea of wiping out everything and starting over.

SharePoint 2010: Showing the Context menu on any field in a List View when defining lists

I am working on a project that requires me to show the context menu on columns other than the default ‘Title” field that normally shows up (at least when creating a list based on the “Item” template).   While doing research I came across two different ways to do this when using XML to define the lists.

The first just involves renaming the “Title” field to something else.  I was taking this approach as I was playing with Visual Studio 2012RC’s new wizards for creating lists and content types (what are great!!!).   While the wizard allows you to change “Title” to whatever you want it never changed the text that shows up in the view header, only when add/editing the item.  Close but no cigar.  Looking at the code that gets generated I saw:

  <

 

 

 

This sets the field when adding/editing a new entry but doesn’t change the header.   After much head banging and powershell scripting I figured out that I needed to add:

Field ID={fa564e0f-0c70-4ab9-b863-0177e6ddd247} Type=Text Name=Title DisplayName=Name Required=TRUE SourceID=http://schemas.microsoft.com/sharepoint/v3 StaticName=Title MaxLength=255/>

  <

 

 

 

Field ID={82642ec8-ef9b-478f-acf9-31f7d45fbc31} Type=Text Name=LinkTitle DisplayName=Name />

as well. This is the field that is typically named “Title (linked to item with edit menu)”  Note that the “DisplayName” in both lines have been changed to what I want to actually show.  So now the header will be “Name” and the if I create a new view I will see “Name (linked to item with edit menu)”.

That worked fine for lists that use the existing “Title” field but what about lists that don’t have it or what if I needed to change the field that is used to display the menu depending on the view (which was actually the case)  For this I turned to code….sort of.  I was looking through the object model and saw that I can use “SPField.ListItemMenu” to set the field that I wanted to use.  Taking a chance I added “ListItemMenu=’True’ ” to the field I wanted to use and it worked!

So there you go.  Two different ways to change where the context menu shows!

Conditional requiring of fields using SharePoint 2010 List Validation

My customer wanted to be able to make a field required only if another field had a specific value, AKA Conditional Requiring.   While SharePoint has the ability to make fields required (or even check for uniqueness) it still does not yet have the ability to make a field required based on another.  That is where List Validation comes in.


If you do not already know, List Validation (along with Column Validation) allows you to perform checks on fields to make sure that they pass certain requirements.  They can be as simple as checking to make sure a field has a specific value to some rather complex (and cool) validations.  I forget who did it but I saw a “poor man” validation to make sure a human was entering a comment by making sure they entered in the first 3 letters of the today’s day.


Here is my setup.  I have two different fields, FieldA and Field B.   The field names have been changed to protect the innocent :)   They are both choice fields, although I would think they could be just about any field type,***certain fields like LOOKUP will not work here and the fields do not actually show up in the validation settings form*** and FieldA is required while FieldB is not.  I also setup FieldB so it does not have any default value.


 In my case I need to check two different things.  The first was that FieldA contained a specific value and if it did (and only if it did) I needed to make sure that FieldB had a selected value.  The first part is simple:


=[FieldA]=”ShareBlog”


This just states that if FieldA has the value of “ShareBlog” then the validation passes, otherwise it fails.  If you want to ouput text, rather than just check to see if it validation passes you can use the IF function.  The above formula can be rewritten as:


=IF([FieldA]=”ShareBlog”,”Pass”,”Fail”)


This also checks to see if FieldA has the value of “ShareBlog” but in this case it will ouput “Pass” if it does or “Fail” if it doesn’t.   Pretty close to what I need but not quite there.  I could also use:


=IF([FieldA]=”ShareBlog”,”True”,”False”)


but this will just output “True” or “False” (and the validation will actually still fail).   Finally I realized I can take the quotes off of “True” and “False” and just use the static names.   Now I will get my validation to pass if FieldA has the value of “ShareBlog” again.  Almost there.


Now I just need to check to make sure that FieldB has a value.   That is simple enough:


=IF([FieldB]<>””,True,False)


What I need to do now is to embed the two IF statements together to create the new one:


=IF([FieldA]=”ShareBlog”,IF([FieldB]<>””,True,False),True)


Sharp eyed readers may have notticed that for the outter IF statement I am actually returning TRUE no matter if FieldA has the value of “ShareBlog” or not.   That is not quite true.   If FieldA DOES contain “ShareBlog” then I want to make sure that FieldB has a value so I go into the second IF statement which will return a TRUE if FieldB has a value or FALSE if it doesn’t.   If FieldA DOESN’T contain “ShareBlog” then I don’t care what FieldB has for a value so I will always return TRUE.


That should do it.   You can throw some AND functions in there as needed if you need to check more fields

Creating a Core Results web part for FAST for SharePoint

There are a few postings out there that explain how to subclass the core results web part for SharePoint to add your own functionality.  Those work great…until you try to use them with FAST for SharePoint.  For some reason they just do not seem to work.   After much pounding of head against desk and then using .Net Reflector I figured out that there are two variables that need to be set.


base.ShowActionLinks = false;   //This tells the code it is a results web part and not an action links web part


base.bForceOnInit = false;   //Not quite sure why this is needed, MS has it marked as internal use only but it was the only way I could get the web part to work


 


Hope this helps others and if anyone can explain the “bForceOnInit” variable I would appreciate it


 

Know thy customer

I was reading an excellent article by David S. Platt called “Using WPF for Good and Not Evil” in which he takes a sample application written to show off Windows Presentation Foundation (WPF) and tells what he feels are the good and bad points of the program.  One thing that I read that really resonated with me was “Platt’s First, Last, and Only Law of User Experience Design states, “KNOW THY USER, FOR HE IS NOT THEE.” ”   He wrote this about software developers mainly but it would work for consultants as well although I would slightly rewrite it as “KNOW THY CUSTOMER, FOR HE (or SHE) IS NOT THEE”.  


 I have been guilty of this in the past myself.  Most of my early contracts were with the United States military (mainly the USAF) and I was fairly successful (at least I think so).  However when I switched to working with commercial customers I treated them the same way and failed miserably.  It took me a while to get it through my thick skull that commercial customers are not the same as military customers and need to be treated differently.  For that matter, each customer is not like the last customer and needs to be treated differently.  Once I realized that and practiced it I found my customers were much happier with me.


So developers and customers alike, get to know your users/customers and how they would likely do things.  I am not saying that nothing needs to change but with a better understanding of how things are currently done and why you will be able to better present and defend yourself (yes, even though you are hired as the expert you will need to defend why you want things done a certain way) when you suggest changes.

Favorite feature of SharePoint 2010?

There are a lot.   I think that the Client Access Model is really going to change how interaction with SharePoint will occur.  I can see a fully Windows based SharePoint in the near future.  However, my favorite change is the new notification area of the User Interface.   For those that are not familiar with it, compare it to the pop-up that shows when a user logs into Live Messenger or Communicator.   There is a pop-up that shows for a small amount of time telling you that someone you care about has logged in and then it disappears.  It is fairly unobtrusive but quite useful.


The notiifcation in SharePoint 2010 acts pretty much the same way.  You get a little message showing up inside SharePoint that you can act on or ignore.   The best part is you can write code to show your own messages (I am not sure what messages are there by default).  There are many, many ways to use this.  Some that I can think of off the top of my head is a user login notification, new document notification, new task notification, and so on.


I am sure as I use SharePoint more and more there will be other new features that will catch my eye but this is my favorite….so far.

Style sheets in real life

For those who do not know, a stylesheet, AKA CSS, is used to help define the look and feel of a web page.  Check out  the CSS Zen Garden for some great examples of what  CSS can do.


While working on a recent project I noticed that the incredible web page I created did not look quite so incredible at the customer’s site.  Some things would be off by a few, or not so few, pixels or images were just not showing.   To make a long story short their MOSS custom master page called a custom stylesheet which changed the way of a lot of stuff I designed worked.   I did get everything working and looking right but it did not make me look quite as good to the customer as I would have liked.  I should have gotten a copy of their master page and stylesheet before I started designing.  So much for first impressions!  


This experience can be used in real life.   While people and companies do not have stylesheets defining how things look and feel they have corporate standards and just “that is the way we have always done it” that do.  While your job as a consultant or even as an employee is to do the best possible job possible you need to understand that the company’s “stylesheet” may make what is “incredible” to you not incredible to them.   You may want to create the world’s best web site using AJAX, JQuery, Silverlight, and many other buzz words but the company is still on I.E. 6 or may not authorize the use of Silverlight.  Your job is to make your “incredible” work in their “stylesheet” and perhaps make recommendations and suggestions as to how to change.   That is what changes the consultant to a trusted advisor.

Issue to be aware of upgrading Windows Server 2008 to R2 with MOSS

http://support.microsoft.com/kb/962216/EN-US


First you get a message telling you to look for KB article 962935, which canot be found.   One MS employee on the forum (who is really very helpful) suggested it may not ready for public release yet.    If you are going to put the KB article in an error message at least make sure it exists!  As an aside, I wonder if it is the MOSS install program that is telling me it cannot run in Windows Server 2008 R2 or if there is something in the OS telling the installer that.   In any case the link above tells you the issue and how to resolve it….just uninstall your WSS installation!   Really?!?!?  Microsoft is actually suggesting you uninstall a critical piece of software in order to upgrade the operating system?!?!?!  I seem to recall reading somewhere that SharePoint was one of the big money makers for Microsoft right now.  Why don’t they spend some of that money to test these things.


Oh wait, the link tells you how to get  Windows Server R2 installed, it does not address the issue of re-installing your SharePoint system.


Two suggestions have been presented. 


  1. Upgrade your SharePoint to SP2 before trying to upgrade Windows Server 2008…makes sense as long as you are allowed to do that.  Guess this is one reason to push to install it.
  2. Uninstall SharePoint and do a slipstream install with Service Pack 2.

Don’t get me wrong.  I still love SharePoint and (most of) Microsoft but there are days where I just hang my head.

In defense of the MVP program

Some of you may have read Joel’s  recent blog posting regarding the MVP program in general, and it appears, the SharePoint MVP program specifically.  While some of the point raised may be valid I do not think they tell the entire story.  I am not sure if this will help or hurt but I felt like I needed to write something.


First a little background for those who do not know me.  I am proud to have been one of the first SharePoint MVPs and kept my MVP award until last year when I joined Microsoft.  I have left Microsoft and who knows what the future will hold.  In any case I feel that this gives me insight into the program from both sides of the fence.


1. The magic around becoming an MVP is too good ol’ boy – Since MVPs are responsible for recognizing and nominating, recognizing, and seeking out people for the Award….


This is not entirely true.  MVPs may nominate people for the award but they do not actually determine who will become MVPs.  When I was an MVP our lead asked our opinions of people if she was not familiar with them.  That only makes sense since MVPs are the ones that are in the communities and will have an idea of who people are.  However I have not heard of anyone getting an award just because they were nominated by other MVPs.


2. If you want to be one careful how you ask or you will NOT be one…


Again, while the the case used may actually be true, the cases I have seen are people whose only goal is to become a MVP and it was obvious that this was the only reason they were doing what they were doing.


3. If you loose your MVP it’s like you are shunned… 


This is one that can absolutely state is not the case.  I still talk to other MVPs…at least the ones I talked to while I was a MVP. [:)]   Granted, there is a decrease in the amount of communication since a large portion was done in the DL (more on that later) but I have never felt that any MVP thought less of me because I was no longer a MVP.


4. MVP social exclusivity…


Not sure what is meant by this.  Is it the MVP summit or the fact that large events often have a MVP social gathering associated with them?   I have not been to any large conference other than the summit so I have not comment on this one.


5. Politics are often personal…


I have not heard of this occuring so I have no comment on it.


6. Bow down to the power of the DL…


All I can say is that before the DL (and I am refering to the SharePoint MVP DL, I do not know of any other DL) the MVPs really had no clue what was going on.  The DL allowed us (now them) to communicate not only with each other but with people at MS to get needed information.  As far as distributing it outside the DL I seem to recall that we were told to treat everything as NDA unless specifically told otherwise.


7. Unhealthy reliance on MVP…


I have not done any speaking engagements while a MVP or now that I am no longer a MVP so I have nothing to say on this.


8. Regional…


Never heard of this happening so I have no comment on it.


9. Company Politics need to be left outside the program…


Not sure where this is coming from but the only thing I can say on this is how exactly is this the MVP program’s fault?  People are people.  I know there are MVPs that I do no like and I certainly would not hang out with them….heck I had to work with one of them! (Just kidding Adam and Stacy if you are reading this)   I have worked with and against MVPs (got to love the world of consulting) and business is business.   If it comes down between an award and a job, I am going to err on the side of my job.


10. Your way of doing things vs. Ours…


OK, this one has always bugged me.  I never knew what it was that earned me my MVP award (although considering I had not done much community programming or speaking it must have been the newsgroup postings) but what are going to do.  Should MS say that if you post X number of blog postings and Z number of newsgroup postings you will get an award? This is a tough line to walk.


Just remember that the MVP program is an award not an entitlement.  Did I agree with everything about the MVP program?  Absolutely not.  Are there things I would like to see changed?  Absolutely, but I strongly believe there is more good than bad in the program.

Update panel not working like you expect

We have been using a lot of updatepanels (yeah, I know there is a performance issue but that is a different post) and, as usual, it worked great on my computer but not so great at the customer site.   What the panel does is to process a search request without the postback.  At the customer site we saw the information being sent to the search engine and the data coming back, but it would never show the results.\


To make a long story short, after many network traces and a rather long call with Microsoft support the answer was actually rather simple.   Our customer was using a master page based on the “BlueBand” master page.  However there is a small issue with this master page.  If you look at it you will see


<body class=”body” onload=”javascript:_spBodyOnLoadWrapper();”>
 <WebPartPages:SPWebPartManager runat=”server” />
 <form runat=”server” onsubmit=”return _spFormOnSubmitWrapper();”>


Turns out that this is wrong.  By moving the “WebPartPages:SPWebPartManager” tag underneath the “form” tag everything worked fine!