Hi NG,
i try to make the MS Post Call-Out SDK from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmbscrm/html/mbs_crmpostcallouts.asp.
I do it step by step like the How to of this sample told, but i have a
problem, when i make a new Account, the file won't be created.
Here is my C# Code, i only change the GUID.
using System;
using System.EnterpriseServices;
using System.Runtime.InteropServices;
using System.IO;
[assembly: ApplicationName("Callout Example")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly:
ApplicationAccessControl(false,AccessChecksLevel=AccessChecksLevelOption.App
licationComponent)]
namespace CRMCallout.dll
{
[GuidAttribute("2382EA48-5415-4035-9401-E72AD28C76F4")]
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("E32FDCBC-D4F3-45fb-9C99-737F914905D7")]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class CRMCaller : ServicedComponent, ICRMCallout
{
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();
}
}
}
The SQL Statement i modify the SQL statement so that the GUID is the same
like in my sample
[SQL]
declare @subscriberid uniqueidentifier
set @subscriberid = newid()
-- Insert Subscriber (Sample Module)
insert into Subscriber(SubscriberId, CLSIDorProgId, Name, Description)
values
(@subscriberid, N'{E32FDCBC-D4F3-45fb-9C99-737F914905D7}', N'My SDK Sample',
N'My SDK Sample')
--Insert into EntityEventSubscribers
declare @entityid uniqueidentifier
--Account(post-create, post-update, post-delete)
select @entityid = EntityId from Entity where ObjectTypeCode = 1
update Entity set EventMask = EventMask | 1 where ObjectTypeCode = 1
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(2, @entityid, @subscriberid, 0, 1, 0)
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(8, @entityid, @subscriberid, 0, 1, 0)
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(32, @entityid, @subscriberid, 0, 1, 0)
--Contact(post-create, post-update, post-delete)
select @entityid = EntityId from Entity where ObjectTypeCode = 2
update Entity set EventMask = 1 where ObjectTypeCode = 2
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(2, @entityid, @subscriberid, 0, 1, 0)
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(8, @entityid, @subscriberid, 0, 1, 0)
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(32, @entityid, @subscriberid, 0, 1, 0)
--Customer Address(post-create, post-update, post-delete)
select @entityid = EntityId from Entity where ObjectTypeCode = 1071
update Entity set EventMask = 1 where ObjectTypeCode = 1071
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(2, @entityid, @subscriberid, 0, 1, 0)
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(8, @entityid, @subscriberid, 0, 1, 0)
insert into EntityEventSubscribers(EventId, EntityId, SubscriberId,
CalloutOrder, IsEnabled, IsAsyncHandler) values
(32, @entityid, @subscriberid, 0, 1, 0)
I Add the Calss Libary also as Com+ Application (but there is an athoer
ProgID)
Can somebody help me, a tell me what i did wrong?