Dynamics crm 2011 CRM 2011中的silverlight应用程序不存在SearchRequest和SearchResponse类?

Dynamics crm 2011 CRM 2011中的silverlight应用程序不存在SearchRequest和SearchResponse类?,dynamics-crm-2011,dynamics-crm,dynamics-crm-4,Dynamics Crm 2011,Dynamics Crm,Dynamics Crm 4,我想在CRM 2011中搜索给定资源的所有可用时间段。现在CRM 2011 sdk为控制台应用程序提供了一个示例,该应用程序运行良好,但我想在silverlight应用程序中做同样的事情。在我的silverlight应用程序中,我无法找到SearchRequest和SearchResponse类 有人能帮我在silverlight应用程序中如何做到这一点吗?首先准备AppointmentRequest对象 private void checkButton_Click(object se

我想在CRM 2011中搜索给定资源的所有可用时间段。现在CRM 2011 sdk为控制台应用程序提供了一个示例,该应用程序运行良好,但我想在silverlight应用程序中做同样的事情。在我的silverlight应用程序中,我无法找到SearchRequest和SearchResponse类


有人能帮我在silverlight应用程序中如何做到这一点吗?

首先准备AppointmentRequest对象

     private void checkButton_Click(object sender, RoutedEventArgs e)
        {           
            AppointmentRequest appReq = new AppointmentRequest
            {
                Objectives = new ObservableCollection<ObjectiveRelation>(),
                RequiredResources = new ObservableCollection<RequiredResource>(),
                AppointmentsToIgnore = new ObservableCollection<AppointmentsToIgnore>(),
                Constraints = new ObservableCollection<ConstraintRelation>(),
                Sites = new ObservableCollection<Guid>(),
        Duration = 60,
        Direction = SearchDirection.Forward,
        NumberOfResults = 5,
        ServiceId = new Guid("DD535FD0-F84B-E111-8F2F-00505688095F"),
        SearchWindowStart = DateTime.UtcNow,
        SearchWindowEnd = DateTime.UtcNow.AddDays(7.0),
        AnchorOffset = 300
    };

    OrganizationRequest req = new OrganizationRequest() { RequestName = "Search" };

    req["AppointmentRequest"] = appReq;

    IOrganizationService service = SilverlightUtility.GetSoapService();

    service.BeginExecute(req, new AsyncCallback(GetAppReqResult), service);
}

Following is the Asynchromus callback function

private void GetAppReqResult(IAsyncResult res)
{
   try
   {
     OrganizationResponse resp = 
                          ((IOrganizationService)res.AsyncState).EndExecute(res);

     SearchResults results = (SearchResults)resp["SearchResults"];

     this.Dispatcher.BeginInvoke(() => ProcessAppointments(results));        

   }
   catch (Exception)
   {
       MessageBox.Show("Error Occurred");
   }
}
private void checkButton\u单击(对象发送者,路由目标)
{           
任命请求appReq=新任命请求
{
目标=新的可观察集合(),
RequiredResources=新的ObservableCollection(),
AppointmentsToIgnore=新的ObservableCollection(),
约束=新的ObservableCollection(),
站点=新的ObservableCollection(),
持续时间=60,
方向=搜索方向。向前,
NumberOfResults=5,
ServiceId=新Guid(“DD535FD0-F84B-E111-8F2F-00505688095F”),
SearchWindowsStart=DateTime.UtcNow,
SearchWindowEnd=DateTime.UtcNow.AddDays(7.0),
锚定偏移=300
};
OrganizationRequest req=新的OrganizationRequest(){RequestName=“Search”};
请求[“任命请求”]=批准;
IOOrganizationService=SilverlightUtility.GetSoapService();
BeginExecute(req,新的异步回调(GetAppReqResult),service);
}
下面是Asynchromus回调函数
私有无效GetAppReqResult(IAsyncResult Result)
{
尝试
{
组织响应响应=
((IOrganizationService)res.AsyncState).EndExecute(res);
SearchResults=(SearchResults)resp[“SearchResults”];
this.Dispatcher.BeginInvoke(()=>processappointment(results));
}
捕获(例外)
{
MessageBox.Show(“发生错误”);
}
}
结果对象将包含传递的约会请求对象的所有可能时间段。 希望这对像我这样的人有所帮助