locked
Create Report Code RRS feed

  • Question

  • Hi All
    I want to create a report in DCRM 4.0 through Code.
    I have written a code
    It is giving me no exception at all. But in Reports i am not able to see the report i made through code
    Can anyone tell me where i am leaving somthing because of that i am not able to create report or not able to see it

    All credentials have been assigned. With the same code i am able to create an Account and can see it
    I am posting my code.


    public bool CreateMyReport(string szReportName, string szUser, string szSite)
            {
                bool bResult = false;
                m_CrmService = m_DCRM4ServiceEgine.Service;
     
                report Report = new report();             
                Report.name = "Test1"; 
                Report.description = "Hi this is a Testing Report"; 
                Picklist pList = new Picklist();
                pList.Value = 2;
                pList.name = "Other Report";
             
                 Report.reporttypecode = pList;        
                Report.filename = "Test1";            
                Report.bodybinary = @"C:\crm\DCRM 4.0 System Requirements.doc";
                 
                TargetCreateReport target = new TargetCreateReport();           
                target.Report = Report;
               
                CRMServer.CreateRequest create = new CRMServer.CreateRequest(); 
                create.Target = target;

                CRMServer.CreateResponse created =null;
                
                try
                {
                    created=(CRMServer.CreateResponse)m_CrmService.Execute(create);
                }

                catch (SoapException sexc)
                {
                    throw new Exception(sexc.Detail.InnerText);
                }
                
                if (created != null)
                {
                    bResult = true;
                }

                return bResult;
            }

    Well this is the code
    When i am going to do all this manually
    It works fine......

    Any little help will be appreciated

    Thanks in Advance

    Regards
    Sohaib Qazi
    Saturday, December 12, 2009 9:44 AM

All replies

  • Is the code executed using your account information?

    Because a report isonly  visible by default for the user who created it...

    My blog : http://mscrmtools.blogspot.com You will find: Form Javascript Manager (export/import javascript from forms) ISV.Config Manager (graphical ISV.config edition - export/import) View Layout replicator (customize one view and replicate to others) And others (use tool tag on my blog)
    Monday, December 14, 2009 12:41 PM
    Moderator