CRMEmail.CheckIncoming Method
The CheckIncoming method checks whether the incoming e-mail message is relevant to the Microsoft CRM system.
Syntax
[Visual Basic .NET]
Public Function CheckIncoming(
ByVal Recipients As String
) As Integer
[C#]
public int CheckIncoming(
string Recipients
);
[C++]
public: long CheckIncoming(
String* Recipients
);
Parameters
Recipients
Specifies an XML string describing the sender and the recipients of the e-mail message. The XML schema is described by activityparty.xsd.
Return Value
Returns an Int32 type that specifies true if there is at least one user found with ignoreunsolicitedemail set to false or a if a queue has incoming e-mail messages. Otherwise this method returns false. (You can find ignoreunsolicitedemail in usersettings.xsd.)
Note For more information about incoming e-mail, see “Sending and Receiving E-mail in Microsoft CRM Sales for Outlook” in Microsoft CRM Help.
Remarks
If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.
All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}
Example
[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";
// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "https://" + strServer + "/" + virtualDirectory + "/";
// BizUser proxy object
Microsoft.CRM.Proxy.BizUser bizUser = new Microsoft.CRM.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";
// CRMActivity proxy object
Microsoft.CRM.Proxy.CRMActivity activity = new Microsoft.CRM.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";
// CRMEmail proxy object
Microsoft.CRM.Proxy.CRMEmail email = new Microsoft.CRM.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";
string strErrorMsg;
try
{
Microsoft.CRM.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
// Set up the XML string for the activity parties
string strPartiesXml = "<activityparties>";
strPartiesXml += "<activityparty>";
strPartiesXml += "<addressused >jose@adventure-works.com</addressused >";
strPartiesXml += "<partyobjecttypecode>" + Microsoft.CRM.Flags.ObjectType.otContact.ToString(); + "</partyobjecttypecode>";
strPartiesXml += "<participationtypemask>";
strPartiesXml += Microsoft.CRM.Flags.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_CC_RECIPIENT.ToString();
strPartiesXml += "</participationtypemask>";
strPartiesXml += "</activityparty>";
strPartiesXml += "</activityparties>";
// Now check incoming e-mail
int checkin = email.CheckIncoming(strPartiesXml);
}
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 );
}
Requirements
Namespace: Microsoft.CRM.Proxy
Assembly: microsoft.crm.proxy.dll
See Also