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

  • Home
  • SEARCH
  • 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 9274747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:25:29+00:00 2026-06-18T16:25:29+00:00

Problem: We use the CRM for Outlook plugin to automatically log our support emails,

  • 0

Problem: We use the CRM for Outlook plugin to automatically log our support emails, but internal emails between employees (some of which contain sensitive information) are also being logged.

Ideal Solution: I am attempting to write a pre-event (the “create email” message) plugin to block the automatic logging of internal emails, but (apparently) the only way to stop a message from being executed is to throw an exception in the pre-event phase, but this always results in an error message being shown in outlook (which we obviously can’t have). According to the documentation, only the “InvalidPluginExecutionExeception” is supposed to show messages to the user, but this is not the case as all exceptions result in an error message in the user’s Outlook application.

Potential Solution: There is also a “CheckPromoteEmail” message that (according to the documentation) determines whether or not an email should be promoted to the CRM (I assume “promoted to CRM” means “make an email entity to store in CRM”), but I couldn’t find anything in the context that would let me tell CRM to not promote the email. Is there some flag buried in the context that I can set, or some way to invlaidate the email so the CRM’s own logic decides to not store it?

Workaround Solution: The only other solution that I am aware of (mentioned here) to just clear the subject and contents of the email after it has been created, but I would rather stop the email from being created in the first place than editing or deleting it after time and resources have been wasted creating the email.

Is there a clean way to stop an operation from a plugin? Or from anywhere? If there isn’t, does anyone know why Microsoft didn’t provide this feature? They already have ironclad rollback functionality under the hood in case an operation fails, why don’t they just give me a way to call the rollback?

Here’s my code in case it’s helpful in answering my question:

public class InternalEmailFilter : IPlugin
{
    void IPlugin.Execute(IServiceProvider serviceProvider)
    {
        IPluginExecutionContext _context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
        Entity e = (Entity)_context.InputParameters["Target"];
        bool shouldStore = ShouldStoreInCRM(e);

        if (shouldStore == false)
        {
            throw new Exception(); //attempting to stop the operation without an InvalidPluginExecutionException, but still results in error message to user
        }            
    }

    protected bool ShouldStoreInCRM(Entity e)
    {

           List<Entity> parties = new List<Entity>();

            var atttributes = e.Attributes;
            if (atttributes.ContainsKey("to") == true) parties.AddRange((atttributes["to"] as EntityCollection).Entities);
            if (atttributes.ContainsKey("from") == true) parties.AddRange((atttributes["from"] as EntityCollection).Entities);
            if (atttributes.ContainsKey("cc") == true) parties.AddRange((atttributes["cc"] as EntityCollection).Entities);
            if (atttributes.ContainsKey("bcc") == true) parties.AddRange((atttributes["bcc"] as EntityCollection).Entities);

            foreach (Entity p in parties)
            {
                if (p.LogicalName == "activityparty" && p.Attributes.ContainsKey("addressused") == true && p.Attributes["addressused"] != null)
                {
                    if (p.Attributes["addressused"].ToString().ToLower().Contains("@ourdomain.com") == false)
                    {
                        return true; //someone connected in the email is not an employee, store the email
                    }
                }
            }

            return false;  //everyone was an employee, do not store          
    }
}
  • 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-18T16:25:31+00:00Added an answer on June 18, 2026 at 4:25 pm

    After much blood, sweat, and tears I finally figured out how to do this:

    You have to use an async post-event plugin on the “Create email” message to delete the email from the DB with the CRMService after it has been created. It has to be asynchronous because you need to wait for the CRM finish creating and ‘let go’ of the entity before you can delete it. Otherwise, the process hangs.

    Any of these solutions would have been better, but for reference, you cannot:

    1. Throw an exception in the pre-event to cancel the create/promote email operation without either showing the user an error message or wreaking havoc on their Outlook. Even though only the InvlaidPluginExectuionExecption is supposed to show a message to a user, all exceptions show error messages to users.
    2. Block the promotion of an email to CRM. The CheckPromoteEmail message pre-event (amazingly) gives no information about the message to be potentially promoted (so there’s no data to use to decide if the message should be promoted) and there is nothing to use to tell CRM to not promote the message. And, if you use the pre/post-event and try and use the Output params and change the ShouldPromote flag there, it does nothing.
    3. Clear the body content of an email before an Entity is created for it – any changes you make to the body content in the pre-event don’t stay with the execution context and are lost when the core operation begins.

    Maddening.

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

Sidebar

Related Questions

We use CRM 4.0 at our institution and have no plans to upgrade presently
i have problem use link_to_remote link_to_remote document example say link_to_remote Delete this post, :update
I had a Problem to use DotNet 4.0 DLL in a DotNet 2.0 Application,
well this is my problem i use 2 source first query (select * from
I'm new in codeigniter I have problem I use my OS X Lion, and
I have assignment to work on producer and consumer problem by use thread and
Okay, so here's my problem: We use FOP for creating pretty report output. We
I have quite a problem concerning the use of relational database concepts in Delphi
I am having a problem trying to use the prependTo() function in jQuery... for
i am having this problem try to use the cocos2d CCScrollLayer I have added

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.