Ben,
After many days, I was able to put together this code to compile a COM+
component.
Use these two links and follow the instructions:
http://www.greatplains.com/techknowl...0228&target=PS
http://msdn.microsoft.com/library/de...stcallouts.asp
After you followed the steps in those two articles and installed the
component below, you're all set. Works great for me.
Here's my code (you need to generate your own GUID's):
using System;
using System.EnterpriseServices;
using System.Runtime.InteropServices;
using System.IO;
[assembly: ApplicationName("Callout Example")]
[assembly: ApplicationActivation(ActivationOption.Server)]
namespace PostCallout
{
[GuidAttribute("F4233E5B-17DC-4661-9ABC-6707A9F99215")]
public interface ICRMCallout
{
void PostCreate(int ObjectType, string ObjectId, string OrigObjectXml);
void PostUpdate(int ObjectType, string ObjectId, string OrigObjectXml);
void PostDelete(int ObjectType, string ObjectId);
}
[GuidAttribute("AA4AD2AC-97B8-4d24-8E81-388A655DDBE5"),
ClassInterface(ClassInterfaceType.AutoDispatch)]
public class CRMCaller : ServicedComponent, ICRMCallout
{
public CRMCaller()
{
}
public void PostCreate(int ObjectType, string ObjectId, string
OrigObjectXml)
{
FileInfo fi = new FileInfo(@"C:\CSCallout_Insert.txt");
StreamWriter s = fi.AppendText();
s.WriteLine("CRM Create Event Occurred...\n");
s.WriteLine("Object Type: " + ObjectType.ToString());
s.WriteLine("Object ID: " + ObjectId.ToString());
s.WriteLine("Object XML String: ");
s.WriteLine(OrigObjectXml);
s.WriteLine();
s.Close();
}
public void PostUpdate(int ObjectType, string ObjectId, string
OrigObjectXml)
{
FileInfo fi = new FileInfo(@"C:\CSCallout_Update.txt");
StreamWriter s = fi.AppendText();
s.WriteLine("CRM Update Event Occurred...\n");
s.WriteLine("Object Type: " + ObjectType.ToString());
s.WriteLine("Object ID: " + ObjectId.ToString());
s.WriteLine("Object XML String: ");
s.WriteLine(OrigObjectXml);
s.WriteLine();
s.Close();
}
public void PostDelete(int ObjectType, string ObjectId)
{
FileInfo fi = new FileInfo(@"C:\CSCallout_Delete.txt");
StreamWriter s = fi.AppendText();
s.WriteLine("CRM Delete Event Occurred...\n");
s.WriteLine("Object Type: " + ObjectType.ToString());
s.WriteLine("Object ID: " + ObjectId.ToString());
s.WriteLine();
s.Close();
}
}
}
"ben" <anonymous@discussions.microsoft.com> wrote in message
news:A543AA7A-4362-474E-8407-4D908648B0B6@microsoft.com...