想知道是否有人可以提供幫助。我們已經編寫了大量標註與Microsoft CRM 4.0一起使用,這些都可以正常工作,並且和預期的一樣。但是我們注意到,每次出現一個標註錯誤時,錯誤消息都會顯示給用戶(如預期的那樣),但也會放入Windows事件日誌的「應用程序」選項卡中。這不是一個大問題,但是它會填滿事件日誌。有沒有辦法停止發佈到事件日誌的標註錯誤?標註,並顯示錯誤消息的Microsoft CRM 4.0應用程序事件日誌錯誤
實施例顯示給用戶和事件日誌:
public override PreCalloutReturnValue PreSetState(CalloutUserContext userContext, CalloutEntityContext entityContext, ref int newStateCode, ref int newStatusCode, ref string errorMessage)
{
try
{
switch (entityContext.EntityTypeCode)
{
case Constants.TASK:
TaskCode taskCode = new TaskCode(ref _oServ, userContext.UserId);
task oTask = taskCode.GetTask(entityContext.InstanceId,
new string[]{"activityid",
"new_isdiscountauthorisation",
"new_discountstatus",
"regardingobjectid",
"isworkflowcreated"});
//*** only certain people able to update tasks (including owner) ***
if (!taskCode.PermitUpdate(userContext.UserId, entityContext.InstanceId))
{
errorMessage = "Only priveleged users and the owner of this task are permitted to update it";
return PreCalloutReturnValue.Abort;
}
break;
etc...................
etc...................
}
}
catch (Exception ex) { Utilities.LogError(ex, userContext.UserId); }
return base.PreSetState(userContext, entityContext, ref newStateCode, ref newStatusCode, ref errorMessage);
}