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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.02.2012, 15:33   #5  
Aliwer is offline
Aliwer
Участник
 
14 / 11 (1) +
Регистрация: 26.12.2011
X++:
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 ViewsConsole
{
    class Program
    {
        static void Main(string[] args)
        {
           // string ms = "Bob Train";
            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.55.71:5555/dfnts/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='not-null' />
                                  </filter>
                                  </entity>
                                  </fetch>";

                string fontac = @"<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='accountnumber' operator='not-null' />
                                  </filter>
                                  </entity>
                                  </fetch>";

                EntityCollection result = service.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression(contactt));
                EntityCollection fesuld = service.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression(fontac));
                foreach (var c in result.Entities)
                {
                    Console.WriteLine("----------");
                    System.Console.WriteLine(c.Attributes["name"]);
                }
               
                    foreach (var s in fesuld.Entities)
                    System.Console.WriteLine(s.Attributes["name"]);
                
                Console.ReadLine();
               
                //end fetch example}

               // if (contactt == fontac) Console.WriteLine("KRUTO");
                //else Console.WriteLine("NeKruto");
                
                    
                
                //This code will clear the textboxes after the contact is created.
            }
        }
    }
}
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Создание Order из другой сущности ashuron Dynamics CRM: Разработка 3 16.11.2011 22:21
Как определить создание формы Dicora Dynamics CRM: Функционал 2 22.09.2010 14:42
Создание экземпляра кастомной сущности из плагина Roman08 Dynamics CRM: Разработка 14 31.08.2009 21:34
создание объекта на базе существующего vienna Dynamics CRM: Разработка 9 11.06.2009 14:01
Как отследить создание предложения из возможной сделки ZooY Dynamics CRM: Разработка 2 28.11.2008 21:00

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:15.