如何使用控制台应用程序从Dynamics CRM Online中检索数据?

时间:2016-09-12 18:29:25

标签: dynamics-crm microsoft-dynamics dynamics-crm-online

我是Dynamics CRM的新手,我想创建一个控制台应用程序,可以为帐户实体创建新记录,并可以显示来自Dynamics CRM online帐户实体的所有帐户名称列表。

这是我的代码:

Camera.PreviewCallback callback = new Camera.PreviewCallback() {
    @Override
    public void onPreviewFrame(byte[] data, Camera camera) {
        //Do your processing here... Use the byte[] called "data"
            Log.d("Cam ","Cam preview callback");
        try {
            File f=new  File(Environment.getExternalStorageDirectory()+"/test.data");
            if(!f.exists()){
                f.createNewFile();
            }
            OutputStream outStream = new FileOutputStream(f,true);

            Camera.Parameters parameters = camera.getParameters();
            int imageFormat = parameters.getPreviewFormat();
            if (imageFormat == ImageFormat.NV21) {
                Camera.Size previewSize = parameters.getPreviewSize();
                int frameWidth = previewSize.width;
                int frameHeight = previewSize.height;
                Rect rect = new Rect(0, 0, frameWidth, frameHeight);
                YuvImage img = new YuvImage(data, ImageFormat.NV21, frameWidth, frameHeight, null);
                outStream.write(data);                   
                outStream.flush();
            }
        }
        catch (FileNotFoundException iex){
            Log.d("File :-",iex.getMessage());

        }
        catch (IOException iexp){
            Log.d("File :-","IOExcp"+iexp.getMessage());
        }
    }
};

2 个答案:

答案 0 :(得分:1)

这是我的回答

案例2:我使用了以下代码:

QueryExpression query = new QueryExpression { EntityName = "account", ColumnSet = new ColumnSet(new string[] { "name" }) };
EntityCollection account = crmService.RetrieveMultiple(query);
string name = "";
foreach (var count in account.Entities)
{
    name = count.GetAttributeValue<string>("name");
    Console.WriteLine(name);
}
Console.ReadKey();

答案 1 :(得分:0)

对于案例2,我最好采用FetchXML的方法。转到高级查找并获取筛选条件,然后下载xml文件。

然后在代码中加入fetchxml并检索这样的数据

var objCollection = crmService.RetrieveMultiple(new FetchExpression(fetchXMLString));

希望有所帮助