Skip to content

Instantly share code, notes, and snippets.

@MarkMpn
Created March 4, 2019 22:42
Show Gist options
  • Save MarkMpn/b166619d12304054a24f4c5db667558d to your computer and use it in GitHub Desktop.
Save MarkMpn/b166619d12304054a24f4c5db667558d to your computer and use it in GitHub Desktop.
ASP.NET MVC Controller to generate XrmToolBox Connection List
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