How do you put a message on a queue from C#?
I've created the activity. Now I want to route it to a particular user.
This code runs without effect or exception:
The queuetypecode is 1.
static void Main(string[] args)
{
// strServer should be set with the name of the platform Web server
string strServer = "jasper";
// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";
// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new
Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";
// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new
Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";
string strErrorMsg;
string strActivityId = "{C5D32245-23E1-4298-ADD4-C83034517155}";
string strQueueId = "{F2662B9F-0FF5-4D7E-89B2-356A9EA7D00A}";
try
{
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
// Route the activity
activity.Route(userAuth, strActivityId, strQueueId,
Microsoft.Crm.Platform.Proxy.ROUTE_TYPE_CODE.RTC_QUEUE, strQueueId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
// Process the platform error here
strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml +
" Source: " + err.Source );
}
catch (Exception err)
{
// Process other errors here
strErrorMsg = ("ErrorMessage: " + err.Message );
}
}