SharePoint

Javascript error “Library not registered” or “Element not found” in Sharepoint

These errors appear when trying to use some javascript enabled features in SharePoint. The error is triggered when running the command IMNControlObj.OnStatusChange=IMNOnStatusChange; inside of init.js. This command triggers a call to the Name.NameCtrl.1 ActiveX Control. This control is contained within name.dll which is included with all office installations. A conflict is caused when attempting to load this library due to a broken reference inside of the windows registry. In my experience this is common when upgrading from Office 2003 to Office 2010, as the references to the new name.dll are not updated.

To solve this issue you must run the repair wizard from within an office application, the process of which will depend on the version installed. I will use Word as an example since it is the most popular case.

Word 2003

Enter the Help menu, then select Detect and Repair. Make sure “Discard my customized settings and restore default settings” is checked.

Word 2007

Click the Office button, select Word Options, goto the Resources tab and finally, Diagnose.

Word 2010

Office 2010 products don’t have any repair function available. However, the old repair feature from previous versions of word are still accessible through code, and will solve our problem.

Create a macro. Under the View tab, select View Macros. Enter a macro name, “RunRepair” for example, and click Create. The script editor will open with a stub Sub created for you. Edit the code so it resembles the following:

Sub RunRepair()
    Application.CommandBars.FindControl(ID:=3774).Execute
End Sub

Save your macro and return to the View Macros window. Select your macro and click Run. The repair wizard should appear. Make sure you check “Discard my customized settings and restore default settings” before running the wizard.

Solution: Checked Out Items or Documents When Uploading Multiple Documents in SharePoint

I came across a situation where I was uploading multiple documents into a SharePoint library using the multiple upload interface as well as the Explorer view. In both situations the documents would be uploaded, but they would all be checked out.

This is caused by two things:

1. You have at least one column in the library configured to be a required field.

In the case where multiple documents are uploaded, you are not prompted to fill in these required fields, as you normally would when uploading a single document. As a result the document is viewed as “incomplete” by SharePoint.

2. Under the library’s Version Settings, “Require Check Out” is set to “Yes”.

Even if the library has no required fields, if this value is set to true, your batch uploaded documents will be initially checked out.

The Right? Solution

Instinctively the proper solution would be to have a workflow trigger on item creation that simply checks in the document. However we run into a problem: Sharepoint will not initiate workflows on checked out items until they are checked in.

Crap.

The Ghetto Solution

Configure your required fields to be optional. Add a default value to them to be applied to your newly uploaded items.

Set “Require Check Out” to “No” under Versioning Settings in the document library’s settings.

You can now do a batch upload of documents, and they will appear in you library as checked in. Any workflows you have that are triggered upon document creation will successfully run.

What makes this solution so ghetto is that you now have to go back into your document library settings and revert the changes you initially made. So set your fields back to being required, changing their default values if needed. And set “Required Check Out” back to its initial value.

In case you are worried, existing documents will not be affected by these changes to the settings. So documents that are already checked out, or have different field values will be safe. Your document library will behave just as it originally did, assuming you correctly reverted the settings.

Removing or Hiding the Approval and Collect Feedback Workflows in SharePoint

When a user wants to initiate a workflow for an item in a workflow they are presented with a page that lists all the available workflows for that item type.

By default, SharePoint will display the “Approval” and “Collect Feedback” workflows for items of the “Document” type.

In order to remove these workflows from this, or any other item type you must do the following:

  1. Goto into the Site Settings of your parent site in your site collection.
  2. Under the Galleries column, goto Site Content Types.
  3. You will now see a list of all the content types for this site collection. Select the content type you wish to remove the workflows from. In this case we will select Document.
  4. We want to manage the workflows for this content type, so select Workflow Settings.
  5. Select Remove a Workflow.
  6. You should see the workflows in question listed with 3 choices: Allow, No New Instances and Remove.
    • By selecting no new instances, existing workflows will be allowed to complete, without allowing any further to be started.
    • By selecting remove you will simply remove all associations that workflow has with that item type, terminating any pending workflows.
  7. Select Remove for bother Approval and Collect Feedback Workflows and click OK.

This will prevent the workflows from appearing in the workflow initiation page for those content types.

Embedding FLV Flash Movies into your SharePoint site

FLV files are simply a container movie file, and in order to present them to the user in a manner in which they will be able to control the playback of the movie you need to wrap them in an SWF playback control. Embedding flash video into a SharePoint site isn’t that much different than doing it in any other site. The only challenge is figuring out where and how the required files will be hosted and made accessible by the SharePoint site and its users.

I’m assuming you already have an FLV file, if not there are several converter applications available that will create FLV files out of common video formats. The next step is to find an FLV player that will present the video on our site. There are several third party FLV players available, many for free although some require licensing for commercial use. I’ve listed some here:

Each player has their own way of embedding, in this example I will use JW player. They have a neat tool on their site that you can use to generate the code needed to embed your video.

The player does require several files to be hosted and made readable by the user who will have access to the videos. You can create a dedicated document library and upload the appropriate files included in the FLV players package and then use the absolute URL in your embed code to reference them. Be sure that the users who will be watching the video have read access on the document library the FLV player files are stored in.

You then create a content editor web part in which you want the video to appear in and place the embedding code in the source editor. Here’s an example of JW Players embedding code:

<script type="text/javascript" src="http://www.mysite.com/JWPlayer/swfobject.js"></script>
<div id="mediaspace">This div will be replaced</div>
<script type="text/javascript">
  // <![CDATA[
  var so = new SWFObject('http://www.mysite.com/JWPlayer/player.swf','mpl','220','165','9');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('file','http://www.mysite.com/test.flv');
  so.addVariable('image','http://www.mysite.com/previewimage.jpg');
  so.addVariable('stretching','fill');
  so.write('mediaspace');
  // ]]>
</script>

In this case I placed all the FLV player files in the JWPlayer directory on “mysite” and am referencing the FLV file I want to have played.

Configure Windows SharePoint Services Search Service Settings

By default, the search service is disabled in WSS 3.0. In order to enable it, goto your SharePoint Central Administration page and under the Operations tab, goto the “Services on the Server” list and click on WSS Search.

  • Service Account – You cannot use any built in accounts when specifiying the Service Account, however you can use local accounts. One account you can choose to use is the default Administrator account on your server, “myserver\Administrator”.
  • Content Access Account – Use an account that has full read access to your SharePoint Content Databases. As a security precaution, try not to use an account that has write permissions on the database. For example: “mydomain\sqlserveruser”.
  • Search Database – In most cases the default settings will work, change them as required.
  • Indexing Schedule – No new files will be searchable until they are indexed, depending on the load you wish to put on the server you can set this to be done as often as you want.

Upon submitting the form, the search service should start and begin indexing the content in your SharePoint site. Now would be a good time to install the Adobe IFilter to allow your search service be able to index PDF files, the earlier you install it the better, since it will only recognize PDF files added after the addon was installed.