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