<?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>CRM Randevu</Title> <Shortcut>BookCRMAppointment</Shortcut> </Header> <Snippet> <Code Language="CSharp"> <![CDATA[
public Guid BookMyAppointment (Guid myId, string subject, string description, string location, string start, string end) { activityparty myParty = new activityparty(); myParty.partyid = CrmTypes.CreateLookup(EntityName.systemuser.ToString(), myId);
appointment myAppointment = new appointment();
myAppointment.description = description; myAppointment.ownerid = CrmTypes.CreateOwner(EntityName.systemuser.ToString(), myId); myAppointment.scheduledstart = CrmTypes.CreateCrmDateTime(start); myAppointment.scheduledend = CrmTypes.CreateCrmDateTime(end); myAppointment.location = location; myAppointment.subject = subject; myAppointment.requiredattendees = new activityparty[] { myParty };
TargetScheduleAppointment myAppointmentTarget = new TargetScheduleAppointment();
myAppointmentTarget.Appointment = myAppointment;
BookRequest myBookRequest = new BookRequest();
myBookRequest.Target = myAppointmentTarget;
BookResponse booked = (BookResponse)myService.Execute(myBookRequest); if (booked.ValidationResult.ValidationSuccess) { return booked.ValidationResult.ActivityId; } else return new Guid(); }]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>
|