Skip to main content
Boman.Biz

Boman.Biz

Go Search
Home
Mobile Monger
  

Boman.Biz > Categories
SharePoint 2010–Rich Text Validator Bug

This one is not particularly exciting, but it might help someone wanting confirmation.  It seems that SharePoint 2010 still has a few bugs that need to be fixed and my colleague Adrian actually found this one:

On any SharePoint 2010 site:

  1. Create a new Custom List
  2. Add a Multi-Line Text Box field
    1. Set type to “Rich Text (Bold, italics, text alignment, hyperlinks)”
    2. Set Required to true.
  3. Create a new item
  4. Don’t put any data in and press save

The validators fire for title and the new field but also there is a JavaScript bug:

Invalid argument on Line: 2 Char: 141544 in sp.ui.rte.js

or if you have debug switched on:

Invalid argument on Line 7353 in sp.ui.rte.debug.js

SharePointOOBError

This is still a problem after the December 2010 CU.

*** PROCEED WITH THE FOLLOWING AT YOUR OWN RISK ***

If you need an interim fix then we need to fix the offending JavaScript, and doing this breaks my SharePoint Golden Rule No. 6 – Never Modify the OOB files.  However if you need to do it then you might do something like this:

  1. Navigate to your LAYOUTS folder, usually at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
  2. Make a copy of SP.UI.Rte.debug.js and SP.UI.Rte.js to restore for later when this is fixed in an update. (Restore your vanilla copy before running any subsequent CU’s or Service Packs)
  3. Edit the SP.UI.Rte.debug.js around line 7353 …. from this:
    parentElement: function() {ULSkay:;
        var $v_0 = this.$8;
        if ($v_0.parentElement) {
            var $v_2 = $v_0.parentElement();
            var $v_3 = RTE.DomHelper.createRange(window.document);
            if ($v_2) {
                $v_3.moveToElementText($v_2);
            }
            while ($v_2 && !$v_3.inRange($v_0)) {
                $v_2 = $v_2.parentNode;
                try {
                    $v_3.moveToElementText($v_2);
                }
                catch ($$e_3_0) {
                }
            }
    
    
    To look like this:
    parentElement: function () {
            ULSkay: ;
            var $v_0 = this.$8;
            if ($v_0.parentElement) {
                var $v_2 = $v_0.parentElement();
                var $v_3 = RTE.DomHelper.createRange(window.document);
                if ($v_2) {
                    try {
                        $v_3.moveToElementText($v_2);
                    } catch (gonk) {
                        //Do Nothing - SharePoint Bug.
                    }
                }
                while ($v_2 && !$v_3.inRange($v_0)) {
                    $v_2 = $v_2.parentNode;
                    try {
                        $v_3.moveToElementText($v_2);
                    }
                    catch ($$e_3_0) {
                    }
    
  4. Save your changes and copy SP.UI.Rte.debug.js over the top of SP.UI.Rte.js – remembering that you have backups of both of these files to restore before applying future updates.

When testing this, make sure you clear your browser cache.

I really hope they fix this before or in SP1!


UPDATE: Have started a thread on MSDN to see if gets any bites: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/50df5a23-c7c5-4e8b-859f-2a86ef137eb2/


UPDATE 21-Feb-2011:

I have packaged this fix up into a WSP package for easy installation, and more importantly uninstallation prior to installing subsequent cumulative updates or service packs:

De-Sandboxing the Word Web App in SharePoint 2010

Installing the Office Web Applications on your SharePoint 2010 installation is definitely a Good Thing – however when using the Word Viewer in SharePoint we found many documents would display messages like:

image

Word Web App cannot open this document for viewing because of an unexpected error. To view this document, open it in Microsoft Word.

There are a number of basic things to check immediately but none of them seemed to solve our problem.

Looking up the correlation token in the ULS logs reveals:

Librarian.SetCompleted(F0c7d1d5fd3234162833d31e20d3e9687m473392a6ecac4b85890f990f6b262c55m0846e19754004739ad93720821134224m, Silverlight, docdata.xml) - status = ConversionError

So the Word Viewing Service Application is having trouble converting the document into Silverlight to send to the client.  So what now? – We found sometimes opening the document in Word, saving in 2003 format, re-saving in DOCX back to the library sometimes fixed it, but not for very long and not a very practical solution.

Some digging revealed the Word Viewing Service Application is in sand-boxed mode, which must limit its ability to convert documents.

Found an obscure post here, where one of the suggestions was to de-sandbox the Word Service App.  The poster of the question didn’t seem to have a clue – but I thought I would give it a go. Issuing the following from the Sharepoint 2010 Management Shell seems to fix the problem, although not sure exactly if this is recommended from a security point of view.

$e = Get-SPServiceApplication | where {$_.TypeName.Equals("Word Viewing Service Application")}

$e.WordServerIsSandboxed

$e.WordServerIsSandboxed = $false

$e.WordServerIsSandboxed

IISRESET

Should show you if your Word Web App was sandboxed.

Later I have also discovered that if you install SharePoint 2010 on a domain controller that you may need to do the same thing to PowerPoint:

#(Please use the below script for PowerPointServiceApplication - You need to enter "Y" for the answer of each cmd)
Get-SPPowerPointServiceApplication | Set-SPPowerPointServiceApplication -EnableSandboxedViewing $false
Get-SPPowerPointServiceApplication | Set-SPPowerPointServiceApplication -EnableSandboxedEditing $false

Some posts from the 2010 Beta era also recommend making modifications to the disable the application/zip MIME type – but having not experienced any issues related to it, I won’t do it without reason.

In the server's c:\windows\system32\inetsrv\config\applicationHost.config
Add the line below in the end of the dynamicTypes.
<add mimeType="application/zip" enabled="false" />

Hope it helps some people out!

Workflow Office Task and the additionalNodes error

While wrangling SharePoint workflows, sometimes it is necessary to gain finer grain control over how a task approval process works.  Sometimes you need to handle you own parallel/serial approvals, or collect a majority of approvals etc.  In these cases you need to use the Microsoft.Office.Workflow.Actions.OfficeTask to gain control over each part of the task assignment and approval.

image

When doing this (and later trying to help a colleague with this) I encountered the following problem after the task passes the OnTaskAssigning sub-activity. 

The workflow will error with:

"Specified argument was out of the range of valid values. Parameter name: additionalNodes"

After posting to some lists, I found basically no help in the Internet for this problem and there was much head-banging, but in the end I found this error is actually caused when the workflow engine attempts to serialize your class to put it to sleep when preparing to wait for the task approvals to roll in.

In my case on closer inspection of my assembly, I had a public member of type SPUser which is not serializable by the workflow engine that was causing my class not to serialize.  Mark it as private and your good to go.

My advice to you if you get this error, go through your code-behind with a fine-toothed comb looking at any public property or member with an eye towards serialization.  Needless to say, I think the content of this error message is abysmal, and workflows in general are very tricky to debug.

Hope it saves someone some time!

J.

SharePoint Workflow tips for n00bs (like me)

Here are a couple of nuggets that I have learned while trying to get into SharePoint/Project Server workflows:

  1. If you are having trouble debugging your workflow and Visual Studio is showing you an old stale version of your workflow design surface in file from temp\Live.Workflow.tmp<number>.xoml then you need to do a few steps between each deployment:
    - Close Visual Studio
    - Stop IIS (IISRESET /STOP)
    - Delete the contents of C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root
    - Delete the contents of C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies
    - Start IIS again (IISRESET /START)
    - Load up Studio, attach and try again.
  2. Be really careful about the public properties of your workflow – make sure all properties are serializable.  I had a property of type SPUser that caused my Workflow to fail in mysterious ways.

Happy Workflowing!

J.

SharePoint 2010: Some or all identity references could not be translated

Okay so my first SharePoint 2010 experience was not 100% positive – as it seems the there are no shortage of funny little problems.

One of the thing I tried to do was to use the Register Managed Account screen.  After entering in the username and password for the account I wanted to register I got the message:image

The specified user DEV001\svcSharePointServiceApp could not be found. Some or all identity references could not be translated.

 

As per usual – the error message has no significance in relation to the actual cause.  It turns out that if you reduce the length of the service account to 20 characters or less the problem goes away.  Seriously – varchar(20) for usernames? Yikes.