The Best Listen On The Net Web site

  Listen On The Net
A reduction in overheads means that streaming web radio retailers are able to offer substantial discounts for online purchases. In many respects they change from streaming web radio retailers to streaming web radio wholesalers. Who benefits from this ... you do.

The only way for you to determine the price differentials on offer is to click on the links for the streaming web radio merchants which we have listed above. These links will take you directly to their website where you will be able to compare their online products with those in normal streaming web radio retail outlets. We definitely think they are worth a visit.Microsoft CRM Customization – programming Closed Email Activity

 by: Boris Makushkin

Microsoft CRM is CRM answer from Microsoft and attempt to get market share from Siebel, Oracle and others traditional Client Relationship Management System vendors. Microsoft CRM uses all the spectrum of Microsoft recent technologies: .Net, MS Exchange, MS Outlook, MS SQL Server, Replication, Indexing, Active Directory, Windows 2000/2003 security model, C#, VB.Net, HTML, XML Web Service, XLTP, Javascript to name a few.

Today's topic is Activity of email type programming - you usually deal with these customizations when you improve Microsoft Exchange CRM connector. How do you create closed activity - this is the main discussion topic. We'll use C#.Net coding

One of the roles of our Exchange Event Handler/Sink is creation MS CRM Closed Activity in handling incoming and outgoing email messages. The interaction with Microsoft CRM uses two approached – using MS CRM SDK (handling inbound and outbound XML messages) and via direct access to MS CRM Database. Let's first look at the Closed Activity creation algorithm:

1. First we need to understand the entity we need to create activity for: Account, Lead or Contact. The selection should use specific criteria – in our case this is email address:

if ((crmAccount = crmConnector.GetAccount(mailboxFrom)) != null) {

}

else if ((crmContact = crmConnector.GetContact(mailboxFrom)) != null) {

}

else if ((crmLead = crmConnector.GetLead(mailboxFrom)) != null) {

}

2. Then we have to get GUID of MS CRM user, who owns this entity, C# code like this:

crmUser = crmConnector.GetUser(crmAccount.GetOwnerId());

3. Next step is closed Activity creation:

emailId = crmConnector.CreateEmailActivity(

crmUser.GetId(),

Microsoft.Crm.Platform.Types.ObjectType.otAccount, crmAccount.GetId(),

Microsoft.Crm.Platform.Types.ObjectType.otSystemUser, crmUser.GetId(),

crmAccount.GetEmailAddress(), crmUser.GetEmailAddress(), sSubject, sBody);

4. The method to create closed activity:

public Guid CreateEmailActivity(Guid userId, int fromObjectType, Guid fromObjectId, int toObjectType, Guid toObjectId, string mailFrom, string mailTo, string subject, string body) {

try {

log.Debug("Prepare for Mail Activity Creating");

// BizUser proxy object

Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser();

ICredentials credentials = new NetworkCredential(sysUserId, sysPassword, sysDomain);

bizUser.Url = crmDir + "BizUser.srf";

bizUser.Credentials = credentials;

Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

// CRMEmail proxy object

Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();

email.Credentials = credentials;

email.Url = crmDir + "CRMEmail.srf";

// Set up the XML string for the activity

string strActivityXml = "";

strActivityXml += "";

strActivityXml += "") + "]]>";

strActivityXml += "";

strActivityXml += userId.ToString("B") + "";

strActivityXml += "";

// Set up the XML string for the activity parties

string strPartiesXml = "";

strPartiesXml += "";

strPartiesXml += "" + mailTo + "";

if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otSystemUser) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + "";

}

else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + "";

}

else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "";

}

else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + "";

}

strPartiesXml += ""+ toObjectId.ToString("B") + "";

strPartiesXml += "";

strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();

strPartiesXml += "";

strPartiesXml += "";

strPartiesXml += "";

strPartiesXml += "" + mailFrom + "";

if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otSystemUser) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + "";

}

else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + "";

}

else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "";

}

else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + "";

}

strPartiesXml += ""+ fromObjectId.ToString("B") + "";

strPartiesXml += "";

strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_SENDER.ToString();

strPartiesXml += "";

strPartiesXml += "";

strPartiesXml += "";

log.Debug(strPartiesXml);

// Create the e-mail object

Guid emailId = new Guid(email.Create(userAuth, strActivityXml, strPartiesXml));

return emailId;

}

catch (System.Web.Services.Protocols.SoapException e) {

log.Debug("ErrorMessage: " + e.Message + " " + e.Detail.OuterXml + " Source: " + e.Source);

}

catch (Exception e) {

log.Debug(e.Message + " \n" + e.StackTrace);

}

return new Guid();

}

5. To make the activity just created be shown correctly you need to setup it's flags according to MS CRM standards:

public void UpdateActivityCodes(Guid emailId) {

try {

OleDbCommand command = conn.CreateCommand();

command.CommandText = "UPDATE ActivityBase SET DirectionCode = (?), StateCode = (?), PriorityCode = (?) WHERE ActivityId = (?)";

command.Prepare();

command.Parameters.Add(new OleDbParameter("DirectionCode", Microsoft.Crm.Platform.Types.EVENT_DIRECTION.ED_INCOMING));

command.Parameters.Add(new OleDbParameter("StateCode", Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_CLOSED));

command.Parameters.Add(new OleDbParameter("PriorityCode", Microsoft.Crm.Platform.Types.PRIORITY_CODE.PC_MEDIUM));

command.Parameters.Add(new OleDbParameter("ActivityId", emailId));

log.Debug("Prepare to update activity code " + emailId.ToString("B") + " in ActivityBase");

command.ExecuteNonQuery();

}

catch(Exception e) {

log.Debug(e.Message + " \n" + e.StackTrace);

}

}

public void UpdateActivityQueueCodes(Guid emailId, Guid queueId) {

try {

OleDbCommand command = conn.CreateCommand();

command.CommandText = "UPDATE QueueItemBase SET Priority = (?), State = (?), QueueId = (?) WHERE ObjectId = (?)";

command.Prepare();

command.Parameters.Add(new OleDbParameter("Priority", Microsoft.Crm.Platform.Types.PRIORITY_CODE.PC_MEDIUM));

command.Parameters.Add(new OleDbParameter("State", Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_CLOSED));

command.Parameters.Add(new OleDbParameter("QueueId", queueId));

command.Parameters.Add(new OleDbParameter("ObjectId", emailId));

log.Debug("Prepare to update activity queue code " + emailId.ToString("B") + " in QueueItemBase");

command.ExecuteNonQuery();

}

catch(Exception e) {

log.Debu

streaming web radio - WDBZ's Mr.
top 40 radio - WDBZ's Mr.
web design - WDBZ's Mr.
web radio broadcasting - WDBZ's Mr.
web radio cajun - WDBZ's Mr.
web radio links - WDBZ's Mr.
web radio mxico - WDBZ's Mr.
web radio sites - WDBZ's Mr.
web radio station - WDBZ's Mr.
web radio web-radio - WDBZ's Mr.
webradio - WDBZ's Mr.
wrps web radio puget sound - WDBZ's Mr.
audio conferencing - WDBZ's Mr.
audio equipment - WDBZ's Mr.
audio player - WDBZ's Mr.
audio speaker - WDBZ's Mr.
audio system - WDBZ's Mr.
audioconferencing - WDBZ's Mr.
baltimore internet audio production - WDBZ's Mr.
car audio - WDBZ's Mr.
car audio system - WDBZ's Mr.
car stereo - WDBZ's Mr.
computer sound - WDBZ's Mr.
internet audio and video - WDBZ's Mr.
internet audio design - WDBZ's Mr.
internet audio player - WDBZ's Mr.
internet audio presentation - WDBZ's Mr.
internet audio production - WDBZ's Mr.
internet audio projects - WDBZ's Mr.
internet audio services - WDBZ's Mr.
internet audio shows - WDBZ's Mr.

WDBZ's Mr. Listen On The Net WDBZ's Mr. Listen On The Net WDBZ's Mr. Listen On The Net WDBZ's Mr. Listen On The Net WDBZ's Mr. Listen On The Net WDBZ's Mr. Listen On The Net

Home | Site Map | internet audio shows | streaming web radio | top 40 radio | web design | web radio broadcasting | web radio cajun | web radio links | web radio mxico | web radio sites

Sign up for PayPal and start accepting credit card payments instantly.

Main Menu
Listen On The Net
Site Resources

Free Tell A Friend from Bravenet.com

News for 09-Mar-10

Source: BBC News | News Front Page | World Edition
Oscar win for dolphin hunt film

Source: BBC News | News Front Page | World Edition
Women's day

Source: BBC News | News Front Page | World Edition
Palestinians back new peace talks

Source: BBC News | News Front Page | World Edition
Probe may have found cosmic dust

Source: BBC News | News Front Page | World Edition
Straw hints at Venables decision

Source: BBC News | News Front Page | World Edition
Rape risk rise for Cambodia women

Source: BBC News | News Front Page | World Edition
Argentine film wins foreign Oscar

Source: BBC News | News Front Page | World Edition
Respite funding 'spent elsewhere'

Source: BBC News | News Front Page | World Edition
Man who shopped for N Korea's leaders reveals Kim's whims

Source: BBC News | News Front Page | World Edition
Sparklehorse singer Linkous dies

Search the Web
internet audio shows
streaming web radio
top 40 radio
web design
web radio broadcasting
web radio cajun
web radio links
web radio mxico
web radio sites
web radio station

Last Updated: Tuesday, 09-Mar-2010 00:04:25 MST
Copyright © 2004 :: Listen On The Net
Internet Meetings :: Medical Meetings On The Net :: Law Meet :: Take It Right

Listen On The Net

MD Newscast   Medical Newscast   Real Time Media On The Net