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.

Friday, November 2, 2007

Get the current user without writing code in InfoPath 2007

Itay Shakury wrote a great post about getting the current user in InfoPath without using code which would require to have the InfoPath form signed

Optimizing VS2005 speed

I found 2 interesting blog posts about optimizing the speed of VS2005 both at startup and during regular usage:

.NET Tip of The Day: Optimize the launch of the Visual Studio 2005

.NET Tip of The Day: Speed up Visual Studio 2005

Tuesday, October 30, 2007

AfterBuild target doesn't work when building a VB.net solution

It seems that the AfterBuild target is not being called when building a VB.net solution using MSBuild. It should be substituted for the AfterCompile target.
Is that right?

Changing a file's attribute from a MSBuild script

This is a pretty simple one but it took me a little time figuring it out as I don't have prior MSBuild experience. Basically, you just need to use the Exec with the command attribute

<Exec Command="attrib -R $(SolutionRoot)\myFile.ext" />

This will remove the read-ony attribute from the myFile.ext file in the solution folder.