InfoPath 2010 – Working with Image Buttons Tip

So, I realised yesterday that it’s been a very long time (a year!) since I last posted something to my blog.   I have been working on a couple of major pieces of work  which didn’t leave much time to think!

So on with my stream of 2013 entries then ….

I have been redesigning my company’s expense form in InfoPath 2010 and one of the issues I have come across is the handling of Image Buttons.  InfoPath 2010 does not do this very well.  Pretty badly actually.

The problem is that Image Buttons can bloat your form template quite quickly, to the point it is 10mb before you know it.

I have used Image Buttons in my form as tabs:

Image

And I am using these on at least 4 other Views.   And this is how it looks in the design mode:

Tab Row Design

As you can see I am using 4 different versions of 4 different buttons – one for when a tab is not currently selected, one when the tab is selected, one when there are validations on the view and the tab is not selected, and one where the tab is selected and there are also validations on the view.

InfoPath renames each image you insert to something else.

And when you copy this section of images onto the other views InfoPath, for each new each Image Button that has been pasted, creates new image files in the packed InfoPath XSN file therefore causing the file itself to bloat.  Why can InfoPath not just realise you want to use the same image file?

So the work-around that I know of is long and painful, but in order to reduce your XSN file size you need to

  1. Make a note of the name of the images used on the Image Buttons on each view in the designer
  2. Take a copy of the file (in-case you mess it up), rename the file extension from XSN to ZIP
  3. Unpack it
  4. You’ll then see all of the images you have used inc. duplicates with the different names
  5. Make a note of which copies you want to use
  6. Open each view using Notepad or some other text editor.  The views have an extension – xsl
  7. Within each view file you should then find the image names you made a note of in step 1
  8. Rename the Image names to the ones you want to use from step 5
  9. You can then delete the images no longer used from the unpacked file (keeping a note of the names)
  10. Update the Manifest.xsf file – removing the image names from step 9.

Test.

Once you have done this remember not to copy/paste the section/image buttons in the designer again other-wise you will need to go through the above steps once again.

Painful process and if someone has an easier method please let me know.

 

Unable to display this Web Part – XSLTListView and XSLTDataView web part issues in IE – RESOLVED

Just posting this for anyone that has been shot in the foot by the latest December CU for SharePoint 2010.

This is from the Microsoft article KB2639184 :

Create a list or library in SharePoint 2010. Open the list / library in SharePoint Designer. Close and hide the XSLTListView Web part on the page. Insert a DataForm web part on the page. If the list contains a large number of columns or custom XSL has been applied to the DataForm web part the following error message may be displayed:

“Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.”

You will also see System.StackOverflowException errors in the SharePoint log.

Now this issue arose after the installation of the June CU.  Microsoft in their wisdom reduced the timeout for XSLT transformation from 5 seconds to 1 second without giving the administrator the option of increasing it manually via Powershell.  The reduction is a securtity measure to reduce the risk of successfull DoS attacks.  However if you have an internal SharePoint installaton (which many companies do) this new change is fairly pointless.

The timeout essentially causes any modified XSLTListViewWebPart and XSLTDataViewWebParts to error intermittently when viewed in the browser.

However it was meant to have been fixed in the August CU.  Here is the major issue … Installing the December CU breaks the fix from August!!  I would recommend you DO NOT INSTALL the December CU until the next (February?) CU or hotfix is released.

The solutions offered by Microsoft are at this page: http://support.microsoft.com/kb/2639184.  However none of those options are particularly viable for us.  What we need is a hotfix and I will post an update should I get hold of one.

UPDATE:

there is now a hot fix available from Microsoft to resolve this issue,  you need to log a call with them and ask for sharepointfoundation2010-kb2597136-fullfile-x64-glb.exe

Once installed use the Powershell script below to make the change to the Timeout value.  Changing it to 2 seconds for us worked and the webparts are now showing fine.

SAMPLE PowerShell to set XsltTransformTimeOut

===========================================

$farm = Get-SPFarm

$farm.XsltTransformTimeOut = 5

$farm.Update()

Cheers,

Pete.

SharePoint 2010 Users Unable to Edit Page Content and Add Web Parts

Ok, so found a strange “feature” with SharePoint 2010.

The scenario goes like this:

You have a new Intranet, setup your Intranet Owners (who have full control from Site Collection Level down) and created some new SharePoint groups for content managers.

You then give the Content Managers groups Read Access to the top site collection and the Design permission level to the relevant pages (or folder in the Pages library) that you want them to be able to edit.  (incidentally, a major change from SharePoint 2007 here – you can now only have ONE Pages library in a publishing site).

You then find the users in those groups cannot actually edit their page content or add web parts.

What you need to do is create a new Permission Level at the top site collection, that only has “Add and Customise Pages” (plus the other required permissions that get added when you enable that one).

Then give the Content Managers groups this Permission Level to the Top Site Collection.  You can also restrict their permissions to the pages you do not want them to access in the Pages library.

People Matches not Showing on FAST SharePoint 2010 Search Page

So, if you have ever thought you did not need certain profile properties in SharePoint 2010 and decided to delete them you may find that some things no longer work as expected.

The properties you SHOULD NOT delete all have internal names starting with “SPS-”.  So if you deleted SPS-Location for instance, you may find your People Matches web part on the search results page no longer works.  You will also find the Profile pages no longer load.

There is a way to rectify this though and you need to start by following a post at this link which details how to recreate SPS-Location.  If that link no longer exists then the details are bulleted below:

  • Create a new Property with name like “SPSLocation” (leafe the ‘-’ after ‘SPS’). In this way the propertyname will be accepted. Now just start your SQL-Server Management Studio, select and edit the appropriate record in you profile database. In my case I used the following SQL:
  • Using this SQL to select the appropriate record (Ensure that you only get 1 result-line!!!): SELECT * FROM PropertyList WHERE PropertyName=’SPSLocation’;
  • Using this SQL to edit the appropriate record: UPDATE PropertyList SET PropertyName=’SPS-Location’ WHERE PropertyName=’SPSLocation’;

Now you will still find People Matches does not work, until you add a metadata property and perform a full crawl…

Go to Central Admin, Application Management, Manage Service Applications.

Click on your FAST search query service.

Click on Metadata Properties from the left hand side

Click New Managed Property

Enter BaseOfficeLocation as the Property Name

Add a new mapping to People:SPS-Location(Text)

Leave everything else as is and click OK

Now edit ContentsHidden and add the same mapping

Start a full crawl

when the crawl has finished you should now see People Matches working as it should be.

Note to self – disable propeties, do not delete them!