“File Not Found” Error Creating Sites

Yesterday SharePoint greeted me with this error message when I tried to create a new site inside a site collection:

File not found.

I examined the ULS logs of the SharePoint server and I noticed that it tried to open the new web by name and it failed. The reason was a faulty Alternate Access Mappings entry, as shown here:

Exception type: System.IO.FileNotFoundException
Message: The Web application at http://whatever.domain.com/newsite could not be
found. Verify that you have typed the URL correctly. If the URL should be serving
existing content, the system administrator may need to add a new request URL
mapping to the intended application.

SOLUTION

I added the correct AAM entry in Central Administration, linking the external name (http://whatever.domain.com) to the internal name (http://servername).

IE and The Mysterious ‘The page took too long to save’ Message

Another one of those “oh my god” moments in SharePoint programming, although it had nothing to do with SharePoint proper.

The Background

I want to dynamically add a DIV alongside a SharePoint field in Publishing page. The intended purpose is to extend the built-in control without any server-side code. I want the DIV to hold a simple hand-crafted AJAX call to add new items.

Everything is okay, I add my code to the SharePoint _spBodyOnLoadFunctionNames.push function, I find the control to be extended and I yank the DIV from its previous location to the parentNode object of the control. It nicely shows the new DIV below the original control:

image

The DIV contains an anchor element that has href=”#” and onclick=”SomeFunction();”. It’s created dynamically when the page loads:

var link = document.createElement("a");
link.href="#";
link.innerHTML = "Agregar nuevo elemento";   
link.onclick = "SomeFunction();";
div.parentNode.appendChild(link);

The Symptoms

When you click the anchor in the added DIV, there’s a 30-second pause during which IE responds to no clicks, after which the following message appears:

Are you sure you want to navigate away from this page?

The page took too long to save. You can click “Cancel”, and then try to save the page again. If you click “OK”, you might lose unsaved data.

Press OK to continue, or Cancel to stay away on the current page.

image

After you click OK, the anchor works well, calling the SomeFunction flawlessly.

The First Suspect

I though that the issue was caused by another function I called, that uses “AJAX” call to owssvr.dll to filter cascading dropdown controls (more on that in next posts). It might leave the HTTP request in a undefined state so that the IE thinks it’s still not loaded.

I commented it out but the error persisted.

The Second Suspect

Then I thought that it has something to do with the appendChild method I use to move the DIV from its placeholder to the new position below the control it’s extending.

I changed the call to dynamically create a new DIV instead of moving the old one to a new position in DOM tree. But, the same error persisted.

The Real Culprit

After David Gutiérrez, one of my colleagues (whose mileage in JavaScript is much greater than mine) revised the code, and after a perfunctory “brain processing” period (which lasted about an hour, in this case), he appeared and outlined the malfunction.

The error message is caused by IE trying to “execute” the new onClick event, which is set to a JavaScript function in this case. But, the syntax is wrong, wrapped inside double-quotes, like in inline HTML.

link.onclick = "SomeFunction();";

The correct syntax is written just like a method call, using only the function name:

link.onclick = SomeFunction;

IE seems to “compile” the string into a method call, but only after you confirm that you want to navigate away. Weird enough.

“Unexpected Error occurred” when accessing Network Connection Properties

Following on the weird Windows XP network errors, such as the mysterious connecting to 1.0.0.0 site, I experienced another unexplained behaviour.

SYMPTOMS

"Unexpected error occurred." when trying to access Properties of a network connection in Windows XP

CAUSE

The corrupted Registry entries for the DLLs that manage network properties.

WORKAROUND

Re-register the DLLs into the Registry.

  1. Open a new command prompt (CMD).
  2. Type Regsvr32 %SystemRoot%System32netshell.dll
  3. Press OK.
  4. Type Regsvr32 %SystemRoot%System32ole32.dll
  5. Press OK.
  6. Reboot your machine

VMWare “Unable to save snapshot file”

I often try things on my SharePoint virtual machine that I keep on my laptop, hosted in VMWare Server environment. A few months ago suddenly it became impossible to suspend the machine, because every time I tried to do so, the following error message appeared:

Error taking snapshot: Unable to save snapshot in <Path>. Please verify that the directory exists and you have write permissions. Failed to suspend the virtual machine.

I thought it was caused by the insufficient permissions for the virtual machine folder. I tried to add my user as the owner of the folder but it didn’t solve the problem. Browsing on the VMWare forums, I found the solution here.

WORKAROUND

  • Ensure that your Virtual Machine is shut down
  • Check in the VM properties the folder where the snapshot files are stored (the Working Directory)

image

  • Make a subfolder inside that folder (for example, Snapshots)
  • Set the working directory of the VM to that subfolder

That’s it. It seems that cloning the VM from an existing VM sometimes has the unpleasant consequence of losing track of the working folder, even if it’s displayed correctly.

Internet Explorer “Connecting to site 1.0.0.0” and Page Not Found Error

A really weird error happened on one of my older computers, running Windows XP SP2. I successfully established a Wireless connection with an external USB adapter. I opened Internet Explorer and typed a valid address, just to see this strange message in status bar of the browser:

Connecting to site 1.0.0.0…

followed by the infamous Page Not Found screen.

I double-checked Internet Settings Connection tab in IE, I flushed the DNS caché using ipconfig /flushdns command, I disabled IPv6 protocol for the network connections, I reset the adapters….and nothing helped.

Then, searching on Google, I found a deus-ex-machina workaround the solution:

  • Download WinSock XP Fix 1.2 (alias WinSockFix) from here
  • Unzip and run the tool
  • Reboot the PC

winsockxpfix

It worked for me, at least. This tool resets the WinSock (low-level network layer of Windows) configuration to default Windows settings. I suspect that a "rogue" application ruined those settings and was uninstalled without reverting to the original ones, provoking that IE couldn’t make a valid DNS lookup.

Unable to Add Summary Links Web Part (Error 0x80070002)

Funny thing happened today when I tried to export / import a site from one site collection into another one. It asked me to close the Summary Links web part, which I did. I tried to add it manually (importing a .webpart file exported from the source site), and it gave me the following error:

Unable to add selected web part(s). Could not load XSL file. The system cannot find the file specified.(Exception from HRESULT: 0x80070002).

SOLUTION:

This error is usually raised when you try to add a publishing-related web part (such as Summary Links) into a non-publishing site. You have to either add it into a site built with a publishing template (Collaboration Portal or Publishing Portal), or to activate the publishing features manually:

  • Activate Office SharePoint Server Publishing Infrastructure feature in site collection features, in Site Collection Administration section of Site Settings page
  • Activate Office SharePoint Server Publishing feature in destination site features, located on Site Administration section of Site Settings page

Vista Enterprise Volume Activation Error 0x8007232B

I’ve been trying to activate my corporate Vista Enterprise license, as I reinstalled Vista in 64 bits mode. I tried to activate online and I met this error message from Windows Activation utility:


Code:
0x8007232B

Description:
DNS name does not exist.

First I thought that my proxy or firewall settings were wrong. However, the reason for this error is that Vista volume license images ship with a generic Product Key. You have to change this product key to match your company’s MAK (Multiple Activation Key).

I changed it and Vista activation was a breeze. If only Microsoft would change the nondescript error message with something like “Your Product Key has not been set. Please enter your Volume MAK key“. Maybe in SP1?

An unknown error has ocurred – One solution

Today I was setting up a fresh virtual machine with MOSS 2007 and I met the dreaded “An unknown error has ocurred” message after the SharePoint Configuration Wizard finished.

I traced it in the Event Viewer and it was a repetitive error such as this one:

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{61738644-F196-11D0-9953-00C04FD919C1}
to the user NT AUTHORITYNETWORK SERVICE SID (S-1-5-20). This security permission can be modified using the Component Services administrative tool.

I looked up in the Registry and found out that the CLSID in the message identified one “IIS WAMREG admin service”. Then, I opened the Component Services, DCOM Config and under the properties of WAMREG service component I allowed NETWORK SERVICE account local launch and local activation permissions (on the Security tab).

The MOSS 2007 fresh welcome was just one IISRESET away!

COM Again (0x81020037)

I found this “descriptive” error message in a fragment of MOSS 2007 code in a webpart that uploads and tags a document with appropriate metadata:

Microsoft.SharePoint.SPException: DOMAINuser has modified the file Sample.doc
System.Runtime.InteropServices.COMException (0x81020037)

The code 0x81020037 is “Save Conflict” error code in COM. The culprit:

SPListItem doc = list.Add();
doc[“Field1”] = “Value”;
doc[“Field2”] = “Value”;
doc.CheckIn(“Check-in Message”);
doc.Update(); <-- this is the line that throws the error I tried reversing CheckIn and Update methods, with no success. However, the following trick did the job: SPListItem doc = list.Add();
doc[“Field1”] = “Value”;
doc[“Field2”] = “Value”;
doc.CheckIn(“Check-in Message”);
doc = FindByTitle(doc.Title)
doc.Update();

FindByTitle is a custom method I wrote that finds a SPListItem in a SPList, performing a search on the Title field.

The explication: the underlying COM scaffolding doesn’t like the Update() method after CheckIn(). I had to “reacquire” the item and perform the Update() on this new reference to the same document.

Elementary, dear Watson….