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 :
Microsoft Dynamics CRM (Archived)

Checking Team membership

(0) ShareShare
ReportReport
Posted on by 265

I'm attempting to put together a small C# app that just checks if the current user is a member of a dynamics team. Based on my attempts so far and stuff I've found I've got the following:

 IOrganizationService Service;

               QueryExpression teamQuery = new QueryExpression("team");

               ColumnSet teamColumnSet = new ColumnSet("name");

               teamQuery.ColumnSet = teamColumnSet;

               teamQuery.Criteria = new FilterExpression();

               teamQuery.Criteria.FilterOperator = LogicalOperator.And;

               teamQuery.Criteria.AddCondition("name", ConditionOperator.Equal, "sunshine");

               teamQuery.AddLink("teammembership", "teamid", "teamid").AddLink("systemuser", "systemuserid", "systemuserid").LinkCriteria.AddCondition("systemuserid", ConditionOperator.Equal, User.Identity);

               EntityCollection teamDetail = service.RetrieveMultiple(teamQuery);

The issue I have is that service.RetrieveMultiple(teamQuery) has an error that "the name service does not exist in the current context." How do I instantiate service in the above example? Or if you have a better example that would be great too.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Pramod M Profile Picture
    1,445 on at
  • Suggested answer
    Hosk Profile Picture
    on at

    you need to create a connection to your CRM instance with valid user credentials

    then from that connection you can get an IOrganisationService

    You should read the CRM SDK but the link below is part of the SDK that does CRUD (Create, Read, Update, Delete)

    msdn.microsoft.com/.../gg328416.aspx

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans