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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 25.01.2010, 01:08   #1  
Blog bot is offline
Blog bot
Участник
 
25,640 / 848 (80) +++++++
Регистрация: 28.10.2006
Muhammad Ali Khan: Using Business Connectivity Services(BCS) In SharePoint 2010 For Connecting To MS CRM 4.0
Источник: http://malikhan.wordpress.com/2010/0...to-ms-crm-4-0/
==============


In this post i will create a custom BCS .net connector (for SharePoint 2010) in Visual Studio 2010  to connect to MS CRM 4.0 and perform the basic CRUD(Create, Retrieve, Update, Delete) operations on the MS CRM “Account” Entity.

Source Code:- You can Download the Source Code of this Project From Here, Source Code.

Step 1:- Create a Custom .Net BCS Project In VS2010 For MS CRM 4.0

As First Step, Open VS 2010 (Beta 2 Ultimate Edition), Go to File==>New==>SharePoint 2010 ==> Business Data Connectivity Model Project.

Since VS2010 has the built in support for editing the application definition file, it will give me a nice GUI BDC Editor, After renaming the default “Entity1” and adding CRUD methods, it will look like this.



You can use the “BDC Method Details” window (the 2nd window in the above diagram) to create new Methods, as shown in the diagram below.



There is also the BDC Explorer on the right side. You can use the BDC Explorer to create “Methods In & Return Parameters” Here is how it look like.



Simply right click on the parameter name and click on “Add Type Descriptor” and then you can define the “Account” entity, as shown below.



If you want to use the VS2010 BDC Editor, Here is a good article as a starting point on how to use the editor (Building a BDC Model using the .NET Assembly Connector). But i personally like the XML Editor more as i find more flexibility in it. So to open the XML Editor, Right Click on your Model File (MSCRMBdcModel.bdcm) in “Solution Explorer” and click “Open With” a “XML Editor”  to bring the Model XML Editor.



Here is how it looks like.



And here is our “Account.cs” Entity.



And the Implementation of all the “CRUD” Methods from MS CRM 4.0 in “AccountService.cs”



Now from the Solution Explorer, right click and click “Deploy”, it will package the solution and deploy the External BCS Content Type on the your SharePoint 2010 site. (Remember to change the SharePoint site URL in the project properties window)

 

This is how it looks like in the “Central Administration”. you can configure permission on it by click on the drop-down menu and select “Permission”.



Step 2:- Configure External Content Type Profile Page In Centeral Administration

Now go to Central Administration ==> Application Management ==> Service Application ==> Business Data Connectivity and click “Manage” from the top Ribbon. You will see the screen below,



Click “Edit” from the Ribbon and select “Configure” to configure the path for the “Profile Page” and click ok. See the diagram below.



Generate the profile page for the External Content Type “Account” by click on the dropdown ==> “Create/Upgrade Profile Page”.



So Now if you browse to any MS CRM Account with the above URL (e.g. http://win-1r2gn7r1jaq:8000/_bdc/MSC...-001E8CFDD686}), you will get a profile page for the MS CRM Account as shown below.



Step 3:- Create a “External Content Type” List To Host MS CRM 4.0 Account

Browse to the site, where you deploy the solution, go to Site Actions==> More Options ==> List ==> “External List” ==> Create. Here Select the “External Content type”, as show below, and click “Create”.



Now the list will shows all the accounts from MS CRM 4.0, as shown below.



Off course you can always change the List View and remove the “AccountID”, as it is a Guid and there is no point in showing it to the end user. Here is how it looks like now.

 

Step 4:-  Using SharePoint 2010 Designer to Create the “New”, Edit Form for our External Content Type

If you click on “Add new Item” now, it will throw an error because the create and edit page doesn’t exit for the list. So lets create the “New” & “Edit” form for our list in SharePoint 2010 Designer.

Open your site in SharePoint 2010 Designer ==> List and Libraries ==> click “CRM Accounts” (Your external list) to see the diagram below.



As you can see there are now “Create” and “Edit” Forms in the “Forms section”. So click “New” in the form section to open up the dialog box as shown below (for the “Create Account”) and click ok.



Do the same for the “Edit Account”, but this time select “Edit item form”, your forms section will now look like this.



Now click on the “EditAccount.aspx” page and modify the view. Here in SharePoint 2010 Designer, you can decide which field to show and which one to hide from the end user. Here is how the “EditAccount.aspx” looks like in SharePoint 2010 Designer (after editing). As you can see we have deliberately hide the “Account ID” (a Guid) and Parent Account (A MS-CRM Lookup) on the Edit Form.



Save the forms. Now browse to your list (MS CRM Accounts) in the SharePoint site. Here is how the “Create Account” looks like.



And Here is “Edit Account” and “Delete” option. You can see below the “Account ID” and “Parent Account” are not visible as we removed these field in the SharePoint 2010 Designer.



Oh Yes, and here is how it looks like in MS CRM 4.0



With this example, now you can perform all the basic operations CRUD( Create, Retrieve, Update, Delete) on MS CRM Account inside your SharePoint 2010 Portal, thus opening new opportunities for integration between MS CRM 4.0 and SharePoint 2010 Portal.

That’s all folks.




Источник: http://malikhan.wordpress.com/2010/0...to-ms-crm-4-0/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Muhammad Ali Khan: Business Connectivity Services (BCS) Using WCF & SharePoint Designer 2010 Blog bot Dynamics CRM: Blogs 0 12.01.2010 04:44
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

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