Macro Help Needed (Kentico v8.1)

Jai Prakash asked on October 6, 2014 14:54

Hi

I am following below API document ( using kentico v8.1)

https://docs.kentico.com/display/K8/Registering+custom+macro+methods

to create macro but getting reference error when I tried to register class.

[assembly: RegisterExtension(typeof(CustomMacroMethods), typeof(string))] [assembly: RegisterExtension(typeof(CustomMacroMethods), typeof(StringNamespace))]

Error : "The type or namespace could not be found (are you missing using a directive or an assembly reference?"

Even I have added all below reference.

using CMS.Base; using CMS.MacroEngine; using CMS.Helpers;

using CMS.GlobalHelper; using CMS.Compatibility; using CMS.SettingsProvider; using CMS.DataEngine; using CMS.SiteProvider; using CMS.CMSHelper; using CMS.Scheduler; using CMS.EventLog; using CMS.DocumentEngine;

Please help ?

Thanks

Recent Answers


Joshua Adams answered on October 6, 2014 15:26

Post your code for the namespace and class structure.

0 votesVote for this answer Mark as a Correct answer

Jai Prakash answered on October 6, 2014 15:30

Thanks for response.

I have added simple method in that class-

public static string MyMethod(string param1) { return param1; }

Please help ?

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on October 6, 2014 15:38

The first line should match your namespace and class. Like this:

[assembly: RegisterCustomClass("BP.SendEventReminder", typeof(SendEventReminder.SendEventReminderTask))] namespace SendEventReminder { public class SendEventReminderTask { //code

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.