<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MSCRM Blogger &#187; questions</title>
	<atom:link href="http://mscrmblogger.com/tag/questions/feed/" rel="self" type="application/rss+xml" />
	<link>http://mscrmblogger.com</link>
	<description>Achieving it all with Microsoft Dynamics CRM™</description>
	<lastBuildDate>Fri, 09 Jul 2010 14:57:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>QueueItem RSS &#8211; An Example Of CRM RSS</title>
		<link>http://mscrmblogger.com/2009/09/30/queueitem-rss-an-example-of-crm-rss/</link>
		<comments>http://mscrmblogger.com/2009/09/30/queueitem-rss-an-example-of-crm-rss/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 20:53:11 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Addons]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 4]]></category>
		<category><![CDATA[crm sdk]]></category>
		<category><![CDATA[crm4]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics CRM 4]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[questions]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=143</guid>
		<description><![CDATA[The Notification Accelerator on Codeplex does not offer a queueitem RSS feed.  I'm not sure why, but here is a simple solution to display an RSS feed.  It defaults to the current user's queues, but if the q=blah is specified in address then all queueitems in any queue with blah in it will be displayed.]]></description>
			<content:encoded><![CDATA[<p>The Notification Accelerator on Codeplex does not offer a queueitem RSS feed.  I&#8217;m not sure why, but here is a simple solution to display an RSS feed.  It defaults to the current user&#8217;s queues, but if the q=blah is specified in address then all queueitems in any queue with blah in it will be displayed.  Please feel free to post your comments.  I did not spend a lot of time on this and I think sql would be quicker.  If you find a method that is quick and easy that displays the queue name and queue items, please post it.</p>
<p>crmsdk is my http://crm/MSCrmServices/2007/CrmService.asmx web reference</p>
<pre name="code" class="csharp">
using System;
using System.Net;
using System.Text;
using System.Web.UI;
using System.Xml;
using CRMQIRSS.crmsdk;

namespace CRMQIRSS
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var QueueName = String.Empty;

            try
            {
                QueueName = Request[&quot;q&quot;];
            }
            catch
            {
                // Ignore Errors
            }

            // Clear Any Response
            Response.Clear();
            Response.ContentType = &quot;text/xml&quot;;

            var xtwFeed = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
            xtwFeed.WriteStartDocument();
            // Setup Feed

            xtwFeed.WriteStartElement(&quot;rss&quot;);
            xtwFeed.WriteAttributeString(&quot;version&quot;, &quot;2.0&quot;);

            // Setup Channel
            xtwFeed.WriteStartElement(&quot;channel&quot;);
            xtwFeed.WriteElementString(&quot;title&quot;, QueueName);
            xtwFeed.WriteElementString(&quot;link&quot;, &quot;http://www.mscrmblogger.com&quot;);
            xtwFeed.WriteElementString(&quot;ttl&quot;, &quot;5&quot;);
            xtwFeed.WriteElementString(&quot;description&quot;, &quot;The most technical and solution rich CRM blog.&quot;);
            xtwFeed.WriteElementString(&quot;copyright&quot;, &quot;Copyright 2009 mscrmblogger.com. All rights reserved.&quot;);

            // Get the Dataset
            BusinessEntityCollection becQueueItems;
            if (String.IsNullOrEmpty(QueueName))
            {
                becQueueItems = GetQueueItemsByCurrentUser();
            }
            else
            {
                becQueueItems = GetQueueItemsByName(QueueName);
            }

            foreach (var be in becQueueItems.BusinessEntities)
            {
                var qi = (queueitem) be;

                var description = &quot;Created: &quot; + Convert.ToDateTime(qi.createdon.Value).ToString(&quot;f&quot;);

                xtwFeed.WriteStartElement(&quot;item&quot;);

                xtwFeed.WriteElementString(&quot;title&quot;, qi.title);

                xtwFeed.WriteElementString(&quot;description&quot;, description);

                String objecttypecode;
                switch (qi.objecttypecode.Value)
                {
                    case &quot;incident&quot;:
                        objecttypecode = &quot;112&quot;;
                        break;
                    case &quot;task&quot;:
                        objecttypecode = &quot;4212&quot;;
                        break;
                    case &quot;phonecall&quot;:
                        objecttypecode = &quot;4202&quot;;
                        break;
                    case &quot;letter&quot;:
                        objecttypecode = &quot;4207&quot;;
                        break;
                    case &quot;serviceappointment&quot;:
                        objecttypecode = &quot;4214&quot;;
                        break;
                    case &quot;fax&quot;:
                        objecttypecode = &quot;4204&quot;;
                        break;
                    case &quot;email&quot;:
                        objecttypecode = &quot;4202&quot;;
                        break;
                    case &quot;campaignactivity&quot;:
                        objecttypecode = &quot;4402&quot;;
                        break;
                    case &quot;campaignresponse&quot;:
                        objecttypecode = &quot;4401&quot;;
                        break;
                    default:
                        objecttypecode = &quot;0&quot;;
                        break;
                }

                xtwFeed.WriteElementString(&quot;link&quot;,
                                           &quot;http://crm/CRMReports/viewer/drillopen.aspx?ID=&quot; + qi.objectid.Value +
                                           &quot;&amp;OTC=&quot; + objecttypecode);

                xtwFeed.WriteElementString(&quot;pubDate&quot;, Convert.ToDateTime(qi.enteredon.Value).ToString(&quot;f&quot;));

                xtwFeed.WriteElementString(&quot;author&quot;, qi.createdby.name);

                //TODO: Lookup the queue...  this would be quicker (and easier) with SQL...
                //xtwFeed.WriteElementString(&quot;category&quot;, &quot;queue/&quot; + qi.queueid);

                xtwFeed.WriteEndElement();
            }

            // Close all tags
            xtwFeed.WriteEndElement();
            xtwFeed.WriteEndElement();
            xtwFeed.WriteEndDocument();
            xtwFeed.Flush();
            xtwFeed.Close();
            Response.End();
        }

        private CrmService GetCrmServiceConnection(String Organization)
        {
            var token = new CrmAuthenticationToken();
            token.AuthenticationType = 0; //AD
            token.OrganizationName = Organization;

            var crmService = new CrmService();
            crmService.CrmAuthenticationTokenValue = token;
            crmService.Credentials = CredentialCache.DefaultCredentials;

            return crmService;
        }

        private BusinessEntityCollection FetchDataSet(string fetchXml)
        {
            var service = GetCrmServiceConnection(&quot;OrganizationXYZ&quot;);

            var request = new FetchXmlToQueryExpressionRequest();
            request.FetchXml = fetchXml;

            var response = (FetchXmlToQueryExpressionResponse) service.Execute(request);

            var items = service.RetrieveMultiple(response.Query);

            return items;
        }

        private BusinessEntityCollection GetQueueItemsByName(String queueName)
        {
            var fetchXML = &quot;&lt;fetch mapping=\&quot;logical\&quot; count=\&quot;50\&quot; distinct=\&quot;true\&quot;&gt;&quot; +
                           &quot;  &lt;entity name=\&quot;queueitem\&quot;&gt;&quot; +
                           &quot;    &lt;all-attributes /&gt;&quot; +
                           &quot;    &lt;link-entity name=\&quot;queue\&quot; from=\&quot;queueid\&quot; to=\&quot;queueid\&quot;&gt;&quot; +
                           &quot;      &lt;attribute name=\&quot;name\&quot; /&gt;&quot; +
                           &quot;      &lt;filter&gt;&quot; +
                           &quot;        &lt;condition attribute=\&quot;name\&quot; operator=\&quot;like\&quot; value=\&quot;%&quot; +
                           queueName +
                           &quot;%\&quot; /&gt;&quot; +
                           &quot;      &lt;/filter&gt;&quot; +
                           &quot;    &lt;/link-entity&gt;&quot; +
                           &quot;  &lt;/entity&gt;&quot; +
                           &quot;&lt;/fetch&gt;&quot;;

            return FetchDataSet(fetchXML);
        }

        private BusinessEntityCollection GetQueueItemsByCurrentUser()
        {
            var fetchXML = &quot;&lt;fetch mapping=\&quot;logical\&quot; count=\&quot;50\&quot; distinct=\&quot;true\&quot;&gt;&quot; +
                           &quot;  &lt;entity name=\&quot;queueitem\&quot;&gt;&quot; +
                           &quot;    &lt;all-attributes /&gt;&quot; +
                           &quot;    &lt;link-entity name=\&quot;queue\&quot; from=\&quot;queueid\&quot; to=\&quot;queueid\&quot;&gt;&quot; +
                           &quot;      &lt;attribute name=\&quot;name\&quot; /&gt;&quot; +
                           &quot;      &lt;filter&gt;&quot; +
                           &quot;        &lt;condition attribute=\&quot;primaryuserid\&quot; operator=\&quot;eq-userid\&quot; /&gt;&quot; +
                           &quot;      &lt;/filter&gt;&quot; +
                           &quot;    &lt;/link-entity&gt;&quot; +
                           &quot;  &lt;/entity&gt;&quot; +
                           &quot;&lt;/fetch&gt;&quot;;

            return FetchDataSet(fetchXML);
        }
    }
}
</pre>
<p>Total time spent on this: 45 minutes</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2009/09/30/queueitem-rss-an-example-of-crm-rss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Questions and Answers</title>
		<link>http://mscrmblogger.com/2009/09/29/questions-and-answers/</link>
		<comments>http://mscrmblogger.com/2009/09/29/questions-and-answers/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 11:36:26 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[questions]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=123</guid>
		<description><![CDATA[We really want people to ask us questions.  We post the things we think people will find interesting, but now you have the chance to ask us a question and we will do our best to answer it, whether that means developing a solution or finding you the necessary resources.
Click here for the Questions [...]]]></description>
			<content:encoded><![CDATA[<p>We really want people to ask us questions.  We post the things we think people will find interesting, but now you have the chance to ask us a question and we will do our best to answer it, whether that means developing a solution or finding you the necessary resources.</p>
<p><a style="color:red;text-decoration:underline" href="http://mscrmblogger.com/qa/">Click here for the Questions and Answers section.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2009/09/29/questions-and-answers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
