Resolution for C# Unit test project error : UTA002: TestClass attribute cannot be defined on generic class

if you ever have tried writing a generic class with attribute set to [TestClass] ass below , you might have got Runtime error which begin with “UTA002: TestClass attribute  cannot be defined on generic class”  & follows multiple such codes UTA004 or UTA005 or UTA006 for various Test method attributes

[Microsoft.VisualStudio.TestTools.UnitTesting.TestClass()]

public class CustomEntityTestBase<T> : CustomEntityBase<T>

{}

after trying multiple workarounds finally what made these errors go away is by putting an “abstract” keyword to the class declaration shown as below

[Microsoft.VisualStudio.TestTools.UnitTesting.TestClass()]

public abstract class CustomEntityTestBase<T> : CustomEntityBase<T>

{}

hoping this tip will save you a lot of time if you are struggling like me for this error and you don’t want to try complex workarounds as suggested in the internet

Posted in C#, UnitTest | Tagged , , , , , , , | Leave a comment

Manually Deploy SSRS RDL reports to Report Server using SSRS Report Manager Site URL

Recently I had to deploy some of my SSRS reports in a remote VM, where no Visual studio was present, so I followed the manual process

steps followed are as below

Step 1 : find the report manager URL by opening the Reporting Services Configuration Manager tool and navigating to Report Manager URL shown as below.

1

 

Step 2: Open the URL in Internet Explorer Administrative mode.

2

you will observer my home site has two folders

1- Data Sources     – This is the folder I will create my data sources, which will be referred by my report

2- TestReports  – This is the folder I will upload my reports (.rdl) files.

 

Step 3: Open the Data Sources Folder by double clicking it and then add a new Data source. Make sure you set the data source as active and test the connection string, before clicking the apply button.

3

 

Step 4: Click on the Data Sources link available in the site map to come back to the Data sources folder and see that your created Data source is available

4

Step 5: Go back to the Home by clicking the Home link in the top left corner of the page and then open the TestReports to upload your rdl report into it

5

Step 6:  Click on the Upload File link and then click the Browse button to select your rdl file. and finally click Ok

6

Step 6: Open the Manage command on the report you have just uploaded as shown in the below picture to assign the data source to the report

7

 

Step 7: Select the Data source  link in the manage window and assign the appropriate data source as shown in the below pictures.

8

9

Step 8: Apply the changes and navigate back to the TestReports folder.

 

10

 

Step 9: Run the report by double clicking on it

11

 

Hope this post has helped you…

 

 

 

 

Posted in SQL 2008, SQL Express, SQL Reporting, SQL Server, SSRS, Windows Server 2012 | Tagged , | Leave a comment

Error while accessing Localhost SQL Reporting Services Url – user ‘DomainUserName’ does not have required permissions. Verify that sufficient permissions have been granted and Windows User Account Control (UAC) restrictions have been addressed

In my machine I have 3 SQL server instances installed.

1> SQL Server 2012

2> SQL Server 2012 Express

3> SQL Server 2008 Express

reportservererror31

 

so the corresponding default local host report server names are as below

1>http://localhost/reportserver   for my default SQL server installation instance, which do not have any instance name as you can see in the 3rd entry in the above picture

2>http://localhost/reportserver_SQLExpress12  for the SQL Server 2012 Express instance

3> for my SQL Server 2008 Express I have not enabled reporting services hence it don’t have any url, but if it was enabled the URL would look like http://localhost/reportserver_SQLExpress

 

I was trying to use this server URL, i.e. http://localhost/reportserver_SQLExpress12 but it was continuously giving me error as below

reportServer

 

I know that My windows UAC setting is at the lowest value, which is not safe, But for this error, I have changed it temporarily.

ReportError5

 

still I was facing  the same issue,

I even made sure that the TCP port for the corresponding SQLExpress instance is enabled as well as the reporting services are running, by using the SQL Server Configuration manager tool.

ReportError3ReportError4

 

but still I was facing the same access denied error.

later I realized that if I run the uRL in an IE which is opened in Administrative mode it works.

later I found this msdn ( http://msdn.microsoft.com/en-us/library/bb630430.aspx )  link, and I followed the steps mentioned in the link To Configure Local Report Server and Report Manager Administration

and that helped me with the error, now I could happily access my report service URL from the browser, without opening in administrative mode.

ReportError2

 

Hope this blog helped you too…

Posted in SQL 2012, SQL Express, SQL Reporting, SSRS, Windows 8 | Tagged , , , , | Leave a comment

SQL Server Configuration Manager SQL Server Services access error “remote procedure call failed[0x800706be]”

In My laptop I have multiple versions of SQL server installed like SQL Express 12, SQL 2008 Express and SQL server 2012,

so on my widows 8.1 machine when I goto start -> type SQL Server Configuration Manager in the search box I got the tool and opened in administrative mode

err11

 

after opening when I click on the SQL Server Services I get the error saying  remote procedure call failed[0x800706be]

err2

The issue was that My SQL server configuration manager was pointing to an older version of the service, hence I corrected it by following the below process and it worked great after wards.

Step 1: Open the SQL server configuration manager  location through Windows Start->type SQL server configuration manager ->right click->Open file location

err21

Step 2: Right click on the shortcut for SQL server configuration manager in the corresponding folder and open the properties window

err4

you notice that the shortcut is pointing to SQLServerManager10.msc

Spep 3: go to the path what the msc is physical located

err5

step 4: you will see their is a higher version of the same is present in my case SQLServerManager11.msc, so I changed the shortcut path to the latest version i.e. I changed target of the SQL configuration manager shortcut to as below

C:\Windows\SysWOW64\mmc.exe /32 C:\windows\SysWOW64\SQLServerManager11.msc

err51

 

step 5:After saving the above change I again opened the SQL Server Configuration manager from the windows start menu..and now I could see all the SQL server Services in it.

err6

 

 

Hope this post helps you…

 

 

Posted in SQL 2012, Windows 8 | Tagged , , , | 1 Comment

How to Add event log source in eventViewer with check of if not exists usingPowerShell

I recently used this PowerShell script for my project , in order to create Windows event log source in event viewer.

hope it can be useful for other too.

$logFileExists = Get-EventLog -list | Where-Object {$_.logdisplayname -eq “My_Logs”}

if (! $logFileExists) {

New-EventLog -LogName “My_Logs” -Source “MyTempLogs”

}

Posted in Powershell | Tagged , , | Leave a comment

How to get the QueueItem details for an Object – CRM 2011/CRM 2013

If you have noticed, in CRM 2011/2013, it is common that when you click on an QueueItem record in any of the Queue Item views, it always opens the Actual Object i.e. the case record or activity record or Lead record etc. the same thing happens when you define a ribbon button and pass the selectedID as a crmParamater to the Ribbon action (opening a web url or calling a java script function), on click of the ribbon buttion the guid that you get as the selected record id is actually not the Guid of the Corresponding QueueItem that holds the object but the Guid of the actual object i.e the case/activity/lead etc.

so what is the solution, to get the QueueItem ID, in case you have any operations to perform on its properties, the only option is to make the Odata query to get the QueueItem id for the corresponding ObjectID, as in CRM only one QueueItem exists for an Item, hence, the below query is safe, as in any case you can never get more than one record in the result set.

here is the query. Please note the uses the OData Retrieve Multiple Query Method named GetODataResults, to get the java script for it refer to my previous blog https://sanghams.wordpress.com/2014/02/01/how-to-make-crm-20112013-odata-retrievemultiple-call-from-java-script/

function getQueueItemID(selectedRecordID) {

var queueitemID = null;

var selectedObjectID = args[0][1].replace(“%7b”, “”).replace(“%7d”, “”);

var queueTeamQuery = “QueueItemSet?$select=QueueId,QueueItemId,queue_entries/OwnerId,queue_entries/OwningTeam,queue_entries/OwningUser&$expand=queue_entries&$filter=ObjectId/Id eq guid'” + selectedObjectID + “‘”;

var queueTeamdetails = GetODataResults(queueTeamQuery);

if (queueTeamdetails != null) {

queueitemID = queueTeamdetails.QueueItemId;

}

}

 

Posted in CRM 2011, CRM 2011 Online, CRM2013, java script, OData | Tagged , , , | Leave a comment

How to make CRM 2011/2013 OData RetrieveMultiple call from Java Script

though I have mentioned that this code will work for both CRM 2011 and CRM 2013, but only in one place we have used getClientUrl() call, which is CRM 2013 specific, for more details on this please see my previous blog (https://sanghams.wordpress.com/2014/01/26/crm-2013-new-and-beautiful-getclienturl-method-instead-of-getserverurl/).

hence in the below code snippet, I will comment the script that will work for CRM 2011. so when you try this script in CRM 2011, just comment the statement that uses “getClientUrl” and uncomment the code, which I mention as to work for CRM 2011.

/*global window */

/*global Xrm */

/*jslint evil: true*/

/*global ActiveXObject:false */

function

 

 

getODataOrgUrl() {

 

‘use strict’;

 

/*//Uncomment Below 3 lines of code if you are using CRM 2011

// the below two lines to be used for crm 2011 onpremise

var orgname = window.parent.Xrm.Page.context.getOrgUniqueName();

var serverUrl = document.location.protocol + “//” + document.location.host + “/”;

// if crm 2011 online use the below code

// var serverUrl = window.parent.Xrm.Page.context.getServerUrl();

return (serverUrl + “/XRMServices/2011/OrganizationData.svc/”);*/

 

// Getting the CRM Org URL ** comment the below code if you are using CRM 2011 and use the previous 3 lines of code

 

return (Xrm.Page.context.getClientUrl() + “/XRMServices/2011/OrganizationData.svc/”);

}

function

 

 

getRequestObject() {

 

‘use strict’;

 

if (window.XMLHttpRequest) {

 

returnnew window.XMLHttpRequest();

}

 

try {

 

returnnew ActiveXObject(“MSXML2.XMLHTTP.3.0”);

}

 

catch (ex) {

 

returnnull;

}

}

function

 

 

getODataResults(query) {

 

‘use strict’;

 

var oDataEndpointUrl, service, requestResults;

oDataEndpointUrl = getODataOrgUrl();

service = getRequestObject();

requestResults =

 

null;

oDataEndpointUrl += query;

 

if (service !== null) {

service.open(

 

“GET”, oDataEndpointUrl, false);

service.setRequestHeader(

 

“X-Requested-Width”, “XMLHttpRequest”);

service.setRequestHeader(

 

“Accept”, “application/json,text/javascript, */*”);

service.send(

 

null);

 

if (service.responseText === null) {

 

returnnull;

}

requestResults = eval(

 

‘(‘ + service.responseText + ‘)’).d;

 

if (requestResults === null || requestResults.results === null) {

 

returnnull;

}

 

if (requestResults.results.length === 0) {

 

returnnull;

}

 

if (requestResults !== null && requestResults.results.length === 1) {

 

return requestResults.results[0];

}

}

}

 

 

Posted in CRM 2011, CRM 2011 Online, CRM2013, java script, OData | Tagged | Leave a comment

CRM 2013 New and Beautiful getClientUrl() method instead of getServerUrl()

In CRM 2013 Microsoft has introduced this new client context method called “getClientUrl”

This is the replacement to the previous method called “getServerUrl” that was present in CRM 2011.

This method was faulty because it always returns the server name in the URL as it is set up in the CRM deployment manager, irrespective of how the host url looks like.

this is issue in scenarios where users might have invoked CRM using the server IP address or fully qualified domain name etc.

because when in the java script we call getServerUrl it does not return the URL with the server name as it was used by the calling the host url, but that of what is stored in the server, which fails , in the situations where the server name is not accessible from the host machine but the IP or fully qualified name.

in order to correct this fault in the getServerUrl() method call, Microsoft has introduced this getClientUrl() ,which takes care of the Host URL through which CRM is invoked and return the OData Url accordingly.

Please note getServerUrl() is now deprecated.

the details found in SDK is as below..

getClientUrl

Returns the base URL that was used to access the application.

JScript                                                                        Copy Code
context.getClientUrl()

Use this instead of the deprecated getServerUrl method.

The values returned will resemble those listed in the following table.

Client Value
Microsoft Dynamics CRM (on-premises) http(s)://server/org
Microsoft Dynamics CRM Online https://org.crm.dynamics.com
Microsoft Dynamics CRM for Outlook with Offline Access when offline http://localhost:2525

Return Value

Type: String

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK, CRM2013, java script | Tagged , , | Leave a comment

Object doesn’t support property or method while executing new XMLHttpRequest from CRM 2011/2013 html resource

Recently I faced this weird error

Object doesn’t support property or method

while My CRM 2013 html web resource invoked from a CRM ribbon button was trying to execute the below method required before making the CRM Ajax based call.

function GetRequestObject() {
if (window.XMLHttpRequest) {
return new window.XMLHttpRequest;
}
else {
try {
return new ActiveXObject(“MSXML2.XMLHTTP.3.0”);
}
catch (ex) {
return null;
}
}
}

 

The error was happening exactly at the statement “return new window.XMLHttpRequest;

I had the same code working in CRM Online environment but after porting it to the On-Premise I got this error. for some host machines it was not the issue, where as for majority of my client machines this issue was coming.

first as a solution I skipped the new window.XMLHttpRequest statement and used the “return new ActiveXObject(“MSXML2.XMLHTTP.3.0″);” it did work for one of my OData call but it failed with the same error in another OData call, this time it was in the standard  JQuery library, inside of which they have used the statement “new XMLHttpRequest()”.

Since the code was working in another of my web resource I was not sure what exactly could be the problem,

but after concentrating a bit between these two Working and Non-Working versions of my HTML files, I found something that caught my attention, guess what , By mistake I had kept all my java script code inside the <head></head> tag, which was the root cause, as the window was not completely formed while my Java script are getting executed.

after moving the java scripts to the Body (<body></body> of the Html page, it worked perfectly.

I was so amazed with this discovery of mine, though it took me a lot of time.

Posted in CRM 2011, CRM2013, java script, JQuery, OData | Tagged , , | Leave a comment

How to achieve Single Select option in a html table using check box control and jscript

the below sample will help in constructing a html table with a check box column and the script to achieve single select of the check box button among all the datarows of the table.

<!DOCTYPEhtml>
<html>
<head>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”&gt;
<script type=”text/javascript”>
$(document).ready(function () {
$(“input[name=chkName]”).click(function (e) {
var selectedCheckbox = $(e.target);
$(e.target).closest(‘table’).find(‘input[type=checkbox]’).not(e.target).removeAttr(“checked”);
})});
</script>
</head>
<body>
<div id=”Container”>
<table style=”text-align: left;”id=”myTable”>
<colgroup id=”myColumns”>
<col width=”10%”/>
<col width=”45%”/>
</colgroup>
<tr>
<th style=”text-align: left;”>Select</th>
<th style=”text-align: left;”>Name</th>
</tr>
<!– the below script with add 3 rows to the table with the 1st row indicating the check box.–>
<tr>
<td><input name=’chkName’ type=’checkbox’></td>
<td>SAMUEL</td>
</tr>
<tr>
<td><input name=’chkName’ type=’checkbox’></td>
<td>RAVI</td>
</tr>
<tr>
<td><input name=’chkName’ type=’checkbox’></td>

<td>STAR</td>
</tr>
<tr>
<td><input name=’chkName’ type=’checkbox’></td>
<td>CRAIG</td>
</tr>
</table>
</div>
</body>
</html>

–Note please take care of the quotations before executing the sample

Posted in HTML, java script, JQuery | Tagged , , | Leave a comment

How to pass CRM 2011/2013 Custom Lookup attribute extraqs Parameters in openEntityForm utility method from java script

While trying to pass a custom lookup field value as an extraqs parameter,, using the Xrm.Utility.openEntityForm method from my java script, I came across this rule that their is a difference in the way we should set value of a custom lookup and the traditional simple lookup.
with code sample explained below.

var parameters = {};
parameters[“title”] = “Fill in the title here”;
parameters[“customerid”] = custGuid;
parameters[“customeridname”] = custFullName;
parameters[“customeridtype”] = “contact”;
Xrm.Utility.openEntityForm(“incident”, null, parameters);

if you observe above customerid is the actual CRM field schema name of the incident entity. but in the parameters we have passed 2 more additional fields, by suffixing the “customerid” field with “name” for setting the “Name” field of the lookup record and “type” for setting the lookup entity logical name.

while trying the same funda for my custom entity lookup field named “new_customerhometown” , of type “new_hometown” on my incident form open using

parameters[“new_customerhometown”] = homeTownGuid;
parameters[“new_customerhometownname”] = “Hyderbad”;
parameters[“new_customerhometowntype”] = “new_hometown”;

the above code keeps failing with errors. All the web search was taking me to the example of traditional setting of Lookup to Customer or Owner, who use all the below 3 step assignments to perform the task. for example to set the owner field one has to set ownerid, ownername,ownertype=”sustemuser”/”team”

I was going crazy to find the difference between existing lookups like Customer / Owner etc and a custom lookup.
but luckily I found this msdn post, http://msdn.microsoft.com/en-us/library/gg334375.aspx

Capture

so by following the 1st guideline for simple lookup i.e
• For simple lookups you must set the value and the text to display in the lookup. Use the suffix “name” with the name of the attribute to set the value for the text.Do not use any other arguments.

I set the parameters like below and it worked perfect for me.

parameters[“new_customerhometown”] = homeTownGuid;
parameters[“new_customerhometownname”] = “Hyderbad”;

all I have to do was remove the type assignment. Please note the name parameter is just optional and for setting the Guid field you have to use the attribute schema name as it is. not required to suffix it with any “id” string.

the reason behind such rule to my observation is the traditional look ups like “Owner” / “Customer” / “PartyList” etc can have multiple data types, hence mentioning the type is mandatory else not.

but what I can not understand is, why they need to fail the call, while every other places we use a lookup field we are setting its type why its not allowed here, may be not to increase the url length or whatever, definitely annoyed me a lot 😀

Hope this post helps more !!!

Posted in CRM 2011, CRM 2011 Online, CRM2013, java script, OData | Tagged , , , , | 2 Comments

How to get the team members details from a team ID in Dynamics CRM 2011/2013 Using OData Call

Recently I had the requirement to display the list of team member details like User Name, Full Name etc. in java script.
I was using the Odata designer tool found at http://crm2011odatatool.codeplex.com/
but since team members is a many to many relationship between User and Team I knew that I have to use the $expand tag in the Odata on the teammembership_association , which is the name of the many to many relationship here.

But my confusion started because I was trying to retrieve it using the entity name “TeamMembershipSet” which was causing the Odata query to fail when I try running it in the Browser.
But finally I found that I need to use TeamSet instead of TeamMembershipSet or SystemUserSet.
so the below query worked flawlessly for me.

https://servername/xrmservices/2011/OrganizationData.svc/TeamSet?$select=teammembership_association/DomainName,teammembership_association/FullName,teammembership_association/SystemUserId,teammembership_association/IsDisabled&$expand=teammembership_association&$filter=TeamId eq guid’8e033b49-6e7f-e311-9359-d89d6765b238′

though I struggled a bit due to the confusion with the presence of teammembership entity name in the list, I am glad I could finally figure it out. posting it for others who might have similar difficulty.

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK, CRM2013, java script, OData | Tagged , , , , | Leave a comment

CRM 2013 New Features on Form Customization – QUICK VIEW FORM

Just found this pleasantly surprised but not so talked about feature that has added to CRM 2011 form Customization.

Years have struggled with adding a lot of java scripts to display related lookup attributes fields on a form, but no more, with the new Quick View Form, one can define a set of fields that are required to be displayed in a related record as an embedded section on the form.

One can create multiple such Quick View Forms for an entity and can use them to embed specific fields values from a related lookup field and display them in parent record form, without writing a single line of script to the form.

one can multiple such Quick view forms on an entities main firm, and the best part is one can never differentiate in the look and feel department that these fields are actually not stored as an attribute in the main entity rather, pulled from the related lookup field on demand.

an example is: if you are customizing a Contact Main form, and you would like to have the Parent Account Address fields to be reflected on the contact form, all you need to do is just create a quick view form on the Account entity , which the desired address fields added to it and insert this Account Quick View form to the Contact Main form.

Like any regular sections, one can give a Label to the group, display or Hide the label etc., all through few simple clicks.

Another Awesome fact about it is, user can not edit these fields on the Parent entity form, by default they are read only, hence forcing the user directly on the actual lookup entity form.

here is a picture of how it looks on the Contact form…. in the sample picture I have added two Quick Views to the Contact form 1- Account Quick View and Owner Quick View side by side, under a single tab.

1- Form Customization View

P2

2- Quick View Data Actually rendered on the Contact Form

P1

Posted in CRM2013 | Tagged | Leave a comment

Dynamics CRM Linq Query error “The method ‘Count’ is not supported”

As I was trying to Bind a Dynamics CRM Linq Query result to a DataGrid, I was in need to check the total result returned from the query.

My initial sample looked as below, gave me the exception saying “The method ‘Count’ is not supported”

var xrm = newXrmServiceContext(“Xrm”);

var exampleContacts = xrm.ContactSet.Where(c => c.EMailAddress1.EndsWith(“.com”)).ToList();

var count = exampleContacts.Count<Contact>();

if (count > 0)

{

ContactsGridView.DataSource = exampleContacts;

ContactsGridView.DataBind();

}

It is due to the reason that by using var, .Net implicitly takes the type of the result and in this case it is

Microsoft.Xrm.Sdk.Linq.Query<Contact> exampleContacts;

All I had to do was implicitly cast it to a list by using “ToList()” which helped me in getting the desired result back.

IEnumerable<Contact> exampleContacts = xrm.ContactSet.Where(c => c.EMailAddress1.EndsWith(“.com”)).ToList();

var count = exampleContacts.Count<Contact>();

if (count > 0)

{

string alert = String.Format(“<SCRIPT LANGUAGE=\”\”JavaScript\”\”>alert(\”Hello this is an Alert {0}\”)</SCRIPT>”, count);

System.Web.HttpContext.Current.Response.Write(alert); 

ContactsGridView.DataSource = exampleContacts;

ContactsGridView.DataBind();

}

 

Hope you get benefit from this post.

Do like and comment on the post.

HAPPY CODING!!!!

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK, CRM2013, Linq | Tagged , , , | Leave a comment

Dyamics CRM 2013 SDK Portal Sample “WebAppWalkthrough” connectionstring issue for CRM 2013 O365 Login

When trying to test the Microsoft Dynamics CRM 2013 web portal sample that is available in the path of …\SDK\Walkthroughs\Portal\WebAppWalkthrough ,

I see that the web.config contains a connection string entry as below

<connectionStrings>

<addname=XrmconnectionString=Server=http://crm/contoso; Domain=CONTOSO; Username=Administrator; Password=pass@word1 />

</connectionStrings>

There were so sample Connection string provided for the O365 login, so even if I replaced the server url and provided the Username and Password, It was still not working.

It is not able to perform successful login.

The username is not provided. Specify username in ClientCredentials.             

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The username is not provided. Specify username in ClientCredentials.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

on further search over Net I found the below link from AdxStudio

http://community.adxstudio.com/products/adxstudio-portals/developers-guide/knowledge-base/crm-connection-string-format/

following which I changed my connection string as below in the portal web.config and there you go..the sample works just awesome.

<connectionStrings>

<addname=XrmconnectionString=Server=https://samsorgname.crm5.dynamics.com;Username=yyyyy@samsorgname.onmicrosoft.com; Password=zzzzzzzz />

</connectionStrings>

P2

Hope this is helpful for you, do comment or like my post !!!!!

Happy CODING…

Posted in CRM 2011 | Tagged , , | Leave a comment

How to remove QVO6 virus successfully from Windows 8 all browsers like IE, firefox, Chrome

I suffered for this Virus called QVO6 which get open in all of my browsers every time I open.

it was so annoying that I tried all possible ways, removed any such Add in, changed the Home page setting, deleted any registry entry that has the name QVO6 to it, deleted the browser cookies or temp data etc, even removed any software that I may not recognize or does not belongs to “Microsoft” still I was not able to remove, I was going crazy for months.\

but finally I found from where it was loading for all of my browser, though all those registry entry deletion helped but this setting I am going to talk is the last string 🙂

steps:

1. right click on the browser short cut you might have pinned into the task bar, from that menu again right click against the corresponding browser.exe , then select “Properties” ->shortcut -> target.

remove anything after the corresponding exe path..and booommm that did it. I am the happiest one now, after so many months struggle I found the peace with my browser.

the below URL help me with this last solution for sure..

http://www.techsupportall.com/how-to-remove-qvo6-com-search-homepage-from-ie-firefox-chrome/

Posted in Virus | Tagged | Leave a comment

Network Discovery Getting Auto Turned off – SERVER 2012

While setting up my Server 2012 instance using windows hyper-v, I saw that whenever I set the Network discovery service to On from

(Control Panel\All Control Panel Items\Network and Sharing Center\Advanced sharing settings) and save the changes, it resets back to off.

after searching some I found that by enabling and starting the below services “Network Discovery” was set to On.

–      DNS Client

–      Function Discovery Resource Publication

–      SSDP Discovery

–      UPnP Device Host

Posted in Windows Server 2012 | Tagged , | Leave a comment

How to Generate Comma Separated Double Quote Qualified Unicode CSV from SQL Server

Recently for Data migration task using SQL server SSIS packages I needed a way to create Unicode encoded Comma separated Quote delimited CSV file directly from SQL server which can consume data from SQL stored procedure or complex SQL statement . for me by default it was generating ANSI encoded csv. when I searched in net I was getting methods of achieving so using SQL command line. But luckily later found the way to do so using UI from SQL management studio.

here is the step by step process on how to do so

Step 1: Select Export task on the database

CSV1

Step 2: Click Next in the Import wizard

Pic2

Step 3: Choose the Data source as the Data base from which you want to get the data from

Pic3

Step 4: Select the destination as given below.

Make sure to giving the Text qualifier as “

Choose the other parameters as shown in the below snapshot.

Make sure to check the Unicode check box as shown below.

Click Next

Pic4

Step 5: Select “Write a query to specify the data to transfer” if you have any custom select statements that need to be exported to the csv and click “next”

Pic5

Step 6: Write the SQL query in the below box and click “Next”

Pic6

Step 7: verify the mapping and delimiters, click “next”

Pic7

Step 8: Click Next to get the CSV immediately

Pic8

Step 9: Click “Next” and Finish

Pic9

Step 10: wait for the process to complete successfully

Pic10

Step 11: Check the generated CSV at the Specified location

And verify the Unicode format

pic11

Posted in Data Migration, SQL 2008, SQL 2012, SQL Server | Tagged , , , | Leave a comment

Windows 8 VirtualBox Vt-x not available

Recently when I moved my Oracle VM into a new laptop with Windows 8 OS, while trying to open my VM I keep getting the below error

Posted in CRM 2011 | Tagged , | Leave a comment

Debugging a biztalk 2010 mapping file with custom xml input

While trying to debug and test my BizTalk mapping file, I face this issue that the auto generated xml keeps giving me validation error, this is because the auto generated xml input file generated the data without obeying the type expected for the corresponding element.
for example , I had some guid fields in my input schema and the auto generated field will just insert a text value into that node, which was causing the validate map as well as the test map and debug map to fail.

in order to fix it, I was looking for a way to give my custom input xml , in place of the auto generated one’s.

I could do that by following the following steps

1. right click on your .btm file that you want to debug and open the properties.

2. in the map properties window set the below properties
testmap input = XML
testmap input instance =

if you want no validation to happen, you can even set the below properties to false

Validate testmap input = false
Vaidate testmap output = false

3. after that you can save the project and right click on the btm file and select “debug map”
2013-04-14_1730

Cheers 🙂 !!!!

Posted in Biztalk, Biztalk 2010, Buztalk debugging | Tagged , , | Leave a comment

Biztalk 2010 Mapping changes does not reflect after redeploying also

I observe that even after repeated re-buid and redeployment etc, the changes I am making to the script elements in my BizTalk map file project from visual studio, its not reflecting at all.

but the below blog explains how to make it work.
http://www.modhul.com/2007/06/08/xslt-map-changes-to-not-appear-when-re-deploying-biztalk-projects/

you can also check
http://www.biztalkadminsblogging.com/index.php/item/34-what-you-need-to-do-to-fix-there-was-a-failure-executing-the-receive-pipeline-failed-to-load-verify-the-schema-for-this-document-specification-is-deployed-and-is-in-the-global-assembly-cache-error-after-deploying-biztalk-solution

I am yet to try it, if it still does not work then you will need to follow the hard way as mentioned in my previous blog

https://sanghams.wordpress.com/2013/04/14/biztalk-deployment-caching-issue/

cheers 🙂 !!!!!

Posted in Biztalk, Biztalk 2010, Buztalk debugging | Tagged , | Leave a comment

Biztalk deployment caching issue

Being new to the BizTalk world, I observed that BizTalk deployment is a beast.
after the first deployment, any further deployment is not actually reflecting the changes at all.
I tried a lot of cleaning mechanism,
like

1. uninstalling the assembly from gac through
gacutil /u “library name” Note: don’t give the assembly extension, just provide the name

2. cleaning the cache from
%APPDATA%\Microsoft\BizTalk Server\Deployment\

and from, %temp% as well.

3. Stopping the BizTalk application from “BizTalk Server administration” console and deleting it all together

but nothing helped
now I have to follow the below cumbersome process, will try a better solution

my current working solution is

1. delete the application from BizTalk Server administration after stopping it
2. uninstall the assembly from the gac through “gacutil -u ”
Note: if your solution involves more than one assembly you need to uninstall them all from the GAC
Note: to list the assemblies in the gac you can use the command “gacutil -l ”
Note: Gacutil command works from “VS command prompt” not the general one.

3. in my visual studio command BizTalk project change the assembly name and the application folder in which it will be deployed by using the deployment tab of the BizTalk project properties.
4. remove all the generated, mapping and schema cs files and rebuild and redeploy
5. reconfigure your bindings in “BizTalk Server administration” console and run again

cheers 🙂 !!!!

Posted in Biztalk, Biztalk 2010, Buztalk debugging | Tagged , , | 2 Comments

How to debug BizTalk Orchestration

With my first ever BizTalk project and after hours spend in developing an orchestration and setting it up, which was not working, I was going crazy on how to debug it.
here are the steps that I followed after lot of searching

1. go to BizTalk server administration console

2. click on the BizTalk group node

3. in the right side panel you will see the area called “BizTalk Group Hub page”
it has got two tabs
1. group hub
2. new query

4. in the group hub tab got to the “Tracked service instances” and click “completed instances”.
it will open up a new tab called as “Tracked service instances”
Note: in order to be able to debug at least one time the orchestration must have run.

5. in the “Tracked service instances” tab, find your orchestration instance, right click on it and select “Orchestration Debugger”

6. when the debugger opens put break points on the nodes you need, using the toolbar or shortcut

7. after that initiate your orchestration process again

8. come to the BizTalk server administration console->BizTalk group node-> new query
in the query expression search for “Running service instances”
you should find your orchestration instance, waiting in a break point

9. open the orchestration debugger for the same by right clicking on it

10. from the debugger toolbar, select attach
Note: this attach may not work if the current user is not in the “BizTalk server administrators” group
you may get this error “server\Biatalk Server Administrators” failed with error: Debugging client is not a biztalk server Administrator”
if you add the user to this group you need to log off and login again, for this permission to work.
don’t worry your instance will still be waiting 🙂

11. Once you have successfully attached the process, you can see the current debug position and move to the next step through continue (Control + G)

12. while in a particular step , the corresponding message objects value can be seen, by expanding the “Part” property of the corresponding message.
you can even copy and save the message to see the message value and the schema.

useful links

http://allcomputers.us/windows_server/biztalk-2010-recipes—administration-and-operations—debugging-orchestrations.aspx
http://msdn.microsoft.com/en-us/library/aa560120(v=bts.20).aspx
http://msdn.microsoft.com/en-us/library/aa949817(v=bts.20).aspx

for attach error
“server\Biatalk Server Administrators” failed with error: Debugging client is not a biztalk server Administrator”
http://www.go4answers.com/Example/regarding-orchestration-debugging-error-58553.aspx

Posted in Biztalk, Biztalk 2010 | Tagged , , | Leave a comment

Biztalk error: you must specify at least one already-initialized correlation set for a non-activation receive that is on a non-selfcorrelating port

While first time trying a biztalk 2010 sample on my own, I was stuck with the below error on my orchestration file, even after following the exact same steps as provided by the sample.

Error 3 you must specify at least one already-initialized correlation set for a non-activation receive that is on a non-selfcorrelating port xxxxxxx .odx 297 14

If I replace my orchestration.odx file with the sample one, the build is succeeded, otherwise I get the same error.
even after comparing every single component of the orchestration I was not able to catch it.
but I found the issue after searching over the net a lot.

here is why

“On the Receive shape properties, you must be sure to select True for Activate. This indicates that the orchestration will be started upon receipt of a message, rather than being called by another orchestration. If you leave it set to false, when you try to build the application you’ll receive the error “You must specify at least one already-initialized correlation set for a non-activation receive that is on a non self-correlating port.””

the below blog helped me

http://geekswithblogs.net/bosuch/archive/2010/03/19/simple-biztalk-orchestration–port-tutorial.aspx

Cheers

Posted in Biztalk, Biztalk 2010 | Tagged , , | Leave a comment

Biztalk 2010 :Schema referenced by Map ‘xxxxxxx’ has been deleted. The local, cached version of the BizTalk Server group configuration is out of date. You must refresh the BizTalk Server group configuration before making further changes. (Microsoft.BizTalk.Administration.SnapIn)

while working on my first BizTalk project, I faced the below error while deploying my solution for the 2nd time.
the error keeps happening stopping me from expanding the applications tab also in the BizTalk administration console.

Schema referenced by Map ‘xxxxxxx’ has been deleted. The local, cached version of the BizTalk Server group configuration is out of date. You must refresh the BizTalk Server group configuration before making further changes. (Microsoft.BizTalk.Administration.SnapIn)

after searching a lot, I found a common solution suggested by all, to delete an entry from [BizTalkMgmtDb].[dbo].[bt_MapSpec] table.
but I was not sure which entry to delete,i thought better to delete a mapping from my current solution which I am going to re-deploy. otherwise you may loose some map from any of your other application.

Voila , later when I redeploy my solution again in was successful. 🙂

Posted in Biztalk, Biztalk 2010 | Tagged , , , | 1 Comment

CRM 2011 Sharepoint List Component Activate is Disabled : Installing Sharepoint List component for CRM 2011

When I was trying to install CRM 2011 sharepoint list component by following the steps provided in the below Microsoft downloaded link

http://www.microsoft.com/en-in/download/details.aspx?id=5283#instructions

I checked that the Activate button for the Listcomponent is always disabled.

By following the steps mentioned in the below link, I was able to see the button being enabled and was able activate the component for me.
http://030bacf.netsolhost.com/WordPress/?p=780

Posted in CRM 2011 | Tagged , | 6 Comments

The LDAP server is unavailable Error while running crm 2011 sdk sample for o365

whil trying to run one of the sample from the recent crm 2011 sdk v.5.0.13, i was repetedly getting exception with error message as
The LDAP server is unavailable

the below blog helped me

http://mscrmshop.blogspot.in/2012/09/error-message-on-running-sdk-samples.html

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK | Tagged , | Leave a comment

error in downloading BtsRedist.cab. reason: (null) : Biztalk 2010 server installation error

Recently while trying to install Biztalk server 2010 in Windows server 2008 R2(SP!) and SQL server 2008 R2, I was choosing the option to download the cab files from the internet and install automatically. But always getting the error as

“error in downloading BtsRedist.cab. reason: (null)”

It comes out as the online path was un-accessiabe, so had to downoad the cab from the path mentioned in the below link, after that choosen to install the cab from my physical machine path.
My installation was smooth after that.

http://sandroaspbiztalkblog.wordpress.com/2010/10/15/biztalk-2010-prerequisite-redistributable-cab-files/

Posted in Biztalk, Biztalk 2010 | Tagged , | Leave a comment

CRM 2011 SRSDataConnector installation with SQL server 2012 – The SQL Server Reporting Services account is a local user and is not supported

I was setting up a new dev environment with SQL 2012 and CRM 2011 server as two diffrent servers
But while trying to install the CRM reporting Extensions in the SQL 2012 server, it was failing with error, on looking at the log, it says that I need to install “Visual C++ 2010 resistributable library” but when I try download the C++ component and try to install I get the error as
Error: A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine”
SO was kind of stuck,
but the below link helped.
I had to download the lastest bits of CRM 2011 server installer, which is compactible with SQL server 2012, cause it comes with UR6 from
http://www.microsoft.com/en-us/download/details.aspx?id=27822

from these bits I only installed the Reporting extensions from the ..\SrsDataConnector folder.

but after that also I got another error as

The SQL Server Reporting Services account is a local user and is not supported.

Look at the below link which explains what is to be done for it. This is a very nice article.
basically had to change the reporting service’s Service account from “report server” to “local system”

http://mscrmonline.wordpress.com/2012/07/31/microsoft-crm-2011-and-sql-server-2012-support/

Posted in CRM 2011, SQL 2012 | Tagged , | Leave a comment

Configuring CRM 2011 IFD in a single VM

Please follow the below two links to be ablle to setup a developer IFD setup in a simple VM.

Link
http://www.interactivewebs.com/blog/index.php/server-tips/microsoft-crm-2011-how-to-configure-ifd-hosted-setup/

Video

Install Certificate Authority
http://aaronwalrath.wordpress.com/2010/04/16/install-an-enterprise-certificate-authority-in-windows-2008-r2/

How to create a “CNAME” in your dns
http://technet.microsoft.com/en-us/library/cc732711.aspx

Belive me the experiance is lengthy but satishfactory

I am still not able the access it outside my VM, which I am trying to figure. Will update soon.

Posted in CRM 2011, CRM 2011 IFD | Tagged , , | Leave a comment

Index was outside the bounds of the array – While Performing Operation on Windows Azure from SSMS 2008 R2

I have SQL server 2008 R2 installed on my machine with version (10.50.1600.1)
How to get the version – Open Sql server Management Studion -> help->about)

when I connected to my SQL Azure from my Local Machine SQL server 2008 R2 management studio, though I was able to create data bases in my azure instance, but these changes never reflect in my Azure management even after multiple refresh.

after that when I try create a new Database in my Azure SQL from mt local Management Studio , I was not able to see it in my SQL Azure Management site
On fructuation I tried to create one in the same name from SQ Azure Management site, but it does not let me use the same name.

When I try to delete the same from my local Management studio I get the below error
“Index was outside the bounds of the array”

I tried some options like Script as “Drop and Create to” everything pretty much give me the same error.
After searching through the web, I figured out that it is happening because of the management version.
this issue is the same when you connect to SQL server 2012 as well.
This issue is resolved in SQL server 2008 R2 SP1 above.
After installing SQL server 2008 R1 SP1(10.50.2500..) by going to my computer updates pane and searching for Optional Updates, the problem is completely resolved.
U can have SP1, or SP2 or SP3 etc..anything will work.

Posted in SQL Azure, Windows Azure | Tagged , | Leave a comment

Unable to Delete Disk from Windows Azure

While playing around with my newly created windows Azure Account, I saw that the virtual machine created by me is kind of in “running (Provisioning)” state forever.
so I deleted the Virtual machine from my windows Azure manage console, then when I try to delete the “Storage”
it gave me error that it is in use so can not delete it.
Then I went to my Virtual Machine Tab -> then “Images” tab but there were none there.
Images

then when I went to the Disk tab, I see there is one, but the delete disk button is disabled.
Disk

I followed the below steps
1.Download Azure PowerShell by clicking Install under Windows here:
http://www.windowsazure.com/en-us/manage/downloads/

2.Start, Search, type Windows Azure PowerShell and open that console in administrative mode (Very Important).
3.Get-AzurePublishSettingsFile will launch a browser window to https://windows.azure.com/download/publishprofile.aspx to download the management certificate in a .publishsettings file in order to manage your subscription with PowerShell.

Get-AzurePublishSettingsFile

4.Import-AzurePublishSettingsFile will import the certificate and subscription information. If you saved it to Downloads you can run the command below as-is, otherwise replace the path with the full path to the .publishsettings file.

Import-AzurePublishSettingsfile $env:userprofile\downloads\*.publishsettings

5. run this command : IMPORTANT
Set-ExecutionPolicy unrestricted

6.Get-AzureDisk will show you the disks:

Get-AzureDisk

this will return the number of disks you have, try to know which position disk you want to delete.
the disk index starts with 0.

7. then do this
$disks = Get-AzureDisk
c:\> Remove-AzureDisk $disks[].DiskName

Make sure the disk in question does not have anything for the AttachedTo property.
If it does then you are really screwed.
In my case it was still attached , I tried detaching with Remove-AzureDataDisk
but it fails with error so I followed the below post to break the lease first.
From the below post I run the breaklease.ps1 on my desired disk, though this script could not delete the disk but it still resolved my Lease error.
for me this script ended with, the message to delete the “Image” forst, but I had no Image but anyway after running Breaklease.ps1, I repeated my previous commnad of
“Remove-AzureDisk $disks[].DiskName”
and Voila….it worked :)..huh what a struggle. hope you get any benefit.
http://social.msdn.microsoft.com/Forums/en-US/WAVirtualMachinesforWindows/thread/7381ea0e-0443-4b33-aa12-ba39df003409

Some other links that helped too are
http://social.msdn.microsoft.com/Forums/en-US/WAVirtualMachinesforWindows/thread/7381ea0e-0443-4b33-aa12-ba39df003409

Posted in Windows Azure | Tagged , , , | Leave a comment

“You cannot debug or run this project, because the required version of the Microsoft Office application is not installed” Error on Excel AddIn

I have was trying to debug an Excel Addin in VS 2012 and Office 2013 in my machine and every time I try to debug I receive this error

You cannot debug or run this project, because the required version of the Microsoft Office application is not installed”

By following the below steps I could resolve the issue,

Right click on your Project and Open Properties

Go to Debug and select “Start External Program” and set its value to your excel.exe path , in my case I set it to “C:\Program Files\Microsoft Office 15\root\office15\excel.exe”

Posted in Office Programming | Tagged , | 5 Comments

Deploying Dynamics CRM 2011 Outlook Client for your Organization Using SCCM

A great post to follow if you wish to perform a bulk deployment of microsoft dynamics CRM outlook Client for all the users of your organization using Microsoft System Centers Configuration Manager (SCCM)

http://technet.microsoft.com/en-us/library/hh699702.aspx

for Roaming User Profiles, Citrix presentation Server,Wibdows server remote desktop services

http://technet.microsoft.com/en-us/library/hh699743.aspx

Install without Internet Connection

http://technet.microsoft.com/en-us/library/jj126125.aspx

 

Posted in CRM 2011 Outlook | Tagged | Leave a comment

Scenarios of when we need to set the SPN for Kerberos

The below artigle explains when and which account shoul be considers for enabling SPN for IIS

http://blogs.msdn.com/b/webtopics/archive/2009/01/19/service-principal-name-spn-checklist-for-kerberos-authentication-with-iis-7-0.aspx

How to set SPN

http://support.microsoft.com/kb/929650/en-us

Posted in Windows Authentication | Tagged , , | Leave a comment

All about Kerberos

Came across this great post that explains about Kerberos authentication and its deal with IIS.

 

http://www.adopenstatic.com/faq/

Posted in Windows Authentication | Tagged , , | Leave a comment

Windows Authentication System Unleashed(NTLM vs Kerberos)

A very nice article to explain the underlying mechanism between Kerberos and NTLM.

As well it explain the Windows Authentication terminologies and detail theory on how Windows Authentication system works

http://msdn.microsoft.com/en-us/library/aa480475.aspx

Posted in Windows Authentication | Tagged , , , , , , | Leave a comment

Matchcode in CRM 2011 Bulk detection rules

Recently I was looking for the exact mechanism of Bulk detection rules in CRM 2011 and I came across this blog which explains it how is Bulk detection rules designed internally.

this is a great post.

http://xrm2011.wordpress.com/2011/08/07/crm-2011-and-duplicate-detection/

Posted in CRM 2011 | Tagged , , , | Leave a comment

Hiding the Due filter drop down in crm 2011 Online

recently, we came across a very pressing requirement from customer to remove the Due filter drop down from Activities Home page.

There is no supported way of doing this. neither through code nor through java script.

but the trick worked.

Added a new Enable rule to existing ribbon button and added a custom java script to this enable rule.

I have chosen he email ribbon button to add the new enable rule.

the solution is two fold

1> add a web resource of type java script which is hold the java script method that will be called from the ribbon enable rule

    The Java script to hide the due filter and its corresponding lebel

function HideDueFilterFromCRMHomePage() {
    try {
        var due = document.getElementById(“gridControlBarElement_4”);
        var select = document.getElementById(“crmDateSelector”);
        if (due != null) {
            due.style.display = “none”;
        }

        if (select != null) {
            select.style.display = “none”;
        }
    }
    catch (e) { }
    return true;
}

2>customize the command of any ribbon button and add the new enable rule to it.

here is the ribbon diff xml for email button on Activity pointer homepage grid

<ImportExportXml xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>
  <Entities>
    <Entity>
      <Name LocalizedName=”Activity” OriginalName=”Activity”>ActivityPointer</Name>  
      <RibbonDiffXml>      
        <CommandDefinitions>      
          <CommandDefinition Id=”Mscrm.CreateEmail”>
            <EnableRules>
              <EnableRule Id=”viacom.activitypointer.EnableRule0.HideDueFilterEnableRule” />
            </EnableRules>         
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <EnableRules>
            <EnableRule Id=”viacom.activitypointer.EnableRule0.HideDueFilterEnableRule”>
              <CustomRule FunctionName=”HideDueFilterFromCRMHomePage” Library=”$webresource:new_ActivityPointer.js” Default=”true” InvertResult=”false” />
            </EnableRule>
          </EnableRules>
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>
    </Entity>
  </Entities>
  <WebResources>
    <WebResource>
      <WebResourceId>{f116c867-fe27-e211-8392-00155d886547}</WebResourceId>
      <Name>new_ActivityPointer.js</Name>
      <DisplayName>ActivityPointer.js</DisplayName>
      <LanguageCode>1033</LanguageCode>
      <WebResourceType>3</WebResourceType>
      <IsCustomizable>1</IsCustomizable>
      <CanBeDeleted>1</CanBeDeleted>
      <IsHidden>0</IsHidden>
      <FileName>/WebResources/new_ActivityPointerjsF116C867-FE27-E211-8392-00155D886547</FileName>
    </WebResource>
  </WebResources>
</ImportExportXml>

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK, java script | Tagged , , , | Leave a comment

CRM 2011 Events to Entity mapping

 In CRM 2011 there are nearly 1000 support CRM SDK events/messages that can be registered against various entities in a plugin registration tool.

The attached excel sheet lists all those events.

Using the excel data filtering ,sorting and searching behavior it helps to find out what are the possible events that can be registered for an Entity or what are the possible entities that can be affected by an event.

The excel sheet is here.

This definitely comes handy when we are searching for possible events to catch.

 

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK | Tagged , , | Leave a comment

Get Option set Value from Text in crm 2011 using CRM SDK c# code

it happens while performing migration we get the string values for the option sets as input, but while updating in crm using SDK code we need the Optionset Numeric value.

the below code show cases how to handle any optionset update in crm using generic code.

private static void UpdateUser(OrganizationServiceProxy crmOrgService, DataRow row)
        {
            Guid userGuid = new Guid(row[“UserID”].ToString().Trim());
            if (userGuid != Guid.Empty)
            {
                OptionSetValue userLevel = GetOptionSetValue(row, “User Level”, UserLevel);

                var user = new SystemUser
                {
                    Id = userGuid,
                    new_userlevel = userLevel

                };
                using (MyServiceContext userContext = new MyServiceContext (crmOrgService))
                {
                    userContext.Attach(user);
                    userContext.UpdateObject(user);
                    userContext.SaveChanges(SaveChangesOptions.ContinueOnError);
                }
            }
        }

        private static OptionSetValue GetOptionSetValue(DataRow row, string attributeDataRowName, Dictionary<string, int> optionSetVaues)
        {
            OptionSetValue optionSetValue = null;
            var attributeValue = row[attributeDataRowName].ToString().Trim();
            if (!string.IsNullOrEmpty(attributeValue))
            {
                if (optionSetVaues.ContainsKey(attributeValue))
                {
                    optionSetValue = new OptionSetValue(optionSetVaues[attributeValue]);
                }
                else
                {
                                       Console.WriteLine(String.Format(“User with UserId {0} can not be assigned {1} : {2} does not exist.”, (string)row[“User Name”], attributeDataRowName, attributeValue));
                   }
            }
            return optionSetValue;
        }

        private static void RetrieveOptionSetValues(IOrganizationService service, string entityName, string OptionsetAttributeName, out Dictionary<string, int> optionsetvalues)
        {
            optionsetvalues = null;
            RetrieveAttributeRequest retrieveAttributeRequest = new
                                                                RetrieveAttributeRequest
                                                                 {
                                                                     EntityLogicalName = entityName,
                                                                     LogicalName = OptionsetAttributeName,
                                                                     RetrieveAsIfPublished = true
                                                                 };

            // Execute the request.
            RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)service.Execute(retrieveAttributeRequest);
            Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata retrievedPicklistAttributeMetadata = (Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata)retrieveAttributeResponse.AttributeMetadata;
            // Get the current options list for the retrieved attribute.
            OptionMetadata[] optionList = retrievedPicklistAttributeMetadata.OptionSet.Options.ToArray();
            optionsetvalues = new Dictionary<string, int>();
            foreach (OptionMetadata oMD in optionList)
            {
                optionsetvalues.Add(oMD.Label.UserLocalizedLabel.Label, (int)oMD.Value);
            }
        }

Posted in .Net, C#, CRM 2011, CRM 2011 Online, CRM 2011 SDK | Tagged , , , , | Leave a comment

Bulk user Migration to CRM 2011 online, from excel sheet through C#,.Net code- assign Business Unit, assign Security role and Manager etc

I had the requirement to perform bulk user migration to CRM 2011 online, from an excel file. I wrote the below code to do so, and it was very helpful.

Code to redirecting the Standard Output to a file.

 FileStream ostrm;
StreamWriter writer;
TextWriter oldOut = Console.Out;
try
{
string fileName = String.Format(“./Log{0}{1}{2}{3}{4}{5}.txt”, DateTime.Now.Month.ToString(), DateTime.Now.Day.ToString(), DateTime.Now.Year.ToString(), DateTime.Now.Hour.ToString(), DateTime.Now.Minute.ToString(), DateTime.Now.Second.ToString());
ostrm = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
writer = new StreamWriter(ostrm);
}
catch (Exception e)
{
Console.WriteLine(“Cannot open Redirect.txt for writing”);
Console.WriteLine(e.Message);
return;
}

Console.SetOut(writer);

// after finishing the work at the end write the below two lines

..
..
.
.
Console.SetOut(oldOut);
writer.Close();
ostrm.Close();

Code to Read the excel into a data set with Primary key facility

//Creating datatable to read the containt of the Sheet in File.
DataTable dt = new DataTable();

DataColumn[] keys = new DataColumn[1];
DataColumn userName = new DataColumn();
userName.DataType = typeof(string);
userName.ColumnName = “User Name”;

// Add the column to the DataTable.Columns collection.
dt.Columns.Add(userName);
keys[0] = userName;

// Set the PrimaryKeys property to the array.
dt.PrimaryKey = keys;

dt.Columns.Add(“Manager”);
dt.Columns.Add(“Business Unit”);
dt.Columns.Add(“Security Role”);
dt.Columns.Add(“UserID”);

//Read the Excel sheet
Excel.Application exceApp;
Excel.Workbook userWorkbook;
Excel.Worksheet userWorksheet;
Excel.Range workSheetRange;
exceApp = new Excel.ApplicationClass();

//Opening Excel file(User.xls)
userWorkbook = exceApp.Workbooks.Open(@”D:\Users.xls”, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

userWorksheet = (Excel.Worksheet)userWorkbook.Sheets.get_Item(1);
int Cnum = 0;
int Rnum = 0;

workSheetRange = userWorksheet.UsedRange; //gives the used cells in sheet

//Reading Excel file.
for (Rnum = 2; Rnum <= workSheetRange.Rows.Count; Rnum++)
{
DataRow dr = dt.NewRow();
//Reading Each Column value From sheet to datatable Colunms
for (Cnum = 1; Cnum <= workSheetRange.Columns.Count; Cnum++)
{
var value = (workSheetRange.Cells[Rnum, Cnum] as Excel.Range).Value2;
if (value != null)
{
dr[Cnum – 1] = (workSheetRange.Cells[Rnum, Cnum] as Excel.Range).Value2.ToString().Trim();
}
}
dt.Rows.Add(dr); // adding Row into DataTable
dt.AcceptChanges();
}

userWorkbook.Close(true, Missing.Value, Missing.Value);
exceApp.Quit();

Please note the Order should be fist Assign Business Unit, then Assign Security Role, then assign Manager.

Code to fetch Guid of each user, All the Business Units and Assigning Business Unit, Security Role and Manager

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query;
using Excel = Microsoft.Office.Interop.Excel;

namespace Microsoft.Crm.BulkUserMigration
{
class UserMigration
{

static Dictionary<string, Guid> BusinessUnits = null;
static DataTable dt = null;
public static void Main(string[] args)
{
FileStream ostrm;
StreamWriter writer;
TextWriter oldOut = Console.Out;
try
{
string fileName = String.Format(“./Log{0}{1}{2}{3}{4}{5}.txt”, DateTime.Now.Month.ToString(), DateTime.Now.Day.ToString(), DateTime.Now.Year.ToString(), DateTime.Now.Hour.ToString(), DateTime.Now.Minute.ToString(), DateTime.Now.Second.ToString());
ostrm = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
writer = new StreamWriter(ostrm);
}
catch (Exception e)
{
Console.WriteLine(“Cannot open Redirect.txt for writing”);
Console.WriteLine(e.Message);
return;
}

Console.SetOut(writer);
//Creating datatable to read the containt of the Sheet in File.
dt = new DataTable();

DataColumn[] keys = new DataColumn[1];
DataColumn userName = new DataColumn();
userName.DataType = typeof(string);
userName.ColumnName = “User Name”;

// Add the column to the DataTable.Columns collection.
dt.Columns.Add(userName);
keys[0] = userName;

// Set the PrimaryKeys property to the array.
dt.PrimaryKey = keys;

dt.Columns.Add(“Manager”);
dt.Columns.Add(“Business Unit”);
dt.Columns.Add(“Security Role”);
dt.Columns.Add(“UserID”);

//Read the Excel sheet
Excel.Application exceApp;
Excel.Workbook userWorkbook;
Excel.Worksheet userWorksheet;
Excel.Range workSheetRange;
exceApp = new Excel.ApplicationClass();

//Opening Excel file(User.xls)
userWorkbook = exceApp.Workbooks.Open(@”D:\Users.xls”, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

userWorksheet = (Excel.Worksheet)userWorkbook.Sheets.get_Item(1);
int Cnum = 0;
int Rnum = 0;

workSheetRange = userWorksheet.UsedRange; //gives the used cells in sheet

//Reading Excel file.
for (Rnum = 2; Rnum <= workSheetRange.Rows.Count; Rnum++)
{
DataRow dr = dt.NewRow();
//Reading Each Column value From sheet to datatable Colunms
for (Cnum = 1; Cnum <= workSheetRange.Columns.Count; Cnum++)
{
var value = (workSheetRange.Cells[Rnum, Cnum] as Excel.Range).Value2;
if (value != null)
{
dr[Cnum – 1] = (workSheetRange.Cells[Rnum, Cnum] as Excel.Range).Value2.ToString().Trim();
}
}
dt.Rows.Add(dr); // adding Row into DataTable
dt.AcceptChanges();
}

userWorkbook.Close(true, Missing.Value, Missing.Value);
exceApp.Quit();

var crmOrgService = CrmServiceUtility.GetOrganizationService();
crmOrgService.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());

GetAllBusinessUnits(crmOrgService, out BusinessUnits);
GetAllUserGuids(crmOrgService, ref dt);

foreach (DataRow row in dt.Rows)
{
var userIdRow = row[“UserID”];
if (userIdRow == null || userIdRow.Equals(DBNull.Value) || new Guid(userIdRow.ToString()).Equals(Guid.Empty))
{
Console.WriteLine(String.Format(“User with UserId {0} does not exist in CRM”, (string)row[“User Name”]));
}
else
{
AssignBusinessUnit(crmOrgService, row as DataRow);
}
}
foreach (DataRow row in dt.Rows)
{
var userIdRow = row[“UserID”];
if (userIdRow != null && !userIdRow.Equals(DBNull.Value) && !(new Guid(userIdRow.ToString()).Equals(Guid.Empty)))
{
AssignSecurityRole(crmOrgService, row as DataRow);
AssignManager(crmOrgService, row as DataRow);
}
}

Console.SetOut(oldOut);
writer.Close();
ostrm.Close();
}

private static void GetAllUserGuids(OrganizationServiceProxy crmOrgService, ref DataTable dt)
{
try
{
using (MyServiceContext context = new MyServiceContext(crmOrgService))
{
foreach (DataRow row in dt.Rows)
{
string userName = (string)row[“User Name”];

row[“UserID”] = (from userData in context.SystemUserSet
where (userData.DomainName.Equals(userName) &&
userData.IsDisabled == false)
select userData.Id).FirstOrDefault();

}
}
}
catch (Exception ex)
{
Console.WriteLine(“The application terminated with an error.”);
Console.WriteLine(ex.Message);

// Display the details of the inner exception.
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.Message);
FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> fe = ex.InnerException
as FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>;
if (fe != null)
{
Console.WriteLine(“Timestamp: {0}”, fe.Detail.Timestamp);
Console.WriteLine(“Code: {0}”, fe.Detail.ErrorCode);
Console.WriteLine(“Message: {0}”, fe.Detail.Message);
Console.WriteLine(“Trace: {0}”, fe.Detail.TraceText);
Console.WriteLine(“Inner Fault: {0}”, null == fe.Detail.InnerFault ? “Has Inner Fault” : “No Inner Fault”);
}
}
}
}

private static void GetAllBusinessUnits(IOrganizationService service, out Dictionary<string, Guid> businessUnits)
{
#region Retrieve records from an intersect table via QueryExpression

//Create Query Expression.
QueryExpression query = new QueryExpression()
{
EntityName = BusinessUnit.EntityLogicalName,
ColumnSet = new ColumnSet(new[] { “name”, “businessunitid” }),
Distinct = true
};
businessUnits = new Dictionary<string, Guid>();
// Obtain results from the query expression.
EntityCollection ec = service.RetrieveMultiple(query);

// Display results.
for (int i = 0; i < ec.Entities.Count; i++)
{
var businessunit = (BusinessUnit)ec.Entities[i];
businessUnits.Add(businessunit.Name, businessunit.Id);
}

#endregion
}

private static void AssignBusinessUnit(IOrganizationService crmOrgService, DataRow userRecord)
{
var userName = userRecord[“User Name”].ToString();
try
{
var businessUnitName = userRecord[“Business Unit”].ToString().Trim();
var userId = new Guid(userRecord[“UserID”].ToString().Trim());
if (!(userId.Equals(Guid.Empty)) && BusinessUnits.ContainsKey(businessUnitName))
{
SetBusinessSystemUserRequest burequest = new SetBusinessSystemUserRequest();

//business unit to assign user to
burequest.BusinessId = BusinessUnits[businessUnitName];

//user to re-assigns
burequest.UserId = userId;

//can be a different team or systemuser, used to reassign records owned by person
burequest.ReassignPrincipal = new EntityReference(SystemUser.EntityLogicalName, userId);

SetBusinessSystemUserResponse resp = (SetBusinessSystemUserResponse)crmOrgService.Execute(burequest);

}
else
{
Console.WriteLine(String.Format(“User with UserId {0} can not be assigned Business Unit : {1} does not exist.”, (string)userRecord[“User Name”], businessUnitName));
}
}
catch (Exception ex)
{
Console.WriteLine(“Error in Business Unit Assignemnt for User : {0}”, userName);
Console.WriteLine(ex.Message);

// Display the details of the inner exception.
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.Message);
FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> fe = ex.InnerException
as FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>;
if (fe != null)
{
Console.WriteLine(“Timestamp: {0}”, fe.Detail.Timestamp);
Console.WriteLine(“Code: {0}”, fe.Detail.ErrorCode);
Console.WriteLine(“Message: {0}”, fe.Detail.Message);
Console.WriteLine(“Trace: {0}”, fe.Detail.TraceText);
Console.WriteLine(“Inner Fault: {0}”, null == fe.Detail.InnerFault ? “Has Inner Fault” : “No Inner Fault”);
}
}
}
}

private static void AssignSecurityRole(IOrganizationService crmOrgService, DataRow userRecord)
{
var userName = userRecord[“User Name”].ToString();
try
{
var securityRoleId = Guid.Empty;
var securitRoleName = userRecord[“Security Role”].ToString().Trim();
using (MyServiceContext context = new MyServiceContext(crmOrgService))
{
securityRoleId = (from roleData in context.RoleSet
where (roleData.Name == securitRoleName &&
roleData.BusinessUnitId.Equals(BusinessUnits[userRecord[“Business Unit”].ToString().Trim()]))
select roleData.Id).FirstOrDefault();
}

var userId = new Guid(userRecord[“UserID”].ToString().Trim());

if (!(userId.Equals(Guid.Empty)) && !(securityRoleId.Equals(Guid.Empty)))
{
// Create new Associate Request object for creating a N:N link between User and Security
AssociateRequest secRoleRequest = new AssociateRequest();

// Create related entity reference object for associating relationship
// In our case we will pass (SystemUser) record reference

secRoleRequest.RelatedEntities = new EntityReferenceCollection();
secRoleRequest.RelatedEntities.Add(new EntityReference(SystemUser.EntityLogicalName, userId));

// Create new Relationship object for System User & Security Role entity schema and assigning it
// to request relationship property

secRoleRequest.Relationship = new Relationship(“systemuserroles_association”);
// Create target entity reference object for associating relationship
secRoleRequest.Target = new EntityReference(Role.EntityLogicalName, securityRoleId);
// Passing AssosiateRequest object to Crm Service Execute method for assigning Security Role to User
crmOrgService.Execute(secRoleRequest);

}
else
{
Console.WriteLine(String.Format(“User with UserId {0} can not be assigned Security Role because Role : {1} does not exist.”, (string)userRecord[“User Name”], securitRoleName));

}
}
catch (Exception ex)
{
Console.WriteLine(“Error in Security Role Assignemnt for User : {0}”, userName);
Console.WriteLine(ex.Message);

// Display the details of the inner exception.
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.Message);
FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> fe = ex.InnerException
as FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>;
if (fe != null)
{
Console.WriteLine(“Timestamp: {0}”, fe.Detail.Timestamp);
Console.WriteLine(“Code: {0}”, fe.Detail.ErrorCode);
Console.WriteLine(“Message: {0}”, fe.Detail.Message);
Console.WriteLine(“Trace: {0}”, fe.Detail.TraceText);
Console.WriteLine(“Inner Fault: {0}”, null == fe.Detail.InnerFault ? “Has Inner Fault” : “No Inner Fault”);
}
}

}
}

private static void AssignManager(IOrganizationService crmOrgService, DataRow userRecord)
{
var userName = userRecord[“User Name”].ToString();
try
{
var result = dt.Rows.Find(userRecord[“Manager”]);
if (result != null)
{
SetParentSystemUserRequest req = new SetParentSystemUserRequest();
req.UserId = new Guid(userRecord[“UserID”].ToString().Trim());
req.ParentId = new Guid(result[“UserID”].ToString().Trim());
req.KeepChildUsers = true;
SetParentSystemUserResponse resp = (SetParentSystemUserResponse)crmOrgService.Execute(req);
}
else
{
Console.WriteLine(String.Format(“User with UserId {0} can not be assigned Manager because Manager : {1} does not exist.”, (string)userRecord[“User Name”], (string)userRecord[“Manager”]));
}
}
catch (Exception ex)
{
Console.WriteLine(“Error in Manager Assignemnt for User : {0}”, userName);
Console.WriteLine(ex.Message);

// Display the details of the inner exception.
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.Message);
FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> fe = ex.InnerException
as FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>;
if (fe != null)
{
Console.WriteLine(“Timestamp: {0}”, fe.Detail.Timestamp);
Console.WriteLine(“Code: {0}”, fe.Detail.ErrorCode);
Console.WriteLine(“Message: {0}”, fe.Detail.Message);
Console.WriteLine(“Trace: {0}”, fe.Detail.TraceText);
Console.WriteLine(“Inner Fault: {0}”, null == fe.Detail.InnerFault ? “Has Inner Fault” : “No Inner Fault”);
}
}

}
}
}
}

Posted in .Net, C#, CRM 2011, CRM 2011 Online, CRM 2011 SDK | Tagged , , , , , , | Leave a comment

Attaching MDF file to Database give Read only or Access Denied Error

Recently I upgraded my laptop from Windows 7 to Windows 8, and I had my SQL server installed in D drive, s I didn’t not bother to take backup of my DB files, thinking the .mdf files are there in my D drive to attach it back after up gradation.

After OS upgrade I went ahead and deleted the SQL server folder from my D drive, after coping the .mdf files that I will attach back once I reinstall the SQL sever again and I reinstalled the SQL server again.

Though I got error while coping those .mdf files from the D:\program files path, but still it got copied.

After getting my SQL server installed back in the NEW OS, when I try to attach the database .MDF file it gave me the below exception, specifically saying “Access denied”

Open failed: Could not open file D:\Employee.mdf for file number 0. OS error: 5(Access is denied.).

I search and there were various options available, like making the UAC off, before attaching etc. but none worked.

what worked for me is

” I added my windows login (which is also the same username used for SQL server installation) to the Security group with full access in both the mdf and ldf files”

and it worked like a charm.

Even if this same user is part of “Administrators” group and this group has full access under Sharing and Security of these two files, by providing full security access explicitly to this user definitely helped.

refer this link for more detailed information.

http://learningsqlserver.wordpress.com/2011/02/13/how-can-i-open-mdf-and-ldf-files-in-sql-server-attach-tutorial-troublshooting/

Posted in SQL Server | Tagged , , , , , | Leave a comment

Exception On Activity Owner Change

Exception : There should be only one owner party for an activity

While trying to perform an AssignRequest on any of
the activity like task,letter,fax etc. in my plug in code.

The requirement was to change the owner of the activity on
its creation.

First we were trying to just change the Ownerid field in
pre-operation of the plugin synchronously, but as its not the proper way of
assigning a record in crm ,throught of using crm AssignRequest for this
purpose.

As this assignment operation was necessary, we registered it
as post-operation Synchronous way.

Plug
in details:-

Crm version:- crm 2011 on premise

Registered
as :- On Create , post , synchronous

Code used:

——————–
AssignRequest assign = new AssignRequest
{
Target = new EntityReference(Fax.EntityLogicalName, faxId),
Assignee = new EntityReference(SystemUser.EntityLogicalName, ownerId)
};
this.CrmService.Execute(assign);

But it gave the below exception.

After all trials,

The actual solution that saved me is, I registed the plug in
as Post-operation
Asynchronous
way. Instead of Synchronously.

Error that I receive

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault,
Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]]

There
should be only one owner party for an activity

Error detail :

at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest
request, CorrelationToken correlationToken, CallerOriginToken
callerOriginToken, WebServiceType serviceType)

at
Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest
request)

at
RoyalBankOfScotland.Crm.Plugins.Portfolio.SetOwnerToPortfolioOwner.PerformOwnerAssignmentOperation(String
entityLogicalName, Guid targetId, Guid ownerId)

at
RoyalBankOfScotland.Crm.Plugins.Portfolio.SetOwnerToPortfolioOwner.SetOwnerForActivities(Entity
targetObject)

at
RoyalBankOfScotland.Crm.Plugins.Portfolio.SetOwnerToPortfolioOwner.SetOwnerForTarget(Entity
targetObject)

at
RoyalBankOfScotland.Crm.Plugins.Portfolio.SetOwnerToPortfolioOwner.Execute()

Inner Exception stack trace: Detail:

<OrganizationServiceFault xmlns:i=”http://www.w3.org/2001/XMLSchema-instance
xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts“>

<ErrorCode>-2147220891</ErrorCode>

<ErrorDetails xmlns:d2p1=”http://schemas.datacontract.org/2004/07/System.Collections.Generic“>

<KeyValuePairOfstringanyType>
<d2p1:key>OperationStatus</d2p1:key>

<d2p1:value
xmlns:d4p1=”http://www.w3.org/2001/XMLSchema
i:type=”d4p1:string”>0</d2p1:value>

</KeyValuePairOfstringanyType>

</ErrorDetails>

Posted in CRM 2011 | Tagged | Leave a comment

SerializationException for Early bind classes in crm 2011 plug in execution

Environment:- CRM 2011
Requirement:- Plug in
While using early binding for crm entities in my plug in by generating .the proxy file through CRM Code Generation Tool (CrmSvcUtil.exe), I got the below SerializationException for the custom entities as well as CRM OOB entities like Account , Contact etc. during the plugin execution.
The error was same for plug in pre-registration as well as post also.
To resolve this I followed the below two things
a> Added the below attribute to the assemblyinfo.cs.
This resolved the serialization issue with my OOB entities like Account or Contact etc.
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
b> but for the custom entities along with the above attribute in the AssemblyInfo.cs file, I added KnownType attribute to the generated proxy class
[System.Runtime.Serialization.DataContractAttribute()]
[Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute(“new_loan”)]
[System.Runtime.Serialization.KnownType(typeof(new_loan))]

[System.CodeDom.Compiler.GeneratedCodeAttribute(“CrmSvcUtil”, “5.0.9688.583”)]
public partial class new_loan : Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
{

……………………

Original exception:-
System.Runtime.Serialization.SerializationException: Type ‘Plugins.Common.EntityWraper.new_loan’ with data contract name ‘new_loan:http://schemas.datacontract.org/2004/07/Plugins.Common.EntityWraper&#8217; is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteArrayOfEntityToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteEntityCollectionToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteKeyValuePairOfRelationshipEntityCollectionX_PsK4FkNToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteRelatedEntityCollectionToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteEntityToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteKeyValuePairOfstringanyTypeToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteParameterCollectionToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteAsyncOperationDataToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteAsyncOperationDataToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter writer, Object graph)
at Microsoft.Crm.Extensibility.AsynchronousStep.SerializeAsyncData(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.AsynchronousStep.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.SystemUserProxy.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.UpdateWithInvocationSource(BusinessEntity entity, FilterExpression filter, Int32 invocationSource, ExecutionContext context)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.HandleRelatedEntities(BusinessEntity primaryEntity, EntityState defaultState, ExecutionContext context)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.CreateWithRelatedEntities(BusinessEntity entity, ExecutionContext context)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)
at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)
at Microsoft.Crm.ObjectModel.AccountService.Create(IBusinessEntity entity, ExecutionContext context)

Posted in CRM 2011 | Tagged | Leave a comment