<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://code.msdn.microsoft.com/rss.xsl"?><rss version="2.0"><channel><title>crmpluginsamples Release Rss Feed</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx</link><description>crmpluginsamples Release Rss Description</description><item><title>UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=1213</link><description>Have you had problems accessing SQL database from Plugin&amp;#63; Do you want to know how to impersonate as Caller in the SQL instead of making calls as NetworkService&amp;#63;&lt;br /&gt;&lt;br /&gt;You can achieve this using the Execute AS command in SQL. You can read more at &amp;#91;url&amp;#58;http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;library&amp;#47;ms181362.aspx&amp;#93;&lt;br /&gt;Network Service should be granted as sysadmin role in the database in order for Impersonation to work&amp;#40;Security-&amp;#62;Logins-&amp;#62;NT AUTHORITY&amp;#92;NETWORK SERVICE&amp;#41;&lt;br /&gt;&lt;br /&gt;I have created a simple plugin to demonstrate this process. I do the following steps&lt;br /&gt;&amp;#35; Retrieve the Domain Name of the caller from the CRM using SDK. SystemUser entity in CRM stores this information, so you can call Retrieve on that entity to get the information&lt;br /&gt;&amp;#35; Create the SQL Connection to a custom database using the connection string specified in the configuration attribute of the step. You can use integrated auth or hard coded sql user as explained in the above section&lt;br /&gt;&amp;#35; Start the impersonation as the caller&lt;br /&gt;&amp;#35; Run the code that you would like to execute&lt;br /&gt;&amp;#35; Revert the sql context to the Networkservice&lt;br /&gt;&lt;br /&gt;public void Execute&amp;#40;IPluginExecutionContext context&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#47;&amp;#47; Step 1. Get the Domain Name of the Caller&lt;br /&gt;&amp;#9;ICrmService crmService &amp;#61; context.CreateCrmService&amp;#40;false&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;systemuser callingUser &amp;#61; &amp;#40;systemuser&amp;#41;crmService.Retrieve&amp;#40;EntityName.systemuser.ToString&amp;#40;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;, context.UserId, new ColumnSet&amp;#40;new string&amp;#91;&amp;#93; &amp;#123; &amp;#34;domainname&amp;#34; &amp;#125;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;&amp;#47;&amp;#47; Step 2 . Connect using SQL Connection specified in the configuration of step&lt;br /&gt;&amp;#9;using &amp;#40;SqlConnection conn &amp;#61; new SqlConnection&amp;#40;m_connectionString&amp;#41;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;conn.Open&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;SqlCommand comm &amp;#61; conn.CreateCommand&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#47;&amp;#47; Step3. Start Imersonation in the SQL&lt;br /&gt;&amp;#9;&amp;#9;comm.CommandText &amp;#61; &amp;#64;&amp;#34;Execute as Login&amp;#61;&amp;#39;&amp;#34; &amp;#43; callingUser.domainname &amp;#43;&amp;#34;&amp;#39;&amp;#59; &amp;#34;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#47;&amp;#47; Step 4. Run the Commands that need to be executed&lt;br /&gt;&amp;#9;&amp;#9;comm.CommandText &amp;#43;&amp;#61; &amp;#34;SELECT SUSER_NAME&amp;#40;&amp;#41;&amp;#59; &amp;#34;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#47;&amp;#47; Step 5. Revert the Context back to the NetworkService context in the SQL&lt;br /&gt;&amp;#9;&amp;#9;comm.CommandText &amp;#43;&amp;#61; &amp;#34;revert&amp;#59;&amp;#34;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;comm.CommandType &amp;#61; System.Data.CommandType.Text&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#47;&amp;#47; For Demo, I am displaying the username it is running as&lt;br /&gt;&amp;#9;&amp;#9;throw new InvalidPluginExecutionException&amp;#40; comm.ExecuteScalar&amp;#40;&amp;#41;.ToString&amp;#40;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;</description><author></author><pubDate>Sat, 28 Jun 2008 03:17:58 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008) 20080628A</guid></item><item><title>UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=1213</link><description>Have you had problems accessing SQL database from Plugin&amp;#63; Do you want to know how to impersonate as Caller in the SQL instead of making calls as NetworkService&amp;#63;&lt;br /&gt;&lt;br /&gt;You can achieve this using the Execute AS command in SQL. You can read more at http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;library&amp;#47;ms181362.aspx &lt;br /&gt;Network Service should be granted as sysadmin role in the database in order for Impersonation to work&amp;#40;Security-&amp;#62;Logins-&amp;#62;NT AUTHORITY&amp;#92;NETWORK SERVICE&amp;#41;</description><author></author><pubDate>Sat, 28 Jun 2008 03:14:44 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008) 20080628A</guid></item><item><title>UPDATED RELEASE: Sample Plugins (Feb 29, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>&amp;#33;&amp;#33; Plugin Samples Version 1.0&lt;br /&gt;&lt;br /&gt;&amp;#42; &amp;#42;LogContextToCRM&amp;#42; plug-in logs all the Context to new_plugincontext entity&lt;br /&gt;&amp;#42; &amp;#42;AmIExecutingOffline&amp;#42; plug-in displays a popup showing if plug-in is running in Offline or on the Server&lt;br /&gt;&amp;#42; &amp;#42;RetrieveEntityId&amp;#42; retrieves the EntityId from the InputParameters property bag&lt;br /&gt;&amp;#42; &amp;#42;RetrieveIncidentIdOnCloseIncident&amp;#42; gets the IncidentId from the InputParameters property bag&lt;br /&gt;&amp;#42; &amp;#42;PluginHelper.cs&amp;#42; has all the libraries to help write plugins easier&lt;br /&gt; - &amp;#43;Ajith Gande&amp;#43;&lt;br /&gt;&lt;br /&gt;&amp;#33;&amp;#33; Simple conflict resolution for requests played back by an offline client&lt;br /&gt;&lt;br /&gt;&amp;#42; A plugin now knows if a request is coming from an offline queue playback and the timestamp of when it was added to the offline queue. The sample plugin uses the timestamp to determine if there is a conflict i.e. the record has been changed on the server after that time and if so, rejects the request from the offline queue&amp;#8221;.&lt;br /&gt; - &amp;#43;Navin Thadani&amp;#43;&lt;br /&gt;</description><author></author><pubDate>Sat, 28 Jun 2008 03:13:48 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Sample Plugins (Feb 29, 2008) 20080628A</guid></item><item><title>UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=1213</link><description>Have you had problems accessing SQL database from Plugin&amp;#63; Do you want to know how to impersonate as Caller in the SQL instead of making calls as NetworkService&amp;#63;&lt;br /&gt;&lt;br /&gt;You can achieve this using the Execute AS command in SQL. You can read more at http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;library&amp;#47;ms181362.aspx &lt;br /&gt;Network Service should be granted as sysadmin role in the database in order for Impersonation to work&amp;#40;Security-&amp;#62;Logins-&amp;#62;NT AUTHORITY&amp;#92;NETWORK SERVICE&amp;#41;</description><author></author><pubDate>Sat, 28 Jun 2008 03:13:30 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008) 20080628A</guid></item><item><title>UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=1213</link><description>Have you had problems accessing SQL database from Plugin&amp;#63; Do you want to know how to impersonate as Caller in the SQL instead of making calls as NetworkService&amp;#63;&lt;br /&gt;&lt;br /&gt;You can achieve this using the Execute AS command in SQL. You can read more at http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;library&amp;#47;ms181362.aspx &lt;br /&gt;Network Service should be granted as sysadmin role in the database in order for Impersonation to work&amp;#40;Security-&amp;#62;Logins-&amp;#62;NT AUTHORITY&amp;#92;NETWORK SERVICE&amp;#41;</description><author></author><pubDate>Sat, 28 Jun 2008 03:13:17 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008) 20080628A</guid></item><item><title>CREATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=1213</link><description>Have you had problems accessing SQL database from Plugin&amp;#63; Do you want to know how to impersonate as Caller in the SQL instead of making calls as NetworkService&amp;#63;&lt;br /&gt;&lt;br /&gt;You can achieve this using the Execute AS command in SQL. You can read more at http&amp;#58;&amp;#47;&amp;#47;msdn.microsoft.com&amp;#47;en-us&amp;#47;library&amp;#47;ms181362.aspx &lt;br /&gt;Network Service should be granted as sysadmin role in the database in order for Impersonation to work&amp;#40;Security-&amp;#62;Logins-&amp;#62;NT AUTHORITY&amp;#92;NETWORK SERVICE&amp;#41;</description><author></author><pubDate>Sat, 28 Jun 2008 03:12:53 GMT</pubDate><guid isPermaLink="false">CREATED RELEASE: Access SQL Database from Plugin (Jun 27, 2008) 20080628A</guid></item><item><title>UPDATED RELEASE: Sample Plugins (Feb 29, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>&amp;#33;&amp;#33; Plugin Samples Version 1.0&lt;br /&gt;&lt;br /&gt;&amp;#42; &amp;#42;LogContextToCRM&amp;#42; plug-in logs all the Context to new_plugincontext entity&lt;br /&gt;&amp;#42; &amp;#42;AmIExecutingOffline&amp;#42; plug-in displays a popup showing if plug-in is running in Offline or on the Server&lt;br /&gt;&amp;#42; &amp;#42;RetrieveEntityId&amp;#42; retrieves the EntityId from the InputParameters property bag&lt;br /&gt;&amp;#42; &amp;#42;RetrieveIncidentIdOnCloseIncident&amp;#42; gets the IncidentId from the InputParameters property bag&lt;br /&gt;&amp;#42; &amp;#42;PluginHelper.cs&amp;#42; has all the libraries to help write plugins easier&lt;br /&gt; - &amp;#43;Ajith Gande&amp;#43;&lt;br /&gt;&lt;br /&gt;&amp;#33;&amp;#33; Simple conflict resolution for requests played back by an offline client&lt;br /&gt;&lt;br /&gt;&amp;#42; A plugin now knows if a request is coming from an offline queue playback and the timestamp of when it was added to the offline queue. The sample plugin uses the timestamp to determine if there is a conflict i.e. the record has been changed on the server after that time and if so, rejects the request from the offline queue&amp;#8221;.&lt;br /&gt; - &amp;#43;Navin Thadani&amp;#43;&lt;br /&gt;</description><author></author><pubDate>Fri, 07 Mar 2008 15:57:04 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Sample Plugins (Feb 29, 2008) 20080307P</guid></item><item><title>UPDATED RELEASE: Sample Plugins (Feb 29, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>&amp;#33;&amp;#33; Plugin Samples Version 1.0&lt;br /&gt;&lt;br /&gt;&amp;#42; &amp;#42;LogContextToCRM&amp;#42; plug-in logs all the Context to new_plugincontext entity&lt;br /&gt;&amp;#42; &amp;#42;AmIExecutingOffline&amp;#42; plug-in displays a popup showing if plug-in is running in Offline or on the Server&lt;br /&gt;&amp;#42; &amp;#42;RetrieveEntityId&amp;#42; retrieves the EntityId from the InputParameters property bag&lt;br /&gt;&amp;#42; &amp;#42;RetrieveIncidentIdOnCloseIncident&amp;#42; gets the IncidentId from the InputParameters property bag&lt;br /&gt;&amp;#42; &amp;#42;PluginHelper.cs&amp;#42; has all the libraries to help write plugins easier&lt;br /&gt;&lt;br /&gt;&amp;#33;&amp;#33; Simple conflict resolution for requests played back by an offline client&lt;br /&gt;&lt;br /&gt;&amp;#42; A plugin now knows if a request is coming from an offline queue playback and the timestamp of when it was added to the offline queue. The sample plugin uses the timestamp to determine if there is a conflict i.e. the record has been changed on the server after that time and if so, rejects the request from the offline queue&amp;#8221;.&lt;br /&gt; - &amp;#43;Navin Thadani&amp;#43;&lt;br /&gt;</description><author></author><pubDate>Fri, 07 Mar 2008 15:56:31 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Sample Plugins (Feb 29, 2008) 20080307P</guid></item><item><title>UPDATED RELEASE: Sample Plugins (Feb 29, 2008)</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>&amp;#33;&amp;#33; Simple conflict resolution for requests played back by an offline client&lt;br /&gt;&lt;br /&gt;&amp;#42; A plugin now knows if a request is coming from an offline queue playback and the timestamp of when it was added to the offline queue. The sample plugin uses the timestamp to determine if there is a conflict i.e. the record has been changed on the server after that time and if so, rejects the request from the offline queue&amp;#8221;.&lt;br /&gt; - &amp;#43;Navin Thadani&amp;#43;&lt;br /&gt;&lt;br /&gt;&amp;#33;&amp;#33; Coming soon &amp;#33;&amp;#33;&amp;#33;&lt;br /&gt;1. How to read EntityId in the Plugin for most of the messages&amp;#63;&lt;br /&gt;2. How to use pass data to plugin via registration&amp;#63;&lt;br /&gt;3. How to use Filtered Views from Plugins&amp;#63;&lt;br /&gt;</description><author></author><pubDate>Sat, 01 Mar 2008 02:02:39 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Sample Plugins (Feb 29, 2008) 20080301A</guid></item><item><title>UPDATED RELEASE: Sample Plugins</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>&amp;#33; Simple conflict resolution for requests played back by an offline client&lt;br /&gt;&lt;br /&gt;A plugin now knows if a request is coming from an offline queue playback and the timestamp of when it was added to the offline queue. The sample plugin uses the timestamp to determine if there is a conflict i.e. the record has been changed on the server after that time and if so, rejects the request from the offline queue&amp;#8221;.&lt;br /&gt;&lt;br /&gt;&amp;#33;&amp;#33; Coming soon &amp;#33;&amp;#33;&amp;#33;&lt;br /&gt;1. How to read EntityId in the Plugin for most of the messages&amp;#63;&lt;br /&gt;2. How to use pass data to plugin via registration&amp;#63;&lt;br /&gt;3. How to use Filtered Views from Plugins&amp;#63;&lt;br /&gt;</description><author></author><pubDate>Sat, 01 Mar 2008 02:01:34 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Sample Plugins 20080301A</guid></item><item><title>UPDATED RELEASE: Sample Plugins</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>&amp;#33; Simple conflict resolution for requests played back by an offline client&lt;br /&gt;&lt;br /&gt;A plugin now knows if a request is coming from an offline queue playback and the timestamp of when it was added to the offline queue. The sample plugin uses the timestamp to determine if there is a conflict i.e. the record has been changed on the server after that time and if so, rejects the request from the offline queue&amp;#8221;.&lt;br /&gt;&lt;br /&gt;&amp;#33;&amp;#33; Coming soon &amp;#33;&amp;#33;&amp;#33;&lt;br /&gt;1. How to read EntityId in the Plugin for most of the messages&amp;#63;&lt;br /&gt;2. How to use pass data to plugin via registration&amp;#63;&lt;br /&gt;3. How to use Filtered Views from Plugins&amp;#63;&lt;br /&gt;</description><author></author><pubDate>Sat, 01 Mar 2008 02:01:17 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: Sample Plugins 20080301A</guid></item><item><title>CREATED RELEASE: Sample Plugins for reading entity id</title><link>http://code.msdn.microsoft.com/crmpluginsamples/Release/ProjectReleases.aspx?ReleaseId=443</link><description>1. How to read EntityId in the Plugin for most of the messages&amp;#63;&lt;br /&gt;2. How to use pass data to plugin via registration&amp;#63;&lt;br /&gt;3. How to use Filtered Views from Plugins&amp;#63;&lt;br /&gt;</description><author></author><pubDate>Thu, 21 Feb 2008 22:13:55 GMT</pubDate><guid isPermaLink="false">CREATED RELEASE: Sample Plugins for reading entity id 20080221P</guid></item></channel></rss>