Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

permissions error on workflow

Posted on by 1,695

Windows 2016 Server CRM 2016 On-Premisis

Windows 2016 Server SQL 2016

I am trying to write a workflow that generates an output file of type excel 

To start, I am just trying to create the excel file with one cell of information. When firing the workflow, I am catching errors into a text file. The error I am getting is

Update To Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

I am somewhat confused as to what I need to do to gain resolve this. I have looked this error up, and its something to do with com permissions, but I'm unsure as to how to resolve this and if any changes should be made on the CRM server or the SQL server.

Any help would be most appreciated

*This post is locked for comments

  • Pete_N Profile Picture
    Pete_N 1,695 on at
    RE: permissions error on workflow

    Hi Andrew,

    Thanks for the help,. one problem resolved and straight into another.  Unfortunately I cannot resolve this using a report, it has to be an excel file.

    My code is now firing but I am getting a different error

    Code:

           Protected Overrides Sub Execute(executioncontext As CodeActivityContext)

               Try

                   Dim xlApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application()

    ' just for testing

                     Using sw As StreamWriter = File.AppendText("\\CBI018\EDDS\Logs\excel.txt")

                       sw.WriteLine("Started")

                   End Using

                   Dim xlWorkBook As Excel.Workbook

                   Dim xlWorkSheet As Excel.Worksheet

                   Dim misValue As Object = System.Reflection.Missing.Value

                   xlWorkBook = xlApp.Workbooks.Add(misValue)

                   xlWorkSheet = xlWorkBook.Sheets("Monthly Report.xls")

                   xlWorkSheet.Cells(1, 1) = "Test"

                   xlWorkBook.SaveAs("C:\Temp\120004 Monthly Report.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue,

            Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue)

                   xlWorkBook.Close(True, misValue, misValue)

                   xlApp.Quit()

                   releaseObject(xlWorkSheet)

                   releaseObject(xlWorkBook)

                   releaseObject(xlApp)

                   Using sw As StreamWriter = File.AppendText("\\CBI018\EDDS\Logs\excel.txt")

                       sw.WriteLine("Finished")

                   End Using

               Catch ex As Exception

                   Using sw As StreamWriter = File.AppendText("\\CBI018\EDDS\Logs\excel.txt")

                       sw.WriteLine("Update To " & ex.Message.ToString)

                   End Using

               End Try

           End Sub

           Private Sub releaseObject(ByVal obj As Object)

               Try

                   System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)

                   obj = Nothing

               Catch ex As Exception

                   obj = Nothing

                   Using sw As StreamWriter = File.AppendText("\\CBI018\EDDS\Logs\excel.txt")

                       sw.WriteLine("Error Closing " & ex.Message.ToString

                                    )

                   End Using

               Finally

                   GC.Collect()

               End Try

           End Sub

    The error I'm getting now is

    Update To Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space.

    • To make more memory available, close workbooks or programs you no longer need.

    • To free disk space, delete files you no longer need from the disk you are saving to.

    I am saving to a local directory on the CRM server ( till I get this working ) . When looking at the services, I can see the Excel application service running. I have plenty on memory on this server ( Win 2016 server running CRM 2016. 20Gb mem and 4 processors ) . I have over 200GB of free disc space, so I don't understand why this error is occouring

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: permissions error on workflow

    Hello,

    This changes should be done on sever where code is executed - so it should be server where Async service is deployed.

    I remember I played with this 10 years ago but it was not the easiest run. I would suggest to find another way. Any chance you can resolve it using report - something similar to this - butenko.pro/.../ms-crm-2011-general-approaches-to-generation-of-reports

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans