Участник
Регистрация: 13.05.2010
Адрес: Ростов-на-Дону
|
Цитата:
Сообщение от a33ik
Детально распишите какие файлы куда кладутся. Также опубликуйте здесь ваш web.config + codebehind (cs файлик вашей страницы). Укажите в каком каталоге располагается сайт Microsoft CRM. Постараюсь Вам помочь.
CRM расположена по адресу C:\Program Files\Microsoft Dynamics CRM
Как я понимаю, сам сайт CRM расположен в подпапке CRMWeb, т.е. полный путь до каталога сайта - C:\Program Files\Microsoft Dynamics CRM\CRMWeb
web.config из папки CRMWeb:
Код: <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- COMMENT:START CRM Titan 28973
If you add any new section here , please ensure that section name is removed from help/web.config
End COMMENT:END-->
<section name="crm.authentication" type="Microsoft.Crm.Authentication.AuthenticationSettingsConfigurationSectionHandler, Microsoft.Crm, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<sectionGroup name="System.Workflow.ComponentModel.WorkflowCompiler" type="System.Workflow.ComponentModel.Compiler.WorkflowCompilerConfigurationSectionGroup, System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="authorizedTypes" type="Microsoft.Crm.ObjectModel.WorkflowAutorizedTypes, Microsoft.Crm.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</sectionGroup>
</configSections>
<system.web>
<httpRuntime executionTimeout="300" maxRequestLength="8192"/>
<httpModules>
<add name ="MapOrg" type="Microsoft.Crm.MapOrgEngine, Microsoft.Crm, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name ="CrmAuthentication" type="Microsoft.Crm.Authentication.AuthenticationEngine, Microsoft.Crm, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>
<compilation defaultLanguage="C#" debug="false">
<assemblies>
<!-- COMMENT:L:START Uncomment this if you need to run with Passport support; RPS needs to be installed
<add assembly="Microsoft.Crm.Platform.Passport, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
End COMMENT:L:END-->
<add assembly="Microsoft.Crm, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Microsoft.Crm.SdkTypeProxy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Microsoft.Crm.Platform.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
</compilation>
<authentication mode="Windows" />
<identity impersonate="true" />
<pages buffer="true" enableSessionState="false" enableViewState="false" validateRequest="false"/>
<sessionState mode="Off"/>
</system.web>
<!--
Specific settings for the MSCRMServices directory
-->
<location path="MSCRMServices">
<system.web>
<httpRuntime maxRequestLength="8192"/>
<webServices>
<!-- configuring the reflector + format extension for custom WSDL generation -->
<soapExtensionReflectorTypes>
<add type="Microsoft.Crm.Sdk.CrmServiceSoapExtensionReflector, Microsoft.Crm.WebServices" />
</soapExtensionReflectorTypes>
<conformanceWarnings>
<remove name='BasicProfile1_1'/>
</conformanceWarnings>
</webServices>
</system.web>
</location>
<!--
Support for SQL Reporting services
-->
<location path="Reports">
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<clear/>
<add assembly="*"/>
</assemblies>
</compilation>
<pages enableSessionState="true" validateRequest="false" enableViewState="true" />
<httpModules>
<remove name ="CrmAuthentication"/>
<remove name ="MapOrg"/>
</httpModules>
</system.web>
<appSettings>
<remove key="ReportViewerMessages" />
</appSettings>
</location>
<location path="ReportServer">
<system.web>
<pages enableSessionState="true" validateRequest="false" enableViewState="true" />
<httpModules>
<remove name ="CrmAuthentication"/>
<remove name ="MapOrg"/>
</httpModules>
</system.web>
</location>
<!--
Support for Live Portal
-->
<location path="Portal">
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<clear/>
<add assembly="*"/>
</assemblies>
</compilation>
<pages enableSessionState="true" validateRequest="false" enableViewState="true" />
</system.web>
</location>
<!--
Support for Live Platform
-->
<location path="Platform">
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<clear/>
<add assembly="*"/>
</assemblies>
</compilation>
<pages enableSessionState="true" validateRequest="false" enableViewState="true" />
</system.web>
</location>
<location path="viewer.aspx">
<system.web>
<pages buffer="true" enableSessionState="false" enableViewState="true" validateRequest="false"/>
</system.web>
</location>
<appSettings>
<!--
Help Catalog Name
========================================================================================
This is the name of the Index Server Catalog to use when executing queries from Help.
Default Setting: "Microsoft CRM Help"
-->
<add key="HelpCatalogName" value="Microsoft CRM Help"/>
<!--
Show Developer Errors
========================================================================================
If a server-side error occurs, this setting determines whether or not Debug error
messages are rendered to the user. Debug error message are not recommended for
production environments, but may be useful in attempting to debug a problem you are
having with MSCRM.
Recommended Setting: "Off"
Values: "On" or "Off"
-->
<add key="DevErrors" value="Off"/>
<!--
Client Type
========================================================================================
This variable is used by the code to determine if the web pages are in Outlook
client mode or in web mode. Note that the Outlook Desktop client will use the Web
mode since it's actually hitting the application server.
Values: "Outlook" or "Web"
-->
<add key="ClientType" value="Web"/>
<add key="ReportViewerServerConnection" value="Microsoft.Crm.Web.Reporting.CrmReportServerConnection, Microsoft.Crm.Application.Pages, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add key="ReportViewerMessages" value="Microsoft.Crm.Web.Reporting.CrmReportViewerMessages, Microsoft.Crm.Application.Pages, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</appSettings>
<crm.authentication>
<!-- Indicates which authentication strategy should be used, strategies are stored in config DB table AuthenticationSettings-->
<authentication strategy="OnPremise" />
</crm.authentication>
<System.Workflow.ComponentModel.WorkflowCompiler>
<authorizedTypes>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="IfElseActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="IfElseBranchActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="PolicyActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="SequenceActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="ParallelActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="DelayActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="ReplicatorActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="ListenActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="EventDrivenActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="Activity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="CompositeActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="ThrowActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="TerminateActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="TransactionScopeActivity" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="ActivityCollection" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="ActivityBind" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="ActivityCondition" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities.Rules" TypeName="RuleSetReference" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities.Rules" TypeName="RuleConditionReference" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="ConditionedActivityGroup" Authorized="True"/>
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.Activities" TypeName="ExecutionType" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel.Compiler" TypeName="WorkflowMarkupSourceAttribute" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="DependencyProperty" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="DependencyObject" Authorized="True"/>
<authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.ComponentModel" TypeName="WorkflowTransactionOptions" Authorized="True"/>
<authorizedType Assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System*" TypeName="*" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Convert" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Math" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Runtime.CompilerServices" TypeName="CompilationRelaxationsAttribute" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Runtime.CompilerServices" TypeName="RuntimeCompatibilityAttribute" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Runtime.CompilerServices" TypeName="CompilerGeneratedAttribute" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Runtime.CompilerServices" TypeName="RuntimeHelpers" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Collections" TypeName="IList" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Exception" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Array" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="RuntimeFieldHandle" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="RuntimeTypeHandle" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="TimeSpan" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="DateTime" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Guid" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Int32" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="String" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Type" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="ValueType" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Object" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="SByte" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Byte" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Int16" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="UInt16" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="UInt32" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Int64" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="UInt64" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Char" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Single" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Double" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Boolean" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Decimal" Authorized="True"/>
<!--
* CRM SE 6681 V4: Hotfix needed for CRM Workflows before WF.Net security patch
-->
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System" TypeName="Void" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Reflection" TypeName="AssemblyFileVersionAttribute" Authorized="True"/>
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Reflection" TypeName="AssemblyVersionAttribute" Authorized="True"/>
<!--
* CRM SE 5934 V4: Workflow Designer and Runtime Do Not Handle Decimal Numbers Correctly
-->
<authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Globalization" TypeName="CultureInfo" Authorized="True"/>
<authorizedType Assembly="Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Crm.Sdk" TypeName="*" Authorized="True"/>
<authorizedType Assembly="Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Crm.Workflow" TypeName="*" Authorized="True"/>
<authorizedType Assembly="Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Crm.Workflow.Activities" TypeName="*" Authorized="True"/>
<authorizedType Assembly="Microsoft.Crm.SdkTypeProxy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Crm.SdkTypeProxy" TypeName="*" Authorized="True"/>
<authorizedType Assembly="Microsoft.Crm.SdkTypeProxy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Crm.SdkTypeProxy" TypeName="CrmService" Authorized="False"/>
<authorizedType Assembly="Microsoft.Crm.SdkTypeProxy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Crm.SdkTypeProxy.Metadata" TypeName="MetadataService" Authorized="False"/>
</authorizedTypes>
</System.Workflow.ComponentModel.WorkflowCompiler>
</configuration> Default.aspx.cs:
Код: using System;
using System.Configuration;
using System.Data;
//using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Sdk.Query;
using System.Net;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CrmAuthenticationToken myToken = new CrmAuthenticationToken();
myToken.OrganizationName = "org_name";
/*
Тип аутентификации
0 – Active Directory
1 – MS CRM Dynamics Live
2 – IFD
*/
myToken.AuthenticationType = 0;
CrmService crmService = new CrmService();
// Передаем учетные данные админа, чтобы соединится с API веб-служб MS CRM
crmService.Credentials = new NetworkCredential("login", "pass", "domen");
// URL CRM Service'а
crmService.Url = "/MSCrmServices/2007/CrmService.asmx";
crmService.CrmAuthenticationTokenValue = myToken;
// Оперделяем запрос, который будет отправлен в Сrm Service
QueryExpression query = new QueryExpression();
// Поля которые необходимо вернуть...
ColumnSet colsPrincipal = new ColumnSet();
colsPrincipal.Attributes.Add("name");
colsPrincipal.Attributes.Add("accountid");
colsPrincipal.Attributes.Add("telephone1");
colsPrincipal.Attributes.Add("emailaddress1");
colsPrincipal.Attributes.Add("address1_country");
colsPrincipal.Attributes.Add("address1_stateorprovince");
colsPrincipal.Attributes.Add("address1_city");
query.ColumnSet = colsPrincipal;
query.EntityName = EntityName.account.ToString();
// Отправляем запрос в Сrm Service
BusinessEntityCollection accounts = crmService.RetrieveMultiple(query);
// Определяем Dataset и DataTable
DataSet ds = new DataSet();
DataTable dt = new DataTable();
// Задаем поля для DataTable - должны быть идентичны полям GridView
dt.Columns.Add("name");
dt.Columns.Add("MainPhone");
dt.Columns.Add("Email");
dt.Columns.Add("Сountry");
dt.Columns.Add("State");
dt.Columns.Add("City");
dt.Columns.Add("accountid");
// Просматриваем все возвращенные строки и помещаем каждую из них в DataTable
foreach (BusinessEntity Account in accounts.BusinessEntities)
{
account a = (account)Account;
DataRow dr = dt.NewRow();
dr["name"] = a.name;
dr["MainPhone"] = a.telephone1;
dr["Email"] = a.emailaddress1;
dr["Сountry"] = a.address1_country;
dr["State"] = a.address1_stateorprovince;
dr["City"] = a.address1_city;
dr["accountid"] = a.accountid.Value;
dt.Rows.Add(dr);
}
ds.Tables.Add(dt);
// Помещаем возвращенные данные из DataSet в GridView
gridData.DataSource = ds;
gridData.DataBind();
}
} В папке CRMWeb была папка ISV, пустая. Я в ней создал папку Custom и положил туда файлики, описанные выше.
Кстати, вот еще web.config моей страницы:
Код: <?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<!--<authentication mode="Windows" />-->
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration> Строчку <authentication mode="Windows" /> закомментировал, т.к. из-за нее была ошибка при открытии моей страницы.
Спасибо заранее за помощь!
|