Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)
Under review by Community Managers

Under review

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

can we Export Managed Solutions Using C# ExportSolutionRequest in Dynamics 365 Soutions

Posted on by 2
I am currently working on an XrmToolBox plugin project where I need to export both managed and unmanaged solutions from Dynamics 365. I have written the following code to export solutions:
Code : 
////////////////////////////////////////
 
         public byte[] RetrieveSolutionFile(IOrganizationService service, string solutionUniqueName)
        {
            ExportSolutionRequest exportRequest = new ExportSolutionRequest
            {
                SolutionName = solutionUniqueName,
                Managed = true,
                //ExportAutoNumberingSettings = true,
                //ExportCalendarSettings = true,
                //ExportCustomizationSettings = true,
                //ExportEmailTrackingSettings = true,
                //ExportExternalApplications = true,
                //ExportGeneralSettings = true,
                //ExportMarketingSettings = true,
                //ExportOutlookSynchronizationSettings = true,
                //ExportRelationshipRoles = true,
                //ExportSales = true
            };
            ExportSolutionResponse exportResponse = (ExportSolutionResponse)service.Execute(exportRequest);
            byte[] exportXml = exportResponse.ExportSolutionFile;
            return exportXml;
        }
/////////////////////////////////////
 
The code works perfectly for exporting unmanaged solutions when I set Managed = false. However, I encounter an error when attempting to export managed solutions with Managed = true. The error message is:
 
//////
 
 
QUESTIONS:
  • Is there a way to programmatically export managed solutions from Dynamics 365?
  • Are there any workarounds or best practices for exporting managed solutions.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans