如何理解错误日志,我该如何解决?

时间:2019-06-11 05:34:54

标签: c# dynamics-crm microsoft-graph microsoft-dynamics microsoft-graph-sdks

每当在Dynamics365中创建帐户时,我都会编写一个后期操作插件来创建计划者计划。我使用Microsoft图形API调用了计划程序API,但出现此错误,无法理解。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ServiceModel;
using System.Runtime.Serialization;
using Microsoft.Xrm.Sdk;
using Microsoft.Identity.Client;
using Microsoft.Graph.Auth;
using Microsoft.Graph;

namespace SamplePlugin1
{
    public class FollowUpPlugin:IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            //Extract the tracing service for use in debugging sandboxed plug-ins.
            ITracingService tracingService =
                (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)
                serviceProvider.GetService(typeof(IPluginExecutionContext));

            // The InputParameters collection contains all the data passed in the message request.
            if (context.InputParameters.Contains("Target") &&
                context.InputParameters["Target"] is Microsoft.Xrm.Sdk.Entity)
            {
                // Obtain the target entity from the input parameters.
                Microsoft.Xrm.Sdk.Entity entity = (Microsoft.Xrm.Sdk.Entity)context.InputParameters["Target"];

                // Verify that the target entity represents an account.
                // If not, this plug-in was not registered correctly.
                if (entity.LogicalName != "account")
                    return;

                try
                {
                    string clientId = "7178dasdasdd";
                    string secret = "UZasdsadasd8";
                    ClientCredential clientCredential = new Microsoft.Identity.Client.ClientCredential(secret);
                    IConfidentialClientApplication clientApplication = ClientCredentialProvider.CreateClientApplication(clientId, clientCredential);
                    ClientCredentialProvider authProvider = new ClientCredentialProvider(clientApplication);

                    GraphServiceClient graphClient = new GraphServiceClient(authProvider);

                    var plannerPlan = new PlannerPlan
                    {
                        Owner = "8e01sd44-sadasdgssd46d",
                        Title = "title-value"
                    };

                    var ret = graphClient.Planner.Plans
                       .Request()
                       .AddAsync(plannerPlan).GetAwaiter().GetResult();

                    if (ret == null)
                    {
                        throw new Exception("Error while creating planner record");
                    }
                }
                catch (Exception ex)
                {

                    tracingService.Trace("FollowupPlugin: {0}", ex.ToString());
                    throw;
                }

            }
        }
    }
}

我遇到以下错误, 指定的域不存在或无法联系 ISV代码发生意外错误。 这是相同的日志文件 http://p.ip.fi/qQL6

注册插件时,我仅使用一个文件,即build文件夹中的SamplePlugin1.cs。我也需要注册其他dll文件吗?

0 个答案:

没有答案