views:

31

answers:

1

I am doing some work in Reporting Service 2005. I need to call a COM object so I wrapped the call in custom assembly. The approach worked in preview. But when I deployed the report I ran into #Error. Microsoft has a KB article about this:

http://support.microsoft.com/?kbid=842419

It says that I have to assert permission in my custom assembly.

But I do not know what permission I should assert? My method looks like this:

       public static String myEnocde(String strDataToEncode)
   {
    //Get IDispatch Interface
    Type objEncoderType = Type.GetTypeFromProgID("ProgID");

    //Create Instance
    object objEncoder = Activator.CreateInstance(objEncoderType);

    // parameter
    object[] parameters = new Object[1];
    parameters[0] = strDataToEncode;

    try
    {
     //Invoke Encode
     Object resultObject = objEncoder.GetType().InvokeMember("Encode", BindingFlags.InvokeMethod,
      Type.DefaultBinder, objEncoder, parameters);

     String strResult = (String)resultObject;

     return strResult;
    }
    catch( Exception theException ) 
    {

} }

The code launches a COM object dynamically, and calls its method using late binding.

I added a CodeGroup in rssrvpolicy.config. The field still showed '#Error'.

+1  A: 

In order to run a report the user making the call must have the role of "Browser". See:

http://www.odetocode.com/Articles/215.aspx

Shiraz Bhaiji