9 Aralık 2015 Çarşamba

CRM 2011 QueryExpression - Görev Çekme (Get Task)

public static Task GetTask(IOrganizationService ser, Guid taskid, ColumnSet columnset)
        {
            try
            {
                QueryExpression query = GetQueryExpressionSingle("task", "activityid", taskid, columnset);
                EntityCollection ec = ser.RetrieveMultiple(query);
                if (ec != null && ec.Entities.Count == 1)
                    return (Task)ec.Entities[0];
                else
                    return new Task();
            }
            catch (Exception ex)
            {
               FileLogHelper.LoggEx(ex, typeof(CrmManagerStatic), "public static Task GetTask(IOrganizationService ser, Guid taskid, ColumnSet columnset)" + Environment.NewLine +
                                                                    "TaskId :" + CommonFunction.ToString(taskid));
                throw ex;
            }
        }

GetQueryExpressionSingle metodu


Metot Kullanımı

 Task task = CrmManagerStatic.GetTask(crmService, item, new ColumnSet(new string[] { "activityid", "regardingobjectid", "ownerid", "activitytypecode", "actualdurationminutes", "statecode", "statuscode" }));
                     

Hiç yorum yok:

Yorum Gönder