I am trying to fetch the audit history of a user from CRM. My code is shown below. However at run time i get an exception "audit With Id = c011f583-8741-e211-bce3-78e7d1622fbb Does Not Exist".
Am I missing something?. Please suggest.
Entity entUser = (from name in context.CreateQuery(Constant.SystemUser.EntityLogicalName)
where name.GetAttributeValue<string>(Constant.SystemUser.FullName) == "Sample"
select name).FirstOrDefault();
var auditDetailsRequest = new RetrieveAuditDetailsRequest
{
AuditId = entUser.Id
};
using (OrganizationServiceProxy organizationProxy = CRMHelper.GetServiceProxy())
{
var auditDetailsResponse = organizationProxy.Execute(auditDetailsRequest);
}