ShareBlog

Gary Bushey's Blog
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.

Posted: Fri, Feb 15 2013 8:53 by gary | with no comments
Filed under:
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!

Posted: Mon, Jul 9 2012 10:27 by gary | with no comments
Filed under:
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

Posted: Tue, Feb 28 2012 9:54 by gary | with 2 comment(s)
Filed under:
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

 

Posted: Wed, Mar 30 2011 10:13 by gary | with no comments
Filed under: ,
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.

Posted: Sat, Jul 31 2010 7:42 by gary | with no comments
Filed under:
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.

Posted: Thu, May 6 2010 14:45 by gary | with no comments
Filed under:
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.

Posted: Sun, Sep 6 2009 16:40 by gary | with no comments
Filed under:
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. Smile   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.

Posted: Tue, May 5 2009 11:19 by gary | with no comments
Filed under:
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="BLOCKED SCRIPT_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!

SharePoint 2010 - I want to start a trend

Since we called Microsoft Office SharePoint Server 2007 MOSS what are we going to call Microsoft SharePoint Server 2010?   MSS is already taken as an acronymn (Microsoft Search Server) but I would bet it catches on in the general population.  I was thinking we would call it "Mizz S" or "Missus".   Maybe take some leeway with the acronym and call it "MiSS"?  Any other ideas?

 

SharePoint 2010 - the year we make contact?

Well, assuming the release schedule that Microsoft just posted is actually correct we will.  Now if only they would start releasing tidbits as to what we can expect in the product.

So no more MOSS, or SharePoint Portal Server.  Now it is just SharePoint!

http://www.microsoft.com/presspass/features/2009/Apr09/04-15Office2010.mspx

Other good tidbits in there other than SharePoint also.

Best SharePoint site ever!!!

Well, maybe not the best technically....or graphically, but you have got to love the subject matter!   Big Smile

 

http://www.ferrari.com/Pages/Country_selector.aspx

Posted: Mon, Mar 30 2009 7:38 by gary | with no comments
Filed under:
Working with quotes in XSLT

I have a XSLT file where I need to pass strings to javascript.   Due to the way the code is written the string designator is the single quote.  Typically that is not an issue but what happens if the text you pass in contains an apostrophe, AKA single quote?  You will need to perform a translation within XSLT to change the apostrophe to &quot;    Now comes the fun part.  Here is a XSLT translation:

<xsl:value-of select="translate(.,'a','A')" />

so how to you tell XSLT that you want to translate a single quote into the &quot;  After trying various combinations of escapes and multiple single quotes I found that

<xsl:value-of select="translate(.,&quot;'&quot;,'&quot;')" />

works.  What a pain!

Make sure to check out the Microsoft Incentives web site

Kind of like sales on Microsoft licenses:

http://www.microsoftincentives.com/

 

For a limited time only!   15% off L&SA - Exchange Server Standard, Office Communication Server Standard, SQL Server Standard, Office SharePoint Server, Visual Studio Team Suite, Office Project Standard, Office Project Professional, Office Visio Standard and Office Visio Professional. 25% off L&SA: Exchange Server Enterprise, Office Communication Server Enterprise, Windows Server Enterprise and Sever Management Suite Enterprise (SMSE).

Posted: Fri, Mar 13 2009 13:24 by gary | with no comments
Filed under: ,
Cannot unregister UpdatePanel with ID '' since it was not registered with the ScriptManager and MOSS

I have run into this while trying to get the AjaxControlToolkit working with MOSS.  Turns out there are a couple of things that can cause this.  The first is using CreateChildControls to create your controls.  While this is typically a best practice in this case it can cause an error.   You can create your controls in the OnInit call instead.

The second one, and the most annoying is any other error thrown but not caught.  This took a while to figure out and can be a real pain if you do not have the ability to debug remotely.

Final word of warning, watch out for that quirky mode in Internet Explorer.  It can be a real pain!

Sending data from javascript to a .Net object

Recently I came across an issue where I had checkboxes outputted via XSLT (which only outputs HTML) but needed to have the values of the selected checkboxes sent to a C# object.  After banging my head against the wall and trying various schemes I remembered that JavaScript can be used to perform a postback.  Now if there was only some way to pass data when performing the postback.  Turns out there is.

In JavaScript you can use the call  "__doPostBack(variablename, value);" to perform the postback and send the variable along with it.  For instance,

__doPostBack("ShareBlog","Rocks");

 

performs a postback, sending the variable "ShareBlog" with the value "Rocks".

In your code (C# in my case) you can read in this variable and use it as you will

 

Page.ClientScript.GetPostBackEventReference(this,"arg");

if (Page.IsPostBack)

{   

   string eventTarget = Page.Request["__EVENTTARGET"];  

   string eventArgument = Page.Request["__EVENTARGUMENT"];  

   if (eventTarget != String.Empty && eventTarget == "ShareBlog")  

   {     //do what you will with the eventArgument   }

}

 

Note that you would replace "Shareblog" in the second if statement with the name of your variable you used in the "__doPostBack" statement.

No mapping between account names and security ids was done

I just created a new SQL Server 2008 server with Hyper-V and was in the process of setting up my VMs complete with AD.   When I got to the point of adding a SQL Server 2008 to the mix I recieved the above error when I was trying to add the domain users as the service owners.   Another odd thing was when I tried to add a domain account to a local security group it would say the user was added however I would not see the account show up in the group.

After rebuilding my AD and SQL 2008 VMs a few times I realized that when I ran SYSPREP on my baseline image I did not check the box called "Generalize" which removes all unique information like the SID.   Hence, it appeared that I was running 2 machines with the same SID.   After rebuilding my baseline image and running SYSPREP the correct way everything worked correctly.

 

Posted: Thu, Feb 19 2009 9:37 by gary | with no comments
Filed under:
Great news in the world of Business Intelligence and SharePoint

"PerformancePoint scorecarding and dashboarding capabilities will now become part of SharePoint Enterprise CAL and available to customers who are on SharePoint SA. This means that customers who want to deploy PerformancePoint can do so today at no additional cost. "

Read the full story at the SharePoint Team Blog

http://blogs.msdn.com/sharepoint/archive/2009/01/23/microsoft-business-intelligence-strategy-update-and-sharepoint.aspx

Posted: Fri, Jan 23 2009 14:02 by gary | with no comments
Filed under:
Limiting who can create a MySite

I have had a few customers ask how they can control who can create a MySite, whether it was just for a trial run, to try to control hard drive usage, or for other reasons.  In any case here is how you can do it

  1. Open the "Central Administration" web site
  2. Go to your Shared Service Provider's Administration page
  3. Click on the "My Site settings" link
  4. On the left side of the screen click on the "Personalization Services Permissions" link
  5. In this screen you can take away the "Personal Site" from "NT AUTHORITY\Authenticated Users" and add it to any User or Group that you want to.

Without the "Personal Site" permissions, users will not see the "My Site" link and will not be able to create a My Site.

 

 

Posted: Tue, Jan 20 2009 9:48 by gary | with no comments
Filed under:
More Posts Next page »