![]() |
#2 |
Участник
|
Вот мой вариант. Может, почерпнете что-нибудь из этого
string orgName = Request.QueryString["orgname"]; ViewState["orgname"] = orgName; CrmAuthenticationToken token = new CrmAuthenticationToken(); token.AuthenticationType = 0; token.OrganizationName = orgName; CrmService service = new CrmService(); service.CrmAuthenticationTokenValue = token; service.Credentials = System.Net.CredentialCache.DefaultCredentials; Guid userid = new Guid(); WhoAmIRequest userRequest = new WhoAmIRequest(); WhoAmIResponse currentUser = (WhoAmIResponse)service.Execute(userRequest); userid = currentUser.UserId; task task = new task(); //string correctDateTime = "2009-05-08T12:00:00"; string correctDateTime = ""; string year = idDate.Text.Substring(6, 4); string month = idDate.Text.Substring(3, 2); string day = idDate.Text.Substring(0, 2); // Set the task subject. task.subject = subjectText.Text; string time = idTime.SelectedItem.Text; string hour = ""; string minute = ""; hour = time.Substring(0, 2); minute = time.Substring(3, 2); // Set the date of the task. correctDateTime = year + "-" + month + "-" + day + "T" + hour + ":" + minute + ":00"; task.scheduledstart = new CrmDateTime(); task.scheduledstart.Value = correctDateTime; //Set the regardingobject task.regardingobjectid = new Lookup(); task.regardingobjectid.Value = new Guid(regardingobjectidHidden.Value); task.regardingobjectid.type = EntityName.account.ToString(); //Set the user task.ownerid = new Owner(); task.ownerid.Value = user.UserId; task.ownerid.type = EntityName.systemuser.ToString(); if (descriptionText.Text != "") { task.description = descriptionText.Text; } //Try to create the task Guid createdTaskId = service.Create(task); #region check success Boolean success = false; if (createdTaskId != Guid.Empty) { success = true; } Log("Task success " + success); Что-то вроде..... |
|
|
![]() |
||||
Тема | Ответов | |||
Новый пользователь из другого домена | 27 | |||
Как лучше реализовать? Создать новый объект или... | 12 | |||
Plugin на для обновления задачи (Task) | 14 | |||
связь через новый объект | 3 | |||
связь через новый объект | 0 |
|