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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 03.11.2012, 06:18   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
Microsoft Dynamics CRM Team Blog: Building clients for Windows Phone and Windows 8 RT
Источник: http://blogs.msdn.com/b/crm/archive/...dows-8-rt.aspx
==============

The Microsoft.Xrm.Sdk.dll library provided as part of the Dynamics CRM 2011 SDK makes it easy to write .NET applications that target the desktop. This library has dependencies on .NET 4.0 and Windows Identity Foundation (WIF), neither of which are available for Windows Phone and Windows 8 RT platforms. Although the WS-Trust protocol used by Dynamics CRM 2011 for authentication is fairly well defined and several folks have built implementations for other languages/platforms, we want to make it easy for you to build amazing applications on these platforms , so a reference implementation of the CRM SDK for these platforms is provided here. Unlike the desktop version, where we only provided you with the binary assembly, we have provided the complete source code, so you should be able to make changes to fit your specific needs. Please note that this works for Dynamics CRM Online deployments, both Office 365 and Windows Live ID, and for Internet Facing Deployments (IFD). It does not work for Dynamics CRM on-premises deployments using Active Directory authentication.

This code is provided “as is”, so you are responsible for making any fixes.

The rest of this post describes how to use the code to authenticate and send web service requests.

Authenticating to the CRM Web Services

Use ServiceConfigurationFactory to construct a DiscoveryServiceConfiguration or an OrganizationServiceConfiguration object. These classes load the relevant metadata and raise one of these events:
  • MetadataLoaded event if the service metadata has been loaded successfully
  • MetadataLoadFailure for other failure cases, such as when the endpoint is not reachable
Once the metadata has been loaded, you can call the Authenticate method. On completion, the Authenticate methods raise the SignInComplete event. The SignOnCompletedEventArgs object on the event callback contains the returned token in the Result property on successful authentication, and contains a non-null exception in the Error property in the case of failed authentication. You can use the returned token to call CRM web service methods.

Windlows Live ID authentication requires device authentication to be performed first, in which case the authentication flow is AuthenticateDevice -> DeviceSigninComplete event -> Authenticate -> SignInComplete event, which can be achieved as shown below:
  1. Attach to the DeviceSigninComplete event and do the following in the event handler:
    1. Handle any error in device authentication by examining the SignOnCompletedEventArgs.Error property. If there is no error, continue with the following
    2. Attach to the SignInComplete event for the user authentication. In the handler, handle any error/read the returned token
    3. Call Authenticate(ClientCredentials clientCredentials, RequestSecurityTokenResponse deviceSecurityToken) passing in the user credentials and the returned token response from device authentication
  2. Call AuthenticateDevice passing in the device credentials to trigger the authentication flow. The DeviceSigninComplete event triggers the user authentication (achieved by step 1)
Calling the CRM Web Services
  1. If no cached token available, authenticate as shown above, and cache the returned token.
  2. Instantiate either the DiscoveryServiceProxy or the OrganizationServiceProxy object as needed.
  3. Set the SecurityTokenReponse property on the proxy object to the cached token.
  4. Attach to the corresponding completion event for the method to be called. For example, use CreateCompleted for the Create method, ExecuteCompleted for the Execute method.
  5. Call the web service method on the DiscoveryServiceProxy or OrganizationServiceProxy objects.


Источник: http://blogs.msdn.com/b/crm/archive/...dows-8-rt.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 8 Blog bot Dynamics CRM: Blogs 1 30.04.2016 10:26
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 11 Blog bot Dynamics CRM: Blogs 0 06.10.2012 05:27
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 10 Blog bot Dynamics CRM: Blogs 0 17.08.2012 03:27
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 7 Blog bot Dynamics CRM: Blogs 0 27.03.2012 02:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 4 Blog bot Dynamics CRM: Blogs 0 24.09.2011 01:16

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

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

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