Created
March 4, 2019 22:42
-
-
Save MarkMpn/b166619d12304054a24f4c5db667558d to your computer and use it in GitHub Desktop.
ASP.NET MVC Controller to generate XrmToolBox Connection List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConnectionListController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
var model = new CrmConnections | |
{ | |
Connections = new ConnectionDetails | |
{ | |
Proxy = new Proxy(), | |
Name = "Client CRM Connections", | |
Connections = new[] { | |
new CrmConnection(new Uri("https://example.crm.dynamics.com", "username@acme.onmicrosoft.com", null)) | |
} | |
} | |
}; | |
var serializer = new XmlSerializer(typeof(CrmConnections)); | |
using (var stream = new MemoryStream()) | |
{ | |
serializer.Serialize(stream, model); | |
return Content(Encoding.UTF8.GetString(stream.ToArray()), "text/xml"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment