function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

C# OfficeToolkit sample code (please ignore the lame url!)

I thought it would be a good idea to start posting up some of the sample code I have laying around for how to use the OfficeToolkit in various platforms.

The first one (this one) is a c# project that performs a bulk mail merge using the app exchange api.

The mail merge bit is pretty much the production mail merge code renamed and reworked a little and is also included (vb 6).

As a bonus, if you install the salesforce offline edition from

you can see how to use the offline api to generate your merge results, but please do not call salesforce support if you have a problem, it is not an official salesforce product.

The projects are installed to

prog files\\Bulk Mail Merge

comments are always welcome!

Thanks very much for posting this very helpful sample.  A few questions:

(1) When you say it is pretty much the "production" code, do you mean the production mail merge code that exists on salesforce when the user clicks the "Mail Merge" button from within an activity (i.e. goes to /mail/mmchoose.jsp...), or the code that exists in the Office Edition Toolkit addin that inserts merge fields into Word documents?  The reason I ask is because...

(2) If I want to customize this code to include the ability to merge a custom object and it's associated line item objects (since this is not currently supported for custom objects), but wanted to invoke this function from within salesforce like the current mmchoose.jsp, what would be the best way to do this? Could I convert some of the code to run from an Ajax script that got invoked from a custom link or would it be better to run it in its current dll form somehow from an external server?

I do mean the production code that runs when you use the online app (the names have been changed to protect the innocent).

It would be possible to create your own custom vb component that could run under the production system, but that’s just the first step.

You would still need the dataset you require as it’s just not available through the merge servlet. You would have to pull that data separately through the api.

THEN you would have to put the support into the vb bit to use the new data. That should not be that hard, but it would require a fair rework of the current line item only system (basically looking for custom start and end tags).
How would I run a custom vb (or c) component under the production system?  I thought the only way to run custom code was either through Ajax or linking to an external server?  And by pulling the data through the api and putting support into the vb or c app I assume you mean adding code to do the merge for my custom object that is currently not one of the supported entity types (i.e. Account, Contact, Opportunity, Lead, or User)?

Message Edited by gsickal on 02-01-2006 04:10 PM

The production mail merge code is just a com object, so if you have your custom object (which the correct id's etc) registered on the system it would be used in place of the production one.

That said, you would need to build your object and deploy it to your users.

If your really interested i can prob get you the production code (assuming no one freaks out) that has the correct signatures.
I would definitely be interested in the production version or at a minimum the correct signatures/classids to install my com object to replace the production one (If it's not too much of a problem to get it as you say).  What I am planning to do is modify it to support merging the details fields for my custom detail object using the start and end tags.  Thanks
Why don't you email me directly and we can go from there.