Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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