사용자가 계정을 만들 때마다 시스템 사용자 엔터티에 필드를 채우려고합니다. 그 특성을 채울 수 있도록 시스템 사용자 엔터티를 검색 할 때 오류가 계속 발생합니다. 다음과 같이 내 코드는 다음과 같습니다새 계정 생성시 CRM 2011 업데이트 시스템 사용자
public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracingservice = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(context.InitiatingUserId);
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
try
{
//Get entity that fired plugin
Entity entMain = (Entity)context.InputParameters["Target"];
//Make a String for the last activity entity
String strLastEntity = "";
//Make the entity for the user entity
Entity entUser = (Entity)service.Retrieve("systemuser", context.InitiatingUserId, new ColumnSet(new String[] { "new_lastactivityentity" }));
//Get the entity type that fired the plugin and set it to the right field for the user entity
if (entMain.LogicalName.Equals("account"))
{
strLastEntity = entMain.LogicalName;
entUser["new_lastactivityentity"] = strLastEntity;
}
}
catch (Exception ex)
{
tracingservice.Trace("FollowupPlugin: {0}", ex.ToString());
throw;
}
}
}
오류 : 파일이나 어셈블리를로드 할 수 없습니다 'PluginRegistration을, 버전 = 2.1.0.1, 문화 = 중립, PublicKeyToken = null이'또는 해당 종속성 중 하나. 시스템이 지정된 파일을 찾을 수 없습니다.
시스템 사용자를 얻는 방법을 다른 사람이 설명하여 속성을 업데이트 할 수 있습니까?