web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

C# difficulty retrieving Audit history details, getting

(0) ShareShare
ReportReport
Posted on by 5

Hello,

I set up a question over at Stackoverflow concerning my code to pull the audit history of an entity, However it is returning an exception and I don't know how to correct it.

https://stackoverflow.com/questions/67028578/ms-dynamics-365-c-sharp-audit-history-keynotfoundexception

I am able to connect and enter the loop but the first pass returns no values and the second throws the exception

System.Collections.Generic.KeyNotFoundExemption: The given key was not present in the dictionary.

Now, as far as I know, I'm using the correct AttributeLogicalName but I don't know how to handle this exception.

Any ideas?

I'm not a programmer by trade and we're left to our own devices because IT doesn't see this as a priority project, but it has to get done so please be gentle. 

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi Sweepster,

    You can check the code that following link provide:

    How to get Audit Details from MS CRM (C#.NET) – Friyank Parikh Blog (wordpress.com)

    Using RetrieveRecordChangeHistoryRequest to get Audit Detail in Dynamics 365 CE – Nishant Rana's Weblog

    Or you can try to use Audit History Extractor (Audit History Extractor  · XrmToolBox) to extract Audit history details for one entity, which is one tool for XRM ToolBox.

    (1) Download XRM ToolBox. https://www.xrmtoolbox.com/

    (2) Once you have downloaded and installed it, then connect to you crm environment.

    (3) Go library to install Audit History Extractor.

    pastedimage1618212953056v1.png

    (4)Open Audit History Extractor.

    you need click 'Get entities' button to load all entities that has enabled audit, then you can choose one entity and set other filters.

    Clicking 'preview data' button, you can view date in the right pane.

    pastedimage1618213103320v2.png

    Or you can refer following link to get the audit log of an entity by using a web API:

    (+) How to get the audit log of an entity in CRM 2016 using a web API - Microsoft Dynamics CRM Forum Community Forum

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Community Member Profile Picture
    on at

    Hi Partner,

    Has the problem been solved? Any updates?

    Please click Yes under "Did this answer your question?" to close this thread.

     pastedimage1618392869990v1.png

    Thanks. 

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Suggested answer
    Nishant Rana Profile Picture
    11,325 Microsoft Employee on at

    Make sure correct schema name of the attribute is used along with null check..

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 54 Most Valuable Professional

#2
11manish Profile Picture

11manish 26

#3
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 13 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans