After a short panic attack, I tried to figure out which records were deleted. Since we are dealing with CRM Online, it is not possible to take a look into the database. So what else could I do? Then, I found out that the Audit for deletion is more powerful than I thought.
For a moment, it looked like “Oh CRM audited that I deleted a very important lead.” Later, I figured out that the record might not be available as an existing record, but the information of all audited fields was still there:
So, I started searching for a way to get this information. In the CRM SDK I found the RetrieveAuditDetailsRequest. This Request requires only the audit Id to get the audit details. Therefore, you first have to query for audits. In my case: leads deleted on 2/4/2016.
After that, you have to execute the RetrieveAuditDetailsRequest with the Id of the audit entity previously queried. The RetrieveAuditDetailsResponse contains the AuditDetail, which being casted to AttributeAuditDetail, contains the deleted Entity as OldValue property.
Now, you can do what you have to do with this information, e.g. restore the data via creating the old value again.
I think with this knowledge it is pretty easy to restore deleted data in CRM. Very important in this context is of course the enabled auditing. Furthermore, fields which are not enabled for auditing will not be restored either.