locked
Accessing C# Class Library via Outlook VBA RRS feed

  • Question

  • Trying to access a .Net Class Library from MS Outlook 2007. I submitted this on the Office Dev form but they said no dice.

    I built a class library that looks like this. Build using x86

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    namespace PeruToJira
    {
        /// <summary>
        /// Represents a PeruToJira class
        /// </summary>
        public class SubmitReport
        {
            /// <summary>
            /// Submit report data to be submitted tp JIRA Database
            /// </summary>
            public static int Submit(string strXMLFilePath, string strTitle, string strDescription)
            {
                return 1234;
            }
        }
    } 
    In the class
     project I checked the "Register for COM interop" and "Make assembly COM-Visible".

    I built a dummy C# console app to access the class, it looks like this and executes fine. Built using x86

        static void Main(string[] args)
            {
            int retvalue = PeruToJira.SubmitReport.Submit("", "", "");
            }


    In the Outlook VBA I added the reference via the PeruToJira.tlb file

                Dim objp2Jira As PeruToJira.SubmitReport
               
                Set objp2Jira = New PeruToJira.SubmitReport
               
                lngTrackerNumber = objp2Jira.Submit(strXMLPathFile, strTitle, strDescription)


    When I execute the "objp2Jira.Submit(...) line I get an exeception that states "Object doesn't support this property or method"


    Any help? Thanks

    Monday, February 6, 2012 7:04 PM

Answers

  • Correct.  Static methods are not COM-exportable.
    Jose R. MCP
    • Marked as answer by GSP_T Monday, February 6, 2012 8:56 PM
    Monday, February 6, 2012 8:17 PM