Monday, December 31, 2007

Uploading a file using Dojo

I was trying to upload a file using and async request with the dojo.xhrPost call. I kept getting an error from my server script (CFMX 7) saying that the contentType was wrong as it was expecting "application/x-www-form-urlencoded" but it was expecting "multipart/form-data".
It was then brought to my attention that you cannot upload a file using xhrPost. You have to use either dojo.io.iframe.send() or dojox.xhrMultiPart.
I tried the dojo.iframe.send() approach and it worked just fine. The javascript looks like this:
dojo.require("dojo.io.iframe");
dojo.io.iframe.send({
method: "post",
url: "process.cfm",
handleAs: "html",
timeout: 3000,
handle: AddEditCallback,
form: dojo.byId('myForm')
});

Tuesday, December 18, 2007

Item Templates not showing up in VS2005

I recently converted the WebPart template provided by Microsoft from C# to VB (Microsoft didn't release a VB version and we are, unfortunately, standardized on VB).
After converting the code and placing it in the appropriate folder (C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\VisualBasic\SharePoint\), the template was still not showing when creating a new project. This was because the templates cache had to be refreshed. I was able to solve this thanks to a post by Eric Hammersley (Missing an item template in Visual Studio 2005? Try this...)

The secret was just to open a VisualStudio Command prompt and run the command

devenv /installvstemplates

Thursday, December 6, 2007

The application-specific permission settings do not grant Local Activation permission for the COM Server application

This error can be found in the Event Viewer. It can be solved in 3 steps: identify the application using the registry, grant local activation using the Component Services console, restart IIS. Below are the details copied from Mike H's blog post (I changed the service affected to reflect the problem I had to resolve):
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID

{BA126AD1-2166-11D1-B1D0-00805FC1270E}

to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20). This security permission can be modified using the Component Services administrative tool.

Copy the GUID following the CLSID above, and Start-->Run-->regedit

With the registry editor open, ensure that your cursor is on the computer at the beginning of the tree (make sure you are not in the middle of some previous edit session in the registry editor).

Edit-->Find and paste in the GUID. It'll stop at the application entry - and you will want to note the application name on the right side pane. In this example, it was the Netowrk Connections Manager service that popped up.

Now, open Component Services (typically, from the server - Start-->Administrative Tools-->Component Services), expand Component Services, Computers, My Computer, DCOM Config. Scroll down and find the application (netman in this case). Right-Click-->Properties and select the Security tab. You'll have some options here - the first block Launch and Activation Permissions - ensure that the Customize radio button is selected, and click Edit. Now, add your service account - giving it launch and activate - and in some requirements - remote launch / activate permission.

Restart IIS and continue on.