title: How to cancel create an cativity action on ms crm 4.0?
body: <p>i have a plugin for an activity.</p>
  
  <p>on pre create i check few conditions and if i get true so i throw OperationCanceledException for stop the create execution.</p>
  
  <p>but the record was saved, why? how do i can to cancel the creation? also tried to throw InvalidPluginExecutionException, but it's stil executed..</p>
  
  <p>the code:</p>
  
  <pre><code> public void Execute(IPluginExecutionContext context)
      {
          try
          {
              switch (context.MessageName)
              {
                  case "Create":
                      if (context.Stage == MessageProcessingStage.BeforeMainOperationOutsideTransaction)
                      {
                          bool shouldnotcreateactivity = Create(context, service);
  
                          if (shouldnotcreateactivity)
                              throw new OperationCanceledException();
                      }
                      if (context.OutputParameters.Properties.Contains("id"))
                      {
                          //continue...
                      }
                      break;
              }
          }
          catch (OperationCanceledException cancled)
          {
          }
          catch (InvalidPluginExecutionException invalid)
          {
          }
          catch (SoapException ex)
          {
          }
          catch (Exception ex)
          {
          }
      }
  </code></pre>