tag:blogger.com,1999:blog-60640518328787388862024-02-02T04:40:49.217-08:00More to CRMEmanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-6064051832878738886.post-23597356328238363832014-11-17T01:42:00.003-08:002014-11-17T01:42:47.484-08:00Microsoft free exam vouchers<br />
<span style="font-family: Arial, Helvetica, sans-serif;">Microsoft is offering 4 exam vouchers for office 365 and Azure</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">All voucher can be used until December 31, 2014 and as an limited stock.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<b style="background-color: white; color: #505050; font-family: Arial, Helvetica, sans-serif; line-height: 21px;">Microsoft Certified Specialist in Azure</b><span style="background-color: white; color: #505050; font-family: Arial, Helvetica, sans-serif; line-height: 21px;">, pass one or both of these exams:</span><br />
<div style="color: #505050; font-size: 14px; line-height: 21px;">
</div>
<ul style="color: #505050; font-size: 14px; line-height: 21px;">
<li style="margin-top: 10px;"><span style="background-color: white; font-family: Arial, Helvetica, sans-serif;">71-532: Developing Microsoft Azure Solutions (beta)</span></li>
<li style="margin-top: 10px;"><span style="background-color: white; font-family: Arial, Helvetica, sans-serif;">70-533: Implementing Azure Infrastructure Solutions</span></li>
</ul>
<div style="color: #505050; font-size: 14px; line-height: 21px;">
</div>
<div style="color: #505050; font-size: 14px; line-height: 21px;">
<span style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;"><b>Microsoft Certified Solutions Associate in Office 365</b>, pass both of these exams:</span></span></div>
<div style="color: #505050; font-size: 14px; line-height: 21px;">
</div>
<ul style="color: #505050; font-size: 14px; line-height: 21px;">
<li style="margin-top: 10px;"><span style="background-color: white; font-family: Arial, Helvetica, sans-serif;">70-346: Managing Office 365 Identities and Requirements</span></li>
<li style="margin-top: 10px;"><span style="background-color: white; font-family: Arial, Helvetica, sans-serif;">70-347: Enabling Office 365 Services</span></li>
</ul>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">You can access promotion is through the following link:</span><br />
<br />
<a href="https://vouchers.cloudapp.net/mcp/default.aspx">https://vouchers.cloudapp.net/mcp/default.aspx</a><br />
<br />
<br />Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0tag:blogger.com,1999:blog-6064051832878738886.post-27796818883123059962014-11-06T02:00:00.003-08:002014-11-06T02:00:58.848-08:00Change the "Filter on" to all on the Activity Associated viewsWhen we want to see all activities from an account the default value is "next 30 days".<br />
<br />
If you want to change the default value there no easy way to do so. One the things it's change it by JavaScript.<br />
<br />
Create a new JavaScript web resource and add this code to it:<br />
<br />
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjdistrQyI8SJDSlLl2b8rSGmg7VgOP63RkCCWzLAXQLLyFz0V-5J5EKZTqVddfvpU2erHb0iM5zEVhYkZn3k-KeKUC6wBPbjg44nEFtNimAQrAJSRZXJHJBPK0K5L_Cd1euTH9NkybDv-/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 100%;"><code style="word-wrap: normal;"> //default the Activities 'Filter on' to 'All'
function filterAllActivities() {
document.getElementById("navActivities").onclick = function () {
Mscrm.Details.loadArea(this, "areaActivities");
document.getElementById("areaActivitiesFrame").onload = function () {
var entityName = Xrm.Page.data.entity.getEntityName();
var entity = entityName.charAt(0).toUpperCase() + entityName.substr(1);
var doc = this.contentWindow.document;
var filterOn = doc.getElementById("crmGrid_" + entity + "_ActivityPointers_datefilter");
filterOn.value = "All";
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
filterOn.dispatchEvent(evt);
};
};
}</code></pre>
<br />
Add this new JavaScript web resource library to the form properties (from the entity you want exemple: account, case, opportunity, etc), add an event handler in the form "OnLoad" and call the function "filterAllActivities"<br />
<br />
Save and publish.Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0tag:blogger.com,1999:blog-6064051832878738886.post-46540376867765318842014-11-04T15:43:00.002-08:002014-11-04T15:45:12.974-08:00Dynamically change the user email address when sending emails<div style="margin-bottom: .0001pt; margin: 0cm;">
When you need that several users use the same email address when sending emails, you can do this with creating a queue, setting the email configuration to that queue and every time an user need to send an email, he can change on the "from" field to the queue.</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
The problem is sometimes the user forgot to change address and the email is send with the wrong email address or not send at all (the user don't have mailbox configured)</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
This is a solution to dynamaclly change the email address to the default queue of the user every time you create a new email or reply to an email.</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="color: red;">Note: This will change every user to the his default queue.</span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt;">
- Change the default queue of every user
to the some default queue.<o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt;">
- Configure and test email sending
through this queue.<o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt;">
Now the code:<o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt;">
Need to create 2 <b>JavaScript </b>web resources<o:p></o:p></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<a href="https://www.blogger.com/null" target="_self" title="new_REST_SDK"><span style="background: white; border: 1pt none windowtext; font-family: 'Segoe UI', sans-serif; font-size: 8.5pt; padding: 0cm;">new_REST_SDK</span></a>: You can find the <u>SDK.REST.js</u> on CRM 2011/2013 SDK
in <u>SDK\SampleCode\JS\RESTEndpoint\JavaScriptRESTRetrieveMultiple\JavaScriptRESTRetrieveMultiple\Scripts</u><o:p></o:p></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm;">
<a href="https://www.blogger.com/null" target="_self" title="new_Change_user_email"><span style="background: rgb(196, 221, 255); border: 1pt none windowtext; font-family: 'Segoe UI', sans-serif; font-size: 8.5pt; padding: 0cm;">new_Change_user_email</span></a><o:p></o:p></div>
<div style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm;">
Use the this
code on the web resource text editor<span style="font-size: 13.5pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-size: 13.5pt;"><br /></span></div>
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjdistrQyI8SJDSlLl2b8rSGmg7VgOP63RkCCWzLAXQLLyFz0V-5J5EKZTqVddfvpU2erHb0iM5zEVhYkZn3k-KeKUC6wBPbjg44nEFtNimAQrAJSRZXJHJBPK0K5L_Cd1euTH9NkybDv-/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 100%;"><code style="word-wrap: normal;">function GetDefaultQueue() {
if (Xrm.Page.ui.getFormType() === 1 || Xrm.Page.ui.getFormType() === 2) // new form or update form
{
//Get GUID of logged user
var userId = Xrm.Page.context.getUserId();
SDK.REST.retrieveMultipleRecords("SystemUser", "$select=QueueId&$filter=SystemUserId eq guid'" + userId + "'",
function (results) {
var firstResult = results[0];
if (firstResult !== null) {
var queueId = results[0].QueueId.Id;
var queueName = results[0].QueueId.Name;
}
var lookup = new Array();
var lookupItem = new Object();
lookupItem.id = queueId;
lookupItem.name = queueName;
lookupItem.typename = "queue";
lookup[0] = lookupItem;
Xrm.Page.getAttribute("from").setValue(lookup);
}, function(){}, function(){})
function errorHandler(error) {
alert(error.message);
}
}
} </code></pre>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]-->-<span style="font-stretch: normal;"> </span>Save and
publish.<o:p></o:p><br />
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; line-height: 107%;">-<span style="font-family: 'Times New Roman'; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]-->After the <span style="line-height: 107%;">web resources are inserted, go the email form
editor and click in “Form Properties”.<o:p></o:p></span><br />
<span style="line-height: 107%;"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; line-height: 107%;">-<span style="font-family: 'Times New Roman'; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="line-height: 107%;">Add to the form libraries the 2 web resources you created. <o:p></o:p></span><br />
<span style="line-height: 107%;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZGk8OIqLpyos5h6eF886SKE4-zBx7M-Mrq53DvIvLkEJB3CHx7VuEQpPXCgE1Ou0CH9DYNZCMqZe1PU4QK894RknCMzCOsYJ6HHsd4aJEkyKuPVvHb8iVNVsWfA023JP1XyVn5c-x9KmP/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZGk8OIqLpyos5h6eF886SKE4-zBx7M-Mrq53DvIvLkEJB3CHx7VuEQpPXCgE1Ou0CH9DYNZCMqZe1PU4QK894RknCMzCOsYJ6HHsd4aJEkyKuPVvHb8iVNVsWfA023JP1XyVn5c-x9KmP/s1600/Capture.PNG" height="396" width="400" /></a></div>
<span style="line-height: 107%;"><br /></span>
<span style="line-height: 107%;"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; line-height: 107%;">-<span style="font-family: 'Times New Roman'; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="line-height: 107%;">On the event handler choose (control: form and event: OnLoad)<o:p></o:p></span><br />
<span style="line-height: 107%;"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; line-height: 107%;">-<span style="font-family: 'Times New Roman'; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="line-height: 107%;">Click on add and use this parameters<o:p></o:p></span><br />
<span style="line-height: 107%;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFpNntXc-36hWLQ1X_6htpqfv104QiYfZ4i9UX4D-CKxX-2GvxeTUlDvFFAljfZ-4kgL7JZiL-8fKn03h-TiaA9uPzzZ6SUgFipdquKj7vB77v4OvEloxHXIWEHis9cQy0K1HD4HhPTcIl/s1600/Capture2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFpNntXc-36hWLQ1X_6htpqfv104QiYfZ4i9UX4D-CKxX-2GvxeTUlDvFFAljfZ-4kgL7JZiL-8fKn03h-TiaA9uPzzZ6SUgFipdquKj7vB77v4OvEloxHXIWEHis9cQy0K1HD4HhPTcIl/s1600/Capture2.PNG" height="282" width="400" /></a></div>
<span style="line-height: 107%;"><br /></span>
<span style="line-height: 107%;"><br /></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: 'Times New Roman', serif; line-height: 107%;">-<span style="font-family: 'Times New Roman'; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="line-height: 107%;">Save, close and publish.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="line-height: 107%;">Now
when you try to send an email with one of the user with will change to the
default queue.<o:p></o:p></span></div>
<br />
<div style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0tag:blogger.com,1999:blog-6064051832878738886.post-83486594603826928052014-11-03T03:42:00.002-08:002014-11-03T03:50:53.598-08:00XML validation error when importing solution<div class="MsoNormal">
Last week I was trying to import a manage solution into a
new Microsoft dynamics CRM 2013 organization and I get the following error: <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
"The import file is invalid. XSD validation failed with the
following error: 'The 'distinct' attribute is not declared."<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
After digging around the customization XML file from the
solution, I found out that one of the user of my company build some custom
charts and put the distinct property into an attribute inside the fetchXML tag. <o:p></o:p><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAgd0k2LxsmebmGwSoud0SKsysFGuPyU-PWrWe8zr_iEcJ6oplUX9uwJHU_cQnpfL7faf0qpc2je0RzRWYEAfFrrJ4WXf4CvcKzBeL2cuhCa5QIbzyzHuiqrCdyJzZGWRycga7jv5zUDia/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAgd0k2LxsmebmGwSoud0SKsysFGuPyU-PWrWe8zr_iEcJ6oplUX9uwJHU_cQnpfL7faf0qpc2je0RzRWYEAfFrrJ4WXf4CvcKzBeL2cuhCa5QIbzyzHuiqrCdyJzZGWRycga7jv5zUDia/s1600/Capture.PNG" height="70" width="100%" /></a></div>
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
We contacted the Microsoft CRM support team and asked if it
were possible to have a distinct property associated with the attribute tag.
After a couple of days this was the reply from them:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
“<span lang="EN-US" style="color: #1f497d; mso-ansi-language: EN-US;">I've confirmed internally that using the <b><i>distinct</i></b> property
at <b>attribute</b> level on fetchXML is not allowed, as proved by the XSD
validation schema you got.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="color: #1f497d; mso-ansi-language: EN-US;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="color: #1f497d; mso-ansi-language: EN-US;">On Dynamics CRM SDK we have some FetchXML queries that contains this
property and it might be possible that the SDK will be changed to show the
correct data that can be used.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="color: #1f497d; mso-ansi-language: EN-US;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="color: #1f497d; mso-ansi-language: EN-US;">We apologize for the situation caused by this, and we suggest you to
move the distinct property to fetch tag and to not be used on attribute tag.</span>”
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The solution to this problem:<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
</div>
<ul>
<li><span style="font-size: 7pt; font-stretch: normal; text-indent: -18pt;"> </span><span style="text-indent: -18pt;">Unzip the solution zip file.</span></li>
<li><span style="font-size: 7pt; font-stretch: normal; text-indent: -18pt;"> </span><span style="text-indent: -18pt;">Open the customizations.xml file.</span></li>
<li><span style="font-size: 7pt; font-stretch: normal; text-indent: -18pt;"> </span><span style="text-indent: -18pt;">Remove or put the distinct= ”true” (only the
ones that used with an attribute) into the fetch tag.</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbViNqMRsNcxGio-xf1uqcdMkHI8TvLduL9uHS_etVjlM3WmYEc0wIZDsBtx3FmSTDkTY3GRugFzbr3lo_dPGTaJMoh-FMSGTF6293yw2FMOd-mRrohY9boLrwsPGnpwZP0KexfmvH1mjp/s1600/Capture2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbViNqMRsNcxGio-xf1uqcdMkHI8TvLduL9uHS_etVjlM3WmYEc0wIZDsBtx3FmSTDkTY3GRugFzbr3lo_dPGTaJMoh-FMSGTF6293yw2FMOd-mRrohY9boLrwsPGnpwZP0KexfmvH1mjp/s1600/Capture2.PNG" height="70" width="100%" /></a></div>
<div style="text-indent: -24px;">
<br /></div>
<ul>
<li><span style="font-size: 7pt; font-stretch: normal; text-indent: -18pt;"> </span><span style="text-indent: -18pt;">Save the customizations.xml file.</span></li>
<li><span style="font-size: 7pt; font-stretch: normal; text-indent: -18pt;"> </span><span style="background: white; font-family: Arial, sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">Delete the original
XML in the zip file and add this new </span><span style="text-indent: -18pt;">customizations.xml.</span></li>
<li><span style="font-size: 7pt; font-stretch: normal; text-indent: -18pt;"> </span><span style="text-indent: -18pt;">Import solution.</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p><br />
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<br />
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0tag:blogger.com,1999:blog-6064051832878738886.post-60905196789907191092014-10-31T03:29:00.002-07:002014-10-31T03:43:25.002-07:00Generate password and shuffle the charactersIn a recent project I had to create a function to generate a password with an exact number alpha characters, numeric and symbols and then shuffle them.<br />
<br />
<u>numOfNumericChar</u>s (Indicates number of numeric characters);<br />
<br />
<u>numOfAlphaChars </u>(Indicates number of alpha characters);<br />
<br />
<u>numOfSynbolChars</u> ( Indicates number of symbol characters)<br />
<br />
<u>validNumChars</u> (Valid characters for numeric. Default is all characters from 0- 9)<br />
<br />
<u>validAlphaChars</u> (Valid characters for alpha. Default is all characters from a- z <b> </b>and A-Z)<br />
<br />
<u>validSymbolChars</u> (Valid character for symbols. Default is all characters in !-+_@&$#%)<br />
<br />
C#<br />
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjdistrQyI8SJDSlLl2b8rSGmg7VgOP63RkCCWzLAXQLLyFz0V-5J5EKZTqVddfvpU2erHb0iM5zEVhYkZn3k-KeKUC6wBPbjg44nEFtNimAQrAJSRZXJHJBPK0K5L_Cd1euTH9NkybDv-/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 100%;"><code style="word-wrap: normal;">public string generatePassword(int numOfNumericChars, int numOfAlphaChars, int numOfSynbolChars, string validNumChars = "1234567890", string validAlphaChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", string validSymbolChars = "!-+_@&$#%")
{
StringBuilder res = new StringBuilder();
Random rnd = new Random();
while (0 < numOfNumericChars--)
{
res.Append(validNumChars[rnd.Next(validNumChars.Length)]);
}
while (0 < numOfAlphaChars--)
{
res.Append(validAlphaChars[rnd.Next(validAlphaChars.Length)]);
}
while (0 < numOfSynbolChars--)
{
res.Append(validSymbolChars[rnd.Next(validSymbolChars.Length)]);
}
string stgPassword = res.ToString();
//Shuffle password
char[] array = stgPassword.ToCharArray();
Random rng = new Random();
int n = array.Length;
while (n > 1)
{
n--;
int k = rng.Next(n + 1);
var value = array[k];
array[k] = array[n];
array[n] = value;
}
return stgPassword = new string(array);
} </code></pre>
<br />
<br />Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0tag:blogger.com,1999:blog-6064051832878738886.post-13097245533341895602014-10-30T04:33:00.001-07:002014-10-31T03:42:19.163-07:00IOrganizationService<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><b>What is IOrganizationService? </b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><b><br /></b></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;">Is the web service that accesses data and
metadata for your organization. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><b>Why do I need a IOrganizationService?</b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;">You need IOrganizationService when you
want to work with data in our Microsoft Dynamics CRM system. The methods available
are:<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
</div>
<ul>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Create</b> (Create a record of an
entity)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Retrieve</b> (Retrieve a record of
an entity)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b><span style="line-height: 14.2666664123535px;">R</span>etrieveMultiple</b> ( Retrieve a collection
of records of an entity. This can be used with query expression or fetch XML)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Update</b> (Update a record of an
entity)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;"> <b>
</b></span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Delete</b> (Delete a record of an
entity)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Associate</b> (Create a link between
two records</span><span style="text-indent: -18pt;">)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Disassociate</b> (Delete a link between
two records</span><span style="text-indent: -18pt;">)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Execute</b> (Execute a process.
The must common is workflows, imports and detect duplicates)</span></li>
</ul>
<!--[if !supportLists]--><br />
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><b>How can I get IOrganizationService?</b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><b><br /></b></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;">To get the organization service you need 3
thing:<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
</div>
<ul>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>User</b> (username of a valid user
on the CRM organization)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Password</b> (valid password for the
user)</span></li>
<li><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;">-<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"><b>Uri</b> (You can get the
organization service Uri in your Dynamics CRM system. Go to Settings </span><span style="color: #2a2a2a; font-family: Wingdings; font-size: 10pt; line-height: 107%; text-indent: -18pt;">à</span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"> Customizations </span><span style="color: #2a2a2a; font-family: Wingdings; font-size: 10pt; line-height: 107%; text-indent: -18pt;">à</span><span style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 10pt; line-height: 107%; text-indent: -18pt;"> Developer Resources.)</span></li>
</ul>
<div style="text-indent: -24px;">
<span style="color: #2a2a2a; font-family: Segoe UI, sans-serif; font-size: x-small;"><span style="line-height: 14.2666664123535px;"><br /></span></span></div>
<div style="text-indent: -24px;">
<span style="color: #2a2a2a; font-family: Segoe UI, sans-serif; font-size: x-small;"><span style="line-height: 14.2666664123535px;"><br /></span></span></div>
<b style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 13px; line-height: 14.2666664123535px;">How can I use it on code?</b><br />
<b style="color: #2a2a2a; font-family: 'Segoe UI', sans-serif; font-size: 13px; line-height: 14.2666664123535px;"><br /></b>
<span style="color: #2a2a2a; font-family: Segoe UI, sans-serif; font-size: x-small;"><span style="line-height: 14.2666664123535px;">Need a reference to the </span></span><span style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px;">microsoft.xrm.sdk.dll from the SDK</span><br />
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: #2a2a2a; font-family: "Segoe UI",sans-serif; font-size: 10.0pt; line-height: 107%;">C#</span></div>
<div class="MsoNormal">
<pre style="background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjdistrQyI8SJDSlLl2b8rSGmg7VgOP63RkCCWzLAXQLLyFz0V-5J5EKZTqVddfvpU2erHb0iM5zEVhYkZn3k-KeKUC6wBPbjg44nEFtNimAQrAJSRZXJHJBPK0K5L_Cd1euTH9NkybDv-/s320/codebg.gif) rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 100%;"><code style="word-wrap: normal;">//organization url
IServiceManagement<IOrganizationService> orgServiceManagement = ServiceConfigurationFactory.CreateManagement<IOrganizationService>(new Uri(“Uri”));
//Put Credentials
AuthenticationCredentials authCredentials = new AuthenticationCredentials();
authCredentials.ClientCredentials.UserName.UserName = “user”;
authCredentials.ClientCredentials.UserName.Password = “password”;
AuthenticationCredentials tokenCredentials = orgServiceManagement.Authenticate(authCredentials);
//connection to CRM
OrganizationServiceProxy Service = new OrganizationServiceProxy(orgServiceManagement, tokenCredentials.SecurityTokenResponse);
Service.EnableProxyTypes();
IOrganizationService _service = Service; </code></pre>
</div>
Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0tag:blogger.com,1999:blog-6064051832878738886.post-22963195248206315772014-10-30T03:37:00.001-07:002014-10-30T03:37:46.144-07:00First Post<br />
The main idea for this blog is to help others but also take notes for future projects.<br />
<br />
I'll triy to insert posts regularly so this blog is updated.Emanuel Ricardo Gonçalveshttp://www.blogger.com/profile/09576906492621933136noreply@blogger.com0