我记得这个问题,当我调试SharePoint online REST API调用时,它总是会崩溃。然后我添加了跟踪服务和日志检查点来验证代码执行路径。我将下载Profiler trace log&replay in PRT以查看成功或失败分支,而不是进行调试。
当您将插件跟踪配置为日志时
全部
在“系统设置”下,它的开发模式将非常有用。
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
try
{
tracingService.Trace("Attempting to obtain Phone value...");
phone = account["telephone1"].ToString();
}
catch(Exception error)
{
tracingService.Trace("Failed to obtain Phone field. Error Details: " + error.ToString());
throw new InvalidPluginExecutionException("A problem has occurred. Please press OK to continue using the application.");
}
Reference
就你而言:
if(responseMessage != null)
{
tracingService.Trace("API call success & got responseMessage.");
}
else
{
tracingService.Trace("responseMessage was empty.");
}