Here is the sample code.
public static EntityCollection GetAllNotes(Guid CaseId, IOrganizationService service)
{
EntityCollection results = null;
try
{
QueryExpression Query = new QueryExpression
{
EntityName = "annotation",
ColumnSet = new ColumnSet("filename", "documentbody", "filesize", "mimetype","isdocument"),
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = "objectid",
Operator = ConditionOperator.Equal,
Values = { CaseId }
},
new ConditionExpression
{
AttributeName = "isdocument",
Operator = ConditionOperator.Equal,
Values = { true }
},
}
}
};
results = service.RetrieveMultiple(Query);
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
if (Ex.InnerException != null)
{
Console.WriteLine(Ex.InnerException.Message);
Console.ReadLine();
}
}
return results;
}
No comments:
Post a Comment