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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

OrganizationServiceContext : The given key was not present in the dictionary

(0) ShareShare
ReportReport
Posted on by

Hi,

Im sorry for my trivial question, but I am a beginner in Dynamics365 programming.

I have this code:

using (OrganizationServiceContext orgSvcContext = new OrganizationServiceContext(_orgService))
{
var query_join = from c in orgSvcContext.CreateQuery("lead")
select new
{
  subject = c["subject"],
  fullname = c["fullname"],
  description = c["description"],
};

... ...
... ...

the code goes in error only for records with null value for fullname attribute, but I want get all records, also with null "fullname".

This is the error: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary

Could you help me?

Thanks.

Giuseppe.

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

    I have solved with:

    fullname = c.GetAttributeValue<string>("fullname"),

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans