Search This Blog

Wednesday, December 20, 2017

CRM 2011 Email router configuration: Incoming Email for Exchange online

CRM 2011 Email router configuration: Incoming Email

When you configure Access credentials as UserSpecified
Location: https://outlook.office365.com/EWS/Exchange.asmx



If the user specified is provided then we have to provide credentials for each user by File->Options->Set PersonalOPtions->Email tab



Incoming profiles support the following access credentials:
  • Local System Account. This option requires a machine trust between the computer where the Email Router is running and the computer where Microsoft Exchange Server is running. For incoming profiles, this option is available only for Exchange Server (not for Exchange Online or other POP3 compliant email servers).
  • User specified. This option is available only in the on-premises version of the product. This option is available for all email server types, protocols, and authentication types.
    This option requires that each user enter a user name and password in the Set Personal Options dialog box (available in the Workplacesection of the Microsoft Dynamics CRM web client). This enables the Email Router to monitor mailboxes by using each user's access credentials. When a user changes a domain password -- for example, when it expires -- the user must update the password in Microsoft Dynamics CRM so that the Email Router can continue to monitor the mailbox. This option is available for Exchange Server, Exchange Online and other POP3 compliant email servers.
  • Other specified. Select this option if you want the Email Router to authenticate by using the credentials of a specified user. This option is available for all email server types, protocols, and authentication types. The specified user must have full access to all the mailboxes that the incoming profile will serve. To specify multiple sets of access credentials, you must create a separate configuration profile for each specified user.
Outgoing profiles support the following access credentials. For more information, see the Email Router Configuration Manager Help.
  • Local System Account. Select this option if you select SMTP as the email server type and you want to authenticate by using the local system account of the computer where the Email Router is running. This option requires a machine trust between the computer where the Email Router is running and the computer where the Exchange Server is running. For more information, see “Securing Exchange Server and Outlook” in Operating system and platform technology security considerations for Microsoft Dynamics 365. If you select this option, either the Email Router must be installed on the same server as the Microsoft Dynamics CRM server, or the Email Router computer name must have been entered during Microsoft Dynamics CRM Server Setup. This option is available only when you select SMTP as the email server type, and Windows Authentication or Anonymous as the authentication type.
  • User Specified.
    This option is available in the on-premises and Service Provider editions of Microsoft Dynamics CRM, and when you are using Exchange Online as the Exchange Server Type.
    Select this option if you want the Email Router to authenticate by using an individual user account or a mailbox.
  • Other Specified. This option enables the administrator to configure the Email Router to send email messages on each user's behalf by using the access credentials of a specified user account. The specified user must have full access to all the mailboxes that the incoming profile will serve. To specify multiple sets of access credentials, you must create a separate configuration profile for each specified user. This option is not available if you select SMTP as the email server type and Anonymous as the authentication type.



Incoming Status: Failure - The specified object was not found in the store. Verify that the specified user credentials have Receive permission on the target mailbox. Error: ErrorItemNotFound

Incoming Status: Failure - The specified object was not found in the store. Verify that the specified user credentials have Receive permission on the target mailbox. Error: ErrorItemNotFound

You have to provide the Full Access to another mailbox for email router configured user For example, If your email router is configured/run as exhange admin then you have to provide other use r mail box full access permission.

Exchange online





Add email router configured user to the full access grid.

Incoming profiles support the following access credentials:
  • Local System Account. This option requires a machine trust between the computer where the Email Router is running and the computer where Microsoft Exchange Server is running. For incoming profiles, this option is available only for Exchange Server (not for Exchange Online or other POP3 compliant email servers).
  • User specified. This option is available only in the on-premises version of the product. This option is available for all email server types, protocols, and authentication types.
    This option requires that each user enter a user name and password in the Set Personal Options dialog box (available in the Workplacesection of the Microsoft Dynamics CRM web client). This enables the Email Router to monitor mailboxes by using each user's access credentials. When a user changes a domain password -- for example, when it expires -- the user must update the password in Microsoft Dynamics CRM so that the Email Router can continue to monitor the mailbox. This option is available for Exchange Server, Exchange Online and other POP3 compliant email servers.
  • Other specified. Select this option if you want the Email Router to authenticate by using the credentials of a specified user. This option is available for all email server types, protocols, and authentication types. The specified user must have full access to all the mailboxes that the incoming profile will serve. To specify multiple sets of access credentials, you must create a separate configuration profile for each specified user.
Outgoing profiles support the following access credentials. For more information, see the Email Router Configuration Manager Help.
  • Local System Account. Select this option if you select SMTP as the email server type and you want to authenticate by using the local system account of the computer where the Email Router is running. This option requires a machine trust between the computer where the Email Router is running and the computer where the Exchange Server is running. For more information, see “Securing Exchange Server and Outlook” in Operating system and platform technology security considerations for Microsoft Dynamics 365. If you select this option, either the Email Router must be installed on the same server as the Microsoft Dynamics CRM server, or the Email Router computer name must have been entered during Microsoft Dynamics CRM Server Setup. This option is available only when you select SMTP as the email server type, and Windows Authentication or Anonymous as the authentication type.
  • User Specified.
    This option is available in the on-premises and Service Provider editions of Microsoft Dynamics CRM, and when you are using Exchange Online as the Exchange Server Type.
    Select this option if you want the Email Router to authenticate by using an individual user account or a mailbox.
  • Other Specified. This option enables the administrator to configure the Email Router to send email messages on each user's behalf by using the access credentials of a specified user account. The specified user must have full access to all the mailboxes that the incoming profile will serve. To specify multiple sets of access credentials, you must create a separate configuration profile for each specified user. This option is not available if you select SMTP as the email server type and Anonymous as the authentication type.



Thursday, November 23, 2017

Open Lookup window in CRM V9.0

XRM.Utlity

Property Name
Type
Required
Description
allowMultiSelect
Boolean
No
Indicates whether the lookup allows more than one item to be selected.
defaultEntityType
String
No
The default entity type to use.
defaultViewId
String
No
The default view to use.
entityTypes
Array
No
The entity types to display.
showBarcodeScanner
Boolean
No
Indicates whether the lookup control should show the barcode scanner in mobile clients.
viewIds
Array
No
The views to be available in the view picker. Only system views are supported.

Xrm.Utility.lookupObjects(lookupOptions).then(successCallback, cancelCallback)
var lookupOptions =new Object();
lookupOptions.allowMultiSelect=false
lookupOptions.defaultEntityType='contact'
var arr=new Array()
arr.push('A2D479C5-53E3-4C69-ADDD-802327E67A0D')
lookupOptions.viewIds=arr

lookupOptions.defaultViewId='A2D479C5-53E3-4C69-ADDD-802327E67A0D'

var arr2=new Array();
arr2.push('contact');
lookupOptions.allowMultiSelect=false;
lookupOptions.entityTypes=arr2;
Xrm.Utility.lookupObjects(lookupOptions).then(successCallback, cancelCallback)
function successCallback(objResult){debugger;

}
function cancelCallback(){}






















Dynamics CRM 365 V9.0-Client Side Development features-Part2

CRM 2016
V9.0
Xrm.Page
ExecutionContext.getFormContext (Special rules apply to this)
Xrm.Page.context
Xrm.Utility.getGlobalContext
Xrm.Page.context.getQueryStringParameters
formContext.data.attributes
Xrm.Page.context.getTimeZoneOffsetMinutes
globalContext.userSettings.getTimeZoneOffsetMinutes
Xrm.Page.context.getUserId
globalContext.userSettings.userId
Xrm.Page.context.getUserLcid
globalContext.userSetings.languageId
Xrm.Page.context.getUserName
globalContext.userSettings.userName
Xrm.Page.context.getUserRoles
globalContext.userSettings.securityRoles
Xrm.Page.context.getIsAutoSaveEnabled
globalContext.organizationSettings.isAutoSaveEnabled
Xrm.Page.context.getOrgLcid
globalContext.organizationSettings.languageId
Xrm.Page.context.getOrgUniqueName
globalContext.organizationSettings.uniqueName
Xrm.Page.data.entity.save(string)
Xrm.Page.data.entity.save(saveOptions)
Xrm.Page.data.entity.getDataXml
No changes in addition to using type names rather than type by lookup fields
GridRow.getData
GridRow.data
GridRowData.getEntity
GridRowData.entity
Xrm.Mobile.offline
Xrm.WebApi.offline
parent.Xrm
Brug HTML web resource
addOnKeyPress
Use a Custom Control
removeOnKeyPress
Use a Custom Control
showAutoComplete
Use a Custom Control
hideAutoComplete
Use a Custom Control
Xrm.Utility.alertDialog
Xrm.Navigation.openAlertDialog
Xrm.Utility.confirmDialog
Xrm.Navigation.openConfirmDialog()
Xrm.Utility.isActivityType
Xrm.Utility.getEntityMetadata
Xrm.Utility.openEntityForm
Xrm.Navigation.openForm
Xrm.Utility.openQuickCreate
Xrm.Navigation.openForm
Xrm.Utility.openWebResource
Xrm.Navigation.openWebResource
Thanks to Henrik Jensen
http://crmblog.dk/post/2017/07/09/Dynamics-365-v9-API-relateret-funktionalitet-som-udgar.aspx

Dynamics CRM 365 V9.0- Client Side Development features-Part1

New Client API in Dynamcis CRM V9.0

Xrm.UtilityShowProgressIndicator
Display the progress dialog

This dialog message also update for the subsequent request.



Xrm.Utility.showProgressIndicator(message)

To close progress dialog
Xrm.Utility.closeProgressIndicator()

Xrm.Utility.lookupObjects(lookupOptions).then(successCallback, cancelCallback)
var lookupOptions =new Object();
lookupOptions.allowMultiSelect=false
lookupOptions.defaultEntityType='contact'
var arr=new Array()
arr.push('A2D479C5-53E3-4C69-ADDD-802327E67A0D')
lookupOptions.viewIds=arr

lookupOptions.defaultViewId='A2D479C5-53E3-4C69-ADDD-802327E67A0D'

var arr2=new Array();
arr2.push('contact');
lookupOptions.allowMultiSelect=false;
lookupOptions.entityTypes=arr2;
Xrm.Utility.lookupObjects(lookupOptions).then(successCallback, cancelCallback)
function successCallback(objResult){debugger;

}
function cancelCallback(){}


Xrm.Utility.getEntityMetadata('account')
Get the entity metadata based on the attribute

var arr=new Array();
arr.push('fullname');
Xrm.Utility.getEntityMetadata("contact",arr).then(successCallback, errorCallback)


Xrm.Utility.invokeProcessAction(name,parameters).then(successCallback, errorCallback)

Call the action from client side

parameter:
 It is an object with key value pair where key is a string

Xrm.Utility.invokeProcessAction(name,parameters).then(successCallback, errorCallback)

Xrm.Utility.getGlobalContext().userSettings
Get the CRM logged in user information

var userSettings = Xrm.Utility.getGlobalContext().userSettings;


 Xrm.Utility.getGlobalContext().organizationSettings

var organizationSettings = Xrm.Utility.getGlobalContext().organizationSettings

organizationSettings.uniqueName
organizationSettings.organizationId
organizationSettings.languageId

Xrm.Panel.loadPanel(url, title)
Xrm.Panel.loadPanel('https://octmid.crm.dynamics.com/main.aspx?etc=1&extraqs=&histKey=597090480&id=%7b80DBEA7A-C5CA-E711-A94F-000D3A34AFA9%7d&newWindow=true&pagetype=entityrecord&sitemappath=SFA%7cCustomers%7cnav_accts#698913490')




Xrm.WebApi
All the below request are  work only in "asynchronous"

Xrm.WebApi.createRecord(entityType,data)

//Create an account with lookup value set
var data =
    {
        "name": "TestData",
        "primarycontactid@odata.bind": "/contacts(321b158c-841c-e511-80d3-3867eb348ba8)"
    }

// create account record
Xrm.WebApi.createRecord("account", data).then(
    function success(result) {
        console.log("Account created with ID: " + result.id);
        // perform operations on record creation
    },
    function (error) {
        console.log(error.message);
        // handle error conditions
    }
);


Retrieve Record:
Xrm.WebApi.retrieveMultipleRecords

Xrm.WebApi.retrieveMultipleRecords("account", "?$select=name&$filter=name eq 'test'").then(
    function success(result) {
        for (var i = 0; i < result.entities.length; i++) {
            console.log(result.entities[i]);
        }                    
        // perform additional operations on retrieved records
    },
    function (error) {
        console.log(error.message);
        // handle error conditions
    }
);


Delete Record:
Xrm.WebApi.deleteRecord("account","38E44DF0-BFCA-E711-A94F-000D3A34AFA9")


Refer Link :https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/

Tuesday, November 21, 2017

Dynamics 365 V9.0 Multiselect option

Get Value from Multi select control
Xrm.Page.getAttribute('new_testmultiselect').getValue()

Set Value from Multi select control
var arr=new Array();
arr.push(100000002);
arr.push(100000001);

Xrm.Page.getAttribute('new_testmultiselect').setValue(arr)
or
Xrm.Page.getAttribute('new_testmultiselect').setValue([100000002,100000001])

Set null/empty Value from Multi select control
Xrm.Page.getAttribute('new_testmultiselect').setValue(null)

Multiselect control is not applicable for the following 

  • Set multiselect field values through the business rule
  • Set multiselect field values through a workflow


Friday, October 6, 2017

Dynamically add Embeded/attach image in Email body in Dynamics CRM

IS it possible to Embeded/attach image in Email body in Dynamics CRM 

Embeded image in email body:

To add dynamically image in the email, usually we write code to create email.

There are three ways our image will add in the CRM

  • Public images hosted in external website
  • Webresource
  • Notes( add through attachment)

The below code is for "Public images hosted in external website" and "Webresource"
//Uploaded image in the Webresource .
string webresource = "<html> <img  src='~/WebResources/new_image'  width='205' height='150'></html>";

//published Image Url Link
string crmModule = "<html> <img  src='http://images.all-free-download.com/images/graphiclarge/beautiful_nature_landscape_05_hd_picture_166223.jpg'  width='150' height='150'></html>";


 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//CRM SDK Namespace
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Crm.Sdk.Messages;

namespace Sample
{
    public class Email : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            // Obtain the execution context from the service provider.
            IPluginExecutionContext context =
            (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {

                Entity Lead = (Entity)context.InputParameters["Target"];
                string Emailid = Lead.GetAttributeValue<string>("emailaddress1");
                string Name = Lead.GetAttributeValue<string>("lastname");

                //From Current User
                Entity from = new Entity("activityparty");
                from["partyid"] = new EntityReference("systemuser", context.UserId);

                
                Entity to = new Entity("activityparty");
                to["partyid"] = new EntityReference("lead", Lead.Id);

                //Uploaded Crm webresource Url.
                string webresource = "<html> <img  src='~/WebResources/new_image'  width='205' height='150'></html>";

                //published Image Url Link

                string crmModule = "<html> <img  src='http://images.all-free-download.com/images/graphiclarge/beautiful_nature_landscape_05_hd_picture_166223.jpg'  width='150' height='150'></html>";

                //Hyperlink (or) Re-Direct Url link
                string Hyper = String.Format("<a href='https://google.com/'> Click Here</a>");

                //Create Email
                Entity Email = new Entity("email");
                Email["from"] = new Entity[] { from };
                Email["to"] = new Entity[] { to };
                Email["subject"] = "welcome Mr : " + Name;
                Email["description"] = "<h3> Dear  " + Name + "</h3>" + "<br/>" + "Microsoft Dynamics CRM 365 Module" + "<br/>" 
                    + crmModule + "<br/>" +  Hyper + "<br/>" + webresource;

                //SendEmailRequest
                Guid _emailId = service.Create(Email);
                SendEmailRequest reqSendEmail = new SendEmailRequest();
                reqSendEmail.EmailId = _emailId;
                reqSendEmail.TrackingToken = "";
                reqSendEmail.IssueSend = true;
                SendEmailResponse res = (SendEmailResponse)service.Execute(reqSendEmail);

            }
        }
    }
}



The below code is for "Notes"
string crmModule = "<html> <img src='data: image/jpeg; base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw / eHBhY2tldCBiZWdpbj0i77u / IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8 + IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs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DgFvzouK3JV / lihQTOwLtOtw9wIRG5pJn91Tbgqk9kSk7GViADrTD4HCyZ0NQnomi51sb0fUyCMQEbp2WpU67IjfNjwcYyoUDhjJVcZBjYBy40j4wXgaobWoe8Z6Y80CJBwFpunepIzt2AUgFjtXXshNXjVmMh + K + zzp / CMs0CqeuzrxSRpbOKfdCkiMTS1VBQ41uxMyQR2qbrXiiwYN3ACh1FDmsdK2Eu4J6Tlo31dYVtCY88h5ELZIJJ + IRMzBHfyJINrigNkt5VsRiub9nXICdsYyVd2NcVvA3ScE5t2rb5JuEeyZnAhmLt9NK63vX1O5Pe8XaPSuGq1uTrfUgMEp9EJ + CQvr + BJ / AAKvAcCiAR + bf9CjAAluzmdX4AEIIAAAAASUVORK5CYII ='></html>";


Usually this code works in normal page but here image is not embedded with email after send. It says harmful in the email.

When I check with how inserting signature in the email works in the CRM. I have checked through sent email description column through web API and found they URL in the image tag

Check the selected item








Wednesday, August 9, 2017

Date Time value in Plugin

In the plugin values are retrieved from CRM are in "UTC" format.

Value set in the plugin or console application are based on the date time property. If the date time property is not set as 
"UTC" then values converted as UTC and saved in the database.

If  the date time property is set as "UTC" then it will save as "UTC".



Configure SetSPN for Dynamics CRM ADFS implementation

Configure SetSPN for Dynamics CRM ADFS implementation

The below SPN configuration works to open internal(automatically login) and external URL ADFS and also able to open report both custom and standard report in CRM.

Infrastructure:

The below server are used for Dynamics CRM.

ComputerName Ip Address Computer name Full Computer name
CRM server  10.0.5.40 CRM01 CRM01.CFC.Com
ADFS server  10.0.5.43 ADFS01 ADFS01.CFC.Com
SQL server   10.0.5.46 SQL01 SQL01.CFC.Com

Service Accounts:

Server Name Service Account Name
CRM Server CRM_APP_SVC_PROD
ADFS Server CRM_ADFS_SVC_PROD
SQL Server CRM_SRS_SVC_PROD

Wild Card Certificate:

  • *CFC.org


FederationService Name:
Federation service name is provided at the time of install ADFS in the server.

  • FS2016


CRM Application server SPN Details:


CRM ADFS Server SPN Details: