Hello All
This is Abhijeet from India. I am MS CRM technical Consultant in Nitor Infotech and have some issue related with MS CRM.
Actually I have one .aspx page through which i want to connect with MS CRM 2013 Online. On that .aspx page i have First Name and Last Name. When i click save i need to write some code which will save that contact in MS CRM 2013 Online Contact entity. How will I achieve this using C#. Please suggest your valuable inputs.
I gone through following approaches.
http://crm2011corner.blogspot.in/2012/12/connecting-to-crm-online-with-visual.html
Regards
Abhijeet
*This post is locked for comments
I have the same question (0)Hi Abhijeet,
I recommend you to connect to CRM using this new simplified connection:
msdn.microsoft.com/.../gg695810.aspx
Then to combine that simplified connection with your app, you can see this link
msdn.microsoft.com/.../gg695790.aspx
or
msdn.microsoft.com/.../gg695803.aspx
It works for CRM Online and OnPremise
You can use Early Bound or Late Bound.
Early Bound you can use Linq ContextAs well, how to use, for example:
//Create a new contact called Allison Brown.
var allisonBrown = new Xrm.Contact
{
FirstName = "Allison",
// you may change to FirstName = txtFirstName.Text
//(your aspnet and so does for LastName
LastName = "Brown",
Address1_Line1 = "23 Market St.",
Address1_City = "Sammamish",
Address1_StateOrProvince = "MT",
Address1_PostalCode = "99999",
Telephone1 = "12345678",
EMailAddress1 = "allison.brown@example.com"
};
xrm.AddObject(allisonBrown);
xrm.SaveChanges();
If you use early bound another method:
Contact newContact = new Contact();
newContact.FirstName = txtFirstName.Text;
newContact.LastName = txtLastName.Text;
service.Create(newContact);
//you should get the service from var service = new OrganizationService(connection);
//Early Bound is Case sensitive
If you use LateBound
Entity newContact = new Entity ("contact");
newContact["firstname"] = txtFirstName.Text;
newContact["lastname"] = txtLastName.Text;
service.Create(newContact);
//Late Bound is you need to use lower caps
You can learn how to generate the Early Bound from this link:
msdn.microsoft.com/.../gg695803.aspx
Hope this helps!
Thanks.
Aric Levin - MVP
2
Moderator
MA-04060624-0
1