Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8645833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:39:05+00:00 2026-06-12T12:39:05+00:00

I want to edit the E-mail template in my Dynamics CRM 2011 solution. I

  • 0

I want to edit the E-mail template in my Dynamics CRM 2011 solution.

I will add a combo box to the form that allows a user to decide what classification the email should be eg. “A”, “B” or “C”

This helps our email gateway know what to do with certain mail with regard to archiving etc. Also setting the header will make it harder for a user (recipient) to declassify (lowering a classification) which could easily be done if we just shoved the classification in the subject line (and yes I understand we are still vulnerable to copy and paste but try telling my client that).

Just before the email is sent is there an event where I can get the mail item and add mail headers and also manipulate things like the subject line or some other editable field.

I have written an Outlook Add-in that runs this code on send and basically want to know where I should put similar code in Dynamics.

    private Dictionary<string, List<string>> _classifications;

    private const string ProtectiveMarkingSchemaName = "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/X-Protective-Marking";

    private const string Version = "0.1";
    private const string Namespace = "xyz.com";


void ApplicationItemSend(object item, ref bool cancel)
    {
        // GUARD
        if (!(item is MailItem)) return;

        if (ClassificationDropDown.SelectedItem == null ||
            String.IsNullOrEmpty(ClassificationDropDown.SelectedItem.Label))
        {
            cancel = true;
            return;
        }

        // CURRENT ITEM
        var mailItem = (MailItem)Globals.ThisAddIn.Application.ActiveInspector().CurrentItem;

        // PREPARE MARKING
        var origin =
            Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;

        var classification = new StringBuilder();
        classification.AppendFormat("SEC={0}", ClassificationDropDown.SelectedItem.Label);
        if (DisseminationDropDown.SelectedItem != null)
        {
            if (!String.IsNullOrEmpty(DisseminationDropDown.SelectedItem.Label))
            {
                var cat = DisseminationDropDown.SelectedItem.Label;
                classification.AppendFormat(", CAVEAT={0}", cat);
            }
        }

        // FILTHY HACK
        if (mailItem.Subject == null)
        {
            mailItem.Subject = " ";
        }

        // FIND OLD MARKINGS
        var start = mailItem.Subject.IndexOf('[');
        var end = mailItem.Subject.LastIndexOf(']');
        if (end - start > 0)
            mailItem.Subject = mailItem.Subject.Remove(start, (end - start) + 1);

        // APPLY MARKING
        mailItem.Subject = String.Format("{0} [{1}]", mailItem.Subject.TrimEnd(), classification);
        mailItem.PropertyAccessor.SetProperty(
            ProtectiveMarkingSchemaName,
            String.Format("[VER={0}, NS={1}, {2}, ORIGIN={3}]", Version, Namespace, classification, origin));
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:39:06+00:00Added an answer on June 12, 2026 at 12:39 pm

    I have a ticket in with Microsoft at the moment but their initial response is that this cannot be done.

    Their suggested solution is to use rules on the mail gateway to add the header information which solves that problem if I only want to write the same header info but becomes more complex if I want variable values in the headers.

    I had a look a Greg’s suggestions and while they were a good learning exercise for me I could not find a solution there.

    It is possible to write a workflow that does this but then I would have to account for all the other junk that CRM does when is sends mail and frankly the documentation is a bit sketchy around what I would need to do but my best guess is something like this.

    • Use ribbon editor to hide the original send button
    • add a dropdown to the email form with the choices
    • add a new send button with javascript that launches a workflow
    • write a workflow that takes the email looks for the header value field and jams that into the headers
    • then sends it on.

    I don’t know if this will automatically close the activity or if it retains its context eg (activities in cases, accounts etc) or if this method affects audit so will probably have to account for those things

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MFMailComposeViewController wherein I want to edit the mail body, but I
I want to edit the Velocity Report generated with Visual Studio 2010s scrum template.
I want to edit UITabbarItems during the view life time. The background is that
Dynamically I want to edit/update hosts(etc/hosts) file to add domain. To edit hosts(etc/hosts) file
the form is still submitted. if i want to use your code and add
I want to create a gridview form a class and send that gridview as
I want to show the selected ID data in the form and EDIT it
I want edit multiple strings at once by selection the list of strings needs
I want to edit links when the user changes the value of a <input
I want to edit .vimrc file from Vim and apply them without restarting Vim.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.