Wednesday, June 3, 2009

How to test your workflow emails on a VM

I don't really want to install a mail server on my VM just to be able to test the emails that my Workflows generate. Instead you can do this in your web.config:

<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="c:\IncomingEmails\" />
</smtp>
</mailSettings>
</system.net>



ref: http://msdn.microsoft.com/en-us/library/ms164241.aspx

Tuesday, June 2, 2009

That assembly does not allow partially trusted callers.

So I ran into something to be aware of today. We have a couple of Custom Field Types that we have written. As with all SharePoint CFTs, their assemblies are deployed to the GAC.

Today I was writing a Control (a Web Part would apply here just the same) that is deployed to the Bin. While deploying it I kept getting the annoying error: "That assembly does not allow partially trusted callers". I had my CAS policies defined and had the '[assembly: System.Security.AllowPartiallyTrustedCallers]' attribute in my AssemblyInfo.cs but I realized that I was getting the exception when I was trying to access the field value of an item that contained my Custom Field Type column (item["my CFT"])!

This was a good reminder that all CFTs should have the [assembly: System.Security.AllowPartiallyTrustedCallers] attribute, just in case, since you never know when a Web Part or some other partially trusted code will need to access them in the future.