AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Разработка
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.12.2011, 12:32   #1  
Aliwer is offline
Aliwer
Участник
 
14 / 11 (1) +
Регистрация: 26.12.2011
Запрос FetchXML
Здравствуйте.
Ребята, подскажите, пожалуйста.
Мне надо выполнить запрос по организациям удовлетворяющий какому-то условию.
У меня есть код который работает т.е выводит результат на консоль, а мне необходимо чтоб создавался представление, но не создается.
Подскажите что я делаю не так.

Заранее спасибо !!


===============================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Description;
using System.Net;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk;



namespace teset
{
class Fetch
{
static void Main(string[] args)
{
// userquery q = new userquery();
ClientCredentials Credentials = new ClientCredentials();
Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
//This URL needs to be updated to match the servername and Organization for the environment.
Uri OrganizationUri = new Uri("http://192.168.57.50:80/NoName/XRMServices/2011/Organization.svc");
Uri HomeRealmUri = null;
using (Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy serviceProxy = new Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null))
{
serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService service = (IOrganizationService)serviceProxy;
//fetch example
string contactt = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='account'>
<attribute name='name' />
<attribute name='primarycontactid' />
<attribute name='telephone1' />
<attribute name='accountid' />
<order attribute='name' descending='false' />
<filter type='and'>
<condition attribute='name' operator='eq' value='qwe' />
</filter>
</entity>
</fetch>";

// EntityCollection contact_count_result = service.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression(opportunity_count));
EntityCollection result = service.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression(contactt));
//Create loop of the result
foreach (var c in result.Entities){
System.Console.WriteLine(c.Attributes["name"]);
System.Console.WriteLine(c.Attributes["accountid"]);
}
//end fetch example}
Console.WriteLine("=====================");
Console.ReadLine();
//This code will clear the textboxes after the contact is created.
}
}
}
}
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
FetchXML multiple parameter Lud Dynamics CRM: Разработка 5 24.10.2011 06:58
Не работает SQL запрос ipok Dynamics CRM: Разработка 8 30.01.2011 11:18
jamesdowney: Pulling Attribute Values into Variables from FetchXML Result Blog bot Dynamics CRM: Blogs 0 13.08.2009 15:05
Ronald Lemmen: Using Advanced Find for FetchXML builder v4.0 Blog bot Dynamics CRM: Blogs 0 16.02.2009 19:05
Запрос в SQL AlekseyS Dynamics CRM: Разработка 1 26.08.2008 11:01

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:55.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.