Archive for the ‘Workaround’ category

Updating Content Editor Content with Word

May 19, 2009

There are a number of reasons why users might be using content editors for page content in a SharePoint site. However this creates a fair amount of overhead when users can’t get the content to ‘look just right’. Often without HTML edit abilities users become frustrated and will give up or push content out that has been akwardly formatted.

One of the ways you might try out to help with these kinds of issues is getting users to modify and update content editor content in word. I am going to go through how this can be done (relatively easily) in a few steps here. The important steps in the process is creating an HTML document (in this case I am using word, but you could use SharePoint Designer, or any product which pushes out HTML) and then getting the content editor webpart to reference the HTML document.

  1. First let’s create our web page content in word. It’s important to keep the size of the webpart in mind when we build the content and users MUST insert images as links (from the SharePoint site or internet) as embedded images won’t display. Here is an article on this: http://blogs.msdn.com/ecm/archive/2006/11/17/converting-office-2007-openxml-documents-with-embedded-images-to-sharepoint-web-pages.aspx *Note we are doing a process similar to smart client authoring/conversion. We are just doing it more manual for greater control/flexability.
  2. Save the word document as the HTML/HTM file type. You can do this simply by choosing SAVE AS and saving it under the HTML file type.
    SaveAsHTML
  3. Next we need to upload our HTML (or HTM) file to a SharePoint library.
  4. Navigate to the page you want the content to be displayed on and add a new content editor webpart.
  5. Now let’s edit the newly added content editor webpart’s properties. Namely the Content Link property and set that to reference the HTML or HTM file we just added. To do this you can right click the link in the document library and click copy shortcut and then paste the shortcut into the content link field.
    SaveShortCut
    ContentEditorContentLink
  6. Click OK and save the edited properties.
  7. Voila we should now see the content (built in word) showing on our webpage through the content editor. If we want to modify the content we just need to open the document in word, make our changes and save it to the server. Immediately updating the content on the webpart.

There are two advantages to using a process like this:

  1. You get content version history and version control. Normal webparts don’t really have version control, so by using a document libraries content like this we can enable versioning and go back to previous versions in case something mucks up.
  2. Any user with access to the content can change it just like a word document (more or less) making it require far less training and effort for people to update than the typical SharePoint methods that can cause alot of confusion.

Hope this helps someone who wants to use document conversion for SharePoint but needs a more flexable model for page content,
Richard Harbridge

Customize Look And Feel With Calculated Columns

April 14, 2009

Ever wanted to ‘Color Code’ a SharePoint calendar? Or have certain list items display differently then other list items based on their column values?

One of those things that every user needs is the ability to customize the look and feel of many SharePoint elements, and sometimes it just doesn’t make sense to wait for a SharePoint team, developers, or architects to work out a long term solution.

Sometimes you just need a quick and dirty way of doing something as a one off to illustrate a point or to deal with a situation while you work out the full solution.

My favorite ways of dealing with most of these things is the use of codeplex projects, jQuery, javascript, content editor webparts, and SharePoint Designer which I post pretty often about. It’s quick, normally easy to reverse, and can often be managed by a business user.

Another personal favorite of mine is a method that (to my knowledge) Christophe came up with using calculated columns, some conditions, simple HTML and a bit of JavaScript. All of which turns into completely customized (look and feel) views of lists. (Read his original article here: http://pathtosharepoint.wordpress.com/2008/09/01/using-calculated-columns-to-write-html/)

The concept is simple:
Using SharePoint calculated columns create conditional statements that display different HTML based on the value of the column. Then (because of how it is rendered) use JavaScript to transform the rendered content to it’s equivalent HTML.

The power of this is that it can apply to a great many different scenarios. Take for example one of the common requirements of ‘color coding’ a calendar. In Christopher’s post last november he cleverly illustrates exactly how you could do this with relatively little effort: http://pathtosharepoint.wordpress.com/2008/11/15/sharepoint-calendars-color-coding-hover-effects-etc/

image

This is a simple and effective way to deal with many look and feel issues quickly and easily. If used with a bit of direction this can really help users understand, consume, and review information much more quickly.

image

(Above image from another example of how it can be used: http://pathtosharepoint.wordpress.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/)

Update: Adorable little calculated column builder (based on what I describe in this post) – http://www.pathtosharepoint.com/HTMLcc/default.aspx. Could save you a bit of time.

Hopefully with a glance at some of these you can begin to see the usefulness and power such a method can provide for your SharePoint deployment, I know I use it fairly often and I am sure you will too,
Richard Harbridge

Creating a Localized Form in InfoPath 2007/InfoPath Form Services

February 17, 2009

Ronald Tielke released a nicely written article on msdn a short time ago on localizing and supporting languages in an InfoPath Form.

http://msdn.microsoft.com/en-us/library/dd425033.aspx#ip2007LocalizingForms_Introduction

I recently saw a presentation by Jim Schwartz at imason which displayed similar functionality (for a large form deployment). This has always been a bit of a difficult spot in working with InfoPath and it’s good to see some more content around it and support/patterns for developing localization.

Hope this saves someone time and effort when creating multiple language supported forms,
Richard Harbridge

Renaming Root “Title” Site Column – Powershell Example

February 12, 2009

The other day I had to correct a friends SharePoint site column and feel like tossing out a quick blog about it. Sometimes what happens is you begin digging into a content type, go a bit too far and modify the wrong site column, not the inherited one, but the actual title column used for an entire site collection.

Ok, so just change it back right? Unfortunately that’s when you will run into the message: “The column name that you entered is already in use or reserved.”

Microsoft has a nice support article on it here: http://support.microsoft.com/kb/923589 and many SharePoint community members have blogged about workarounds such as Bob Mixon (http://masteringsharepoint.com/blogs/bobmixon/archive/2008/08/22/have-you-ever-changed-the-top-level-site-title-site-column.aspx). Bob does a great job of outlining a Powershell script here that can be easily used to update the column.

Here is the script Bob provides. I have tweaked it to ensure the web and site objects are properly disposed of (http://blogs.msdn.com/sharepoint/archive/2009/02/11/sharepoint-and-powershell-knowledge.aspx).

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
#Replace the siteurl with your targeted site collection url.
$siteurl = “URL of top-level site”

$spsite=new-object Microsoft.SharePoint.SPSite($siteurl)
$spweb=$spsite.OpenWeb()
$spfield=$spweb.Fields.GetFieldByInternalName(“Title”)
$spfield.Title = “Title”
$spfield.Update()
$spweb.Dispose()
$spsite.Dispose()

PowerShell for Windows 2003 SP1 can be downloaded from here:
X86 – http://go.microsoft.com/fwlink/?LinkID=75790&clcid=0x09
X64 – http://go.microsoft.com/fwlink/?LinkID=75791&clcid=0x09

Hope this helps someone,
Richard Harbridge

Name.dll Prompt in IE 7 Fix (Feature, and Easy Deployment)

December 1, 2008

Great news! Ever receive that name.dll prompt on a SharePoint site of yours when viewing in IE 7?

This issue occurs if the Name ActiveX control (Name.dll) is not added to the list of preapproved controls in Internet Explorer 7. The Name ActiveX control is included in the 2007 Microsoft Office system. http://support.microsoft.com/default.aspx/kb/931509

The way to fix it? They have 3 ways, add the site to trusted sites, change the registry, or modify each master page.

Typically option 3 is most appealing. (Quick note, make sure you comment all function lines in their example, it is wrong and if you don’t will result in a js error.) However it has a significant drawback. Imagine how much effort it would take to update hundreds of site collections with many customized master pages?

The good news is that just a short time ago Larry J. Riemann wrote a terrific feature for codeplex based off of Randy Drisgill’s workaround (in response to issues people were having): http://blog.drisgill.com/2007/09/fixing-namedll-activex-problem-mossman.html

The feature (which makes me happy) is located here: http://www.codeplex.com/SPAXO

What is great about this feature is that it is scoped to the web application level so the number of site collections, and sub sites don’t matter. What’s more the way it’s designed should not be effected by any customizations or the number of master pages. Making it a very appealing resolution.

Find out more about the codeplex activex override at Larry’s blog here: http://lriemann.blogspot.com/2008/11/sharepoint-activex-override-module.html

Warning: Through testing this feature I have noticed it causes critical errors when using InfoPath Form Services.

Thank you Randy and Larry we all appreciate it,
Richard Harbridge

Excel Services Compatibility Checker

November 20, 2008

Answered a post in the forums today and realized I had never blogged about this. There is a beta of an excel services compatibility checker available here: http://blogs.msdn.com/cumgranosalis/pages/excel-services-compatibility-checker-download-page.aspx

This is a great tool that can help you pin point why your excel file may not work with excel services. (The error message is pretty generalized.)

If you want to know what is supported and not supported in Excel Services simply read over this Microsoft article: http://office.microsoft.com/en-us/sharepointserver/HA101054571033.aspx

Hope this helps someone,
Richard Harbridge

Calculated Column Dynamically Updated (When using [Today])

October 3, 2008

Today I was asked a fairly common question that everyone who uses calculated columns eventually runs into. “How do you get a column to calculate automatically when using a reference for a date, or something that dynamically changes like [Today]?” Out of the box this isn’t available because the calculated columns ONLY calculate when an item is updated.

The solution is simple, you write a custom solution that updates all items as desired. So this could be something that runs daily or every time you view the data (using a dashboard). You could even write the code so it adds and removes the column instead of iterating through the items. Do some performance testing to see which is faster in your case.

A terrific Article was posted by Dink that answers exactly how to do it too with free samples: http://www.sharepointblogs.com/dez/archive/2008/07/31/dynamically-updating-a-sharepoint-calculated-column-containing-a-quot-today-quot-reference.aspx

There is also a post here by Chris where he uses the DataView and JavaScript: http://pathtosharepoint.wordpress.com/2008/08/25/a-countdown-for-tasks-lists/

Hopefully this helps someone out,
Richard Harbridge

This form template is browser-compatible, but it cannot be browser-enabled on the selected site.

August 27, 2008

So there are lots of posts on this error and forum discussions. I am just going to add one important note. Close InfoPath 2007 and re-open it before trying to publish the form.

It seems simple but I just forgot to do that and lost 10 minutes thinking the fixes didn’t work, and realized duhh I hadn’t closed the InfoPath application and re-opened it before trying again (must store/cache something related to the message). So… make sure you close and re-open InfoPath yo.

So high level overview of how to fix this error:

Error Message when trying to publish a browser-enabled InfoPath form (check box grayed out) – “This form template is browser-compatible, but it cannot be browser-enabled on the selected site.“

IF not using Enterprise Edition of MOSS:

  1. Install Microsoft Office Forms Server 2007 (independent product) on the SharePoint box if the Office server suite you use is lower than Enterprise (or if you are using Windows SharePoint Services 3.0). The Forms Services support is included in the Enterprise Office Server suite.
  2. After installed Forms Server, you’ll have a InfoPath Forms Services section at the Application Management page. To go here, click on Start -> Administrative Tools -> SharePoint 3.0 Central Administration and choose the Application Management tab on the top of the page. Click on Configure InfoPath Forms Services in the InfoPath Forms Services section and check both “Allow users to browser-enable form templates” and “Render form templates that are browser-enabled by users” checkboxes, then click the OK button on this page.
  3. Open your SharePoint site, click on Site Actions -> Site Settings, select Site collection features under Site Collection Administration and activate InfoPath Forms Services support or Office SharePoint Server Enterprise Site Collection feature.
  4. Start designing your form with the InfoPath 2007 client. In InfoPath, click on Tools/Form Options, select the Compatibility category and check the “Design a form template that can be opened in a browser or InfoPath“, then click OK. In the case if you miss this one and your form is browser-compatible, you get a warning message while publishing your form saying that “The server is running InfoPath Forms Services, but the compatibility settings for this form template is InfoPath only“.
  5. Make sure that your form is browser-compatible. You can use the design checker task pane in the InfoPath 2007 client to perform this task.
  6. Publish your form onto a SharePoint 2007 library. In the wizard, at step 3, check the “Enable this form to be filled out by using a browser” checkbox and finish publishing.
  7. If the check box is still grayed out (and showing error) CLOSE info path 2007 and re-open it and try again.
  8. At the end of the publishing wizard, select “Open this document library” and click on Close. This will open the document library in the browser. Click on Settings/Form Library Settings, then click on Advanced Settings and select the “Display as a Web page” option in the Browser-enabled Documents category. If you don’t choose this option, the form will be opened in InfoPath if it’s installed on the client. Otherwise, it’s going to be opened in the browser.

If SharePoint 2007 with Enterprise License:

Run the following commands to force deactivating and activating the Forms Services feature:

  1. stsadm -o deactivatefeature -filename IPFSSiteFeatures\feature.xml -force -url <<Target URL>>
  2. stsadm -o deactivatefeature -filename IPFSWebFeatures\feature.xml -force -url <<Target URL>>
  3. stsadm -o activatefeature -filename IPFSSiteFeatures\feature.xml -url <<Target URL>> -force
  4. stsadm -o activatefeature -filename IPFSWebFeatures\feature.xml -url <<Target URL>> -force

In the above stsadm command lines <<Target URL>> would be the url of your site collection. Example: “http://portal/sites/sitecollection&#8221;. Keep in mind that one of those features is scoped at the web level, so if it’s a sub site you need to activate that there, with the other one at the site collection level.

Then Close and re-Open InfoPath and try to publish, it should now work fine.

Oh and if for some reason neither of these work (god help you) also try deactivating and reactivating the site collection feature “Office SharePoint Server Enterprise Site Collection features” via the interface. Sorta does the same thing, but also ensures that the FormServerTemplates library is created appropriately.

Hope this helps someone,
Richard Harbridge

Total Calculated Columns in SharePoint

July 22, 2008

Out of the box SharePoint does not allow you to create totals in a SharePoint view for calculated columns or calculated fields.

Here is a work-around to total a SharePoint Calculated Columns or the Calculated Fields. (Note this will also create subtotals when using Group By options in a standard list view.)

Let’s say we have a field called PROFIT that is a calculated field set to subtrack the expense field from the revenue field in our list. ([Revenue]-[Expense])

  1. Create a regular number field (or currency field) called TOTAL PROFIT (or any other name you want) in that list.
  2. Using SharePoint Designer create a workflow for your list that runs when list items are created and when list items are changed.
  3. The workflow will have only one step name it something like set TOTAL PROFIT.Leave the condition field blank.
  4. In the action section choose “Set field in the current item”.
  5. Click on the word “field” and choose TOTAL PROFIT (the name of our column).
  6. Click on the word “value” and click on the “fx” button to do a lookup.
  7. Choose “Current Item” for the source.
  8. Choose “PROFIT” for the field. (This is the calculated column.)
  9. Click Finish.

Now whenever someone creates or modified a list item in that list the non-calculated field will automatically be updated with the data from the calculated field.

This means that by adding the TOTAL PROFIT field to any view you can total it and get a sum or any other calculation since you are no longer using a calculated field (directly).

Hope this helps someone,
Richard