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.