static void Main(string[] args)
{
Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(@"Url=http://xxxxxx/CRM2015Test/; Username= ; Password= ;");
Console.WriteLine("Connecting...");
// Obtain an organization service proxy.
// The using statement assures that the service proxy will be properly disposed.
using (var _orgService = new OrganizationService(connection))
{
WhoAmIResponse resp = (WhoAmIResponse)_orgService.Execute(new WhoAmIRequest());
Console.WriteLine("My UserID is: " + resp.UserId.ToString());
Console.Write("DONE!!");
Console.ReadKey();
string strFetchXML = @"<fetch>
<entity name='account' >
<attribute name='name' />
<link-entity name='principalobjectaccess' from='objectid' to='accountid' link-type='inner' alias='poa' >
<attribute name='objectid' alias='objectid' />
<link-entity name='team' from='teamid' to='principalid' link-type='inner' >
<link-entity name='teamtemplate' from='teamtemplateid' to='teamtemplateid' >
<attribute name='teamtemplatename' />
</link-entity>
<link-entity name='teammembership' from='teamid' to='teamid' link-type='inner' intersect='true' >
<link-entity name='systemuser' from='systemuserid' to='systemuserid' link-type='inner' >
<attribute name='fullname' />
</link-entity>
</link-entity>
</link-entity>
</link-entity>
<filter type='and'>
<condition attribute='name' operator='eq' value='China' />
</filter>
</entity>
</fetch>";
EntityCollection entColAccessTeamMembers = _orgService.RetrieveMultiple(new FetchExpression(strFetchXML));
}
}
{
Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(@"Url=http://xxxxxx/CRM2015Test/; Username= ; Password= ;");
Console.WriteLine("Connecting...");
// Obtain an organization service proxy.
// The using statement assures that the service proxy will be properly disposed.
using (var _orgService = new OrganizationService(connection))
{
WhoAmIResponse resp = (WhoAmIResponse)_orgService.Execute(new WhoAmIRequest());
Console.WriteLine("My UserID is: " + resp.UserId.ToString());
Console.Write("DONE!!");
Console.ReadKey();
string strFetchXML = @"<fetch>
<entity name='account' >
<attribute name='name' />
<link-entity name='principalobjectaccess' from='objectid' to='accountid' link-type='inner' alias='poa' >
<attribute name='objectid' alias='objectid' />
<link-entity name='team' from='teamid' to='principalid' link-type='inner' >
<link-entity name='teamtemplate' from='teamtemplateid' to='teamtemplateid' >
<attribute name='teamtemplatename' />
</link-entity>
<link-entity name='teammembership' from='teamid' to='teamid' link-type='inner' intersect='true' >
<link-entity name='systemuser' from='systemuserid' to='systemuserid' link-type='inner' >
<attribute name='fullname' />
</link-entity>
</link-entity>
</link-entity>
</link-entity>
<filter type='and'>
<condition attribute='name' operator='eq' value='China' />
</filter>
</entity>
</fetch>";
EntityCollection entColAccessTeamMembers = _orgService.RetrieveMultiple(new FetchExpression(strFetchXML));
}
}
No comments:
Post a Comment