Quantcast
Channel: Jason Lattimer's Groups Activities
Viewing all articles
Browse latest Browse all 869

Plugin triggered when adding a sharepoint document

$
0
0

Hello Folks,

I'm trying to develop a plugin that fires when a sharepoint document is added to a CRM entity.
So for that I developed a plugin that is supposed to be triggered on a post operation creation on the entity SharePoint document that is described in this link: <<here>>https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/entities/sharepointdocument

Unfortunately, the plugin does not seem to trigger when I add a document.

Here is the way I have registed the step of the plugin:

And here is the code of the plugin:

namespace CEP.Crm.Plugins
{
    using System;
    using System.ServiceModel;
    using Microsoft.Xrm.Sdk;
    using CEP.Crm.Plugins.Manager;

 

    /// <summary>
    /// PostSharePointDocumentCreate Plugin.
    /// Fires when the record is created
    /// All Attributes
    /// </summary>    
    public class PostSharePointDocumentCreate : Plugin
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PostAccountUpdate"/> class.
        /// </summary>
        public PostSharePointDocumentCreate()
            : base(typeof(PostSharePointDocumentCreate))
        {
            base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, "create", "sharepointdocument", new Action<LocalPluginContext>(ExecutePostSharePointDocumentCreate)));

          
        }

                protected void ExecutePostSharePointDocumentCreate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            try
            {

                IPluginExecutionContext context = localContext.PluginExecutionContext;
                IOrganizationService orgService = localContext.OrganizationService;
                Entity inputEntity = (context.InputParameters != null && context.InputParameters.Contains("Target")) ? (Entity)context.InputParameters["Target"] : null;
                if (inputEntity == null)
                    return;
                throw new Exception("I'am in the plugin");
            }
            catch (InvalidPluginExecutionException iex)
            {
                throw iex;
            }
        }
    }
}

Does anybody could see why this plugin is not triggered when I had a sharepoint document from the ocument area of a CRM entity (account for example) ?

Is the plugin attached to a wrong entity ?

I use the server based sharepoint integration and the version of Dynamics 365 is Version 1612 (9.0.1.621) (DB 9.0.1.425) online.

Thanks in advance for your help,

Emmanuel Barache


Viewing all articles
Browse latest Browse all 869

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>