Hi Michel
Thanks for the reply. I've enclosed a snippet of the code below. If you need more, let me know. I'll check the version of the SDK also
[HttpGet]
[Route("Interview/getInterviews")]
public List<Interviews> getInterviews()
{
var interviews = new List<Interviews>();
try
{
OrganizationServiceProxy serviceProxy;
ClientCredentials clientCreds = new ClientCredentials();
clientCreds.UserName.UserName = Properties.Settings.Default.crmUsername;
clientCreds.UserName.Password = Properties.Settings.Default.crmPassword;
using (serviceProxy = new OrganizationServiceProxy(new Uri("ourorg/.../Organization.svc"), null, clientCreds, null))
{
serviceProxy.Timeout = new TimeSpan(0, 0, 1, 0);
serviceProxy.EnableProxyTypes();
IOrganizationService _service = (IOrganizationService)serviceProxy;
var qewark_interview = new QueryExpression(wark_interview.EntityLogicalName);
qewark_interview.ColumnSet = new ColumnSet(true);
qewark_interview.AddOrder("wark_specifiedtime", OrderType.Ascending);
// Define filter QEwark_interview.Criteria
qewark_interview.Criteria.AddCondition("statuscode", ConditionOperator.In, 283200001, 1, 283200000);
var retrievedInterviews = _service.RetrieveMultiple(qewark_interview);
foreach (wark_interview inter in retrievedInterviews.Entities)
{
var newInter = new Interviews();
if (inter.wark_Course != null) newInter.courseName = inter.wark_Course.Name;
newInter.Id = inter.Id;
if (inter.wark_SpecifiedTime.HasValue) newInter.interviewDate = inter.wark_SpecifiedTime.Value;
if (inter.wark_Student != null) newInter.studentName = inter.wark_Student.Name;
if (inter.wark_HostCollege != null) newInter.collegeName = inter.wark_HostCollege.Name;
interviews.Add(newInter);
}
}
}
catch (Exception)
{
throw;
}
return interviews;
}